
1arryb
User
Nov 24, 2009, 8:14 AM
Post #2 of 2
(6786 views)
|
Re: [vmraj] DB Connections resetting
[In reply to]
|
Can't Post
|
|
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)
|