[Catalyst] Catalyst modperl - child process segmentation fault
scott+catalyst at konobi.co.uk
Mon Jan 5 20:00:31 GMT 2009
This looks like the general DBI multi-process issue. When you fork any child
processes, any variables in the parent process are copied across, this
includes the filehandle no. for the socket to the mysql server. All of a
sudden you have 50 processes talking down the same wire. What you want to do
is disconnect (but not destroy) the database handle before forking and then
get each child to reconnect() themselves (DBI can deal with pooling
Apache::DBI does this for you, but iirc it doesn't _quite_ work correctly.
-Scott McWhirter- | -konobi-
On Mon, Jan 5, 2009 at 11:40, Todd Lyons <tlyons at ivenue.com> wrote:
> On Mon, Jan 5, 2009 at 3:15 AM, Terence Monteiro <terence at deeproot.co.in>
> > Is it necessary to close open database handles after handling each HTTP
> > request? Should I add code in my begin and end actions to open and close
> > handles each time? I'm still pulling off hair on this segfault problem.
> It shouldn't be necessary. You completely throw away the benefits of
> connection pooling if you create/teardown a db connection every single
> webpage access.
> >>> I am initializing the database connection in a Controller. Is
> >>> there any problem in this, though it may not be the best design. Will
> >>> putting the database initialization code in the Model help? I have
> >>> the backtrace for your information. Have I missed anything?
> Model here, works well for us. Ultimately it's up to your if you want
> to try. I'm not expert enough to know whether it would make a
> >>> #0 0xb6038590 in mysql_ping () from /usr/lib/libmysqlclient.so.15
> >>> #1 0xb61e9d93 in XS_DBD__mysql__db_ping () from
> >>> /usr/lib/perl5/auto/DBD/mysql/mysql.so
> What's your max clients set to in mysql? How many connections are
> open? (show processlist when logged in to mysql as root will be most
> What's your connection_timeout set to? If you have a short connection
> timeout, then low traffic will result in db connections getting closed
> by mysql, which DBI only handles if your code is written to handle it
> (though I don't expect this to be a problem because your description
> seems to imply a problem on startup, not while running).
> >> I don't face the problem when I run apache as a single process
> >> =3D 1).
> Another problem we had was if you configured pam/nss to use LDAP, when
> apache started and tried to create all the threads at once, not all
> threads were able to get the uid from nss, so some would be the apache
> user, and some would still be root. Was very strange. But that
> doesn't sound like what you're seeing either.
> Good luck!
> Regards... Todd
> All truth passes through three stages. First, it is ridiculed. Second,
> it is violently opposed. Third, it is accepted as being self-evident.
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst