CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI: Re: [vmraj] DB Connections resetting: Edit Log



1arryb
User

Nov 24, 2009, 8:14 AM


Views: 4481
Re: [vmraj] DB Connections resetting

Hi vmraj,

Caveats: I have never used Rose::DB::Object and anyway, I haven't seen your code, but...

Are you opening your db with Rose::DB->new_or_cached()? If so, your parent may be sharing the same db session with the children even though they supposedly have their own database objects.

Another (related) possiblity is that you're forking the child after you connect to the db in the parent. I suspect the following sequence of events might be occurring:

1. The child gets a copy of the parent's heap during the fork.
2. The child's heap includes a copy of the parent's Rose::DB::Object (with associated db handle).
3. The child destroy's it's copy of the parent's db object upon exit and the Rose::DB library closes the db session.
4. Meanwhile, in the parent, it's db handle has just been invalidated because the child closed the session.

If this is happening, you'll have to re-open the db in the parent after each fork or use something like Rose::DB::AutoReconnect.

Update:

If the parent doesn't have to interact with the db too often, perhaps the easiest thing to do would be to open a new session for each transaction.

Cheers,

Larry


(This post was edited by 1arryb on Nov 25, 2009, 7:46 AM)


Edit Log:
Post edited by 1arryb (User) on Nov 24, 2009, 8:27 AM
Post edited by 1arryb (User) on Nov 24, 2009, 8:31 AM
Post edited by 1arryb (User) on Nov 24, 2009, 8:37 AM
Post edited by 1arryb (User) on Nov 24, 2009, 8:38 AM
Post edited by 1arryb (User) on Nov 24, 2009, 9:48 AM
Post edited by 1arryb (User) on Nov 24, 2009, 9:49 AM
Post edited by 1arryb (User) on Nov 25, 2009, 7:46 AM
Post edited by 1arryb (User) on Nov 25, 2009, 7:46 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives