On Mon, Jan 5, 2009 at 3:15 AM, Terence Monteiro <tere...@deeproot.co.in> wrote:
> 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 included >>> 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 difference. >>> #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 illuminating). 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 (MaxClients >> = 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@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/