|
Home > Archive > AOL Webserver > September 2006 > nsdb dropping handles?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
nsdb dropping handles?
|
|
| John Buckman 2006-09-02, 1:11 pm |
| Has anyone ever had any problems with nsdb slowly losing database
handles, so that eventually "ns_db gethandle" never returns?
I'm working with Vlad to track down that kind of problem, that we're
assuming is in his BerkeleyDB/nsdb driver, but I thought I'd ask if
anyone's had that problem with other drivers.
If I manually "ns_db releasehandle" after every handle usage, I have
no problems (but the app is slower), it's only when I rely on the
auto-cleanup of handles when the ADP page closes that there's a problem.
-john
| |
| dhogaza@PACIFIER.COM 2006-09-02, 1:11 pm |
| > If I manually "ns_db releasehandle" after every handle usage, I have
> no problems (but the app is slower), it's only when I rely on the
> auto-cleanup of handles when the ADP page closes that there's a problem.
I've used the Oracle and PG drivers for years, and have never seen this.
Then again, OpenACS has its own db API built on top of ns_db, which
manages handle clean-up (using ns_db releasehandle). We only rely on
auto-cleanup on errors, which is why the driver semantics call for any
open transaction to be rolled back if a handle is open when a page
finishes execution.
| |
| Tom Jackson 2006-09-02, 1:11 pm |
| On Saturday 02 September 2006 09:42, John Buckman wrote:
> Has anyone ever had any problems with nsdb slowly losing database
> handles, so that eventually "ns_db gethandle" never returns?
>
Never.
> If I manually "ns_db releasehandle" after every handle usage, I have
> no problems (but the app is slower), it's only when I rely on the
> auto-cleanup of handles when the ADP page closes that there's a problem.
>
Sounds like a bug in this particular driver.
tom jackson
| |
| Dossy Shiobara 2006-09-02, 7:11 pm |
| On 2006.09.02, John Buckman <john@MAGNATUNE.COM> wrote:
> Has anyone ever had any problems with nsdb slowly losing database
> handles, so that eventually "ns_db gethandle" never returns?
>
> I'm working with Vlad to track down that kind of problem, that we're
> assuming is in his BerkeleyDB/nsdb driver, but I thought I'd ask if
> anyone's had that problem with other drivers.
Are you using ns_markfordelete to cycle interps? The nsdb handle
auto-cleanup uses the Ns_TclRegisterDeferred() mechanism, which gets
triggered via "ns_ictl cleanup" which gets called from "ns_cleanup".
Perhaps implementing "ns_db cleanup" which releases all currently held
handles ... and then calling that from "ns_cleanup" along with all the
other cleanup ... would be better.
Hold on a second ... Ns_TclDeAllocateInterp() changed significantly
between 4.0 and 4.5 ... I can't actually find where in 4.5 the
ns_cleanup gets called ... ahh, it got moved to nsd/init.tcl, using:
#
# Register the init and cleanup callbacks.
#
ns_ictl trace create {ns_ictl update}
ns_ictl trace allocate ns_init
ns_ictl trace deallocate ns_cleanup
> If I manually "ns_db releasehandle" after every handle usage, I have
> no problems (but the app is slower), it's only when I rely on the
> auto-cleanup of handles when the ADP page closes that there's a problem.
Hmm ... the app is slower if you explicitly perform "ns_db
releasehandle"? Generally, "ns_db releasehandle" should be *very* fast,
as all you're doing is pushing the handle back into the pool. If it's
"slow" then I'd look at the DB driver to see what it's actually doing
when you release a handle (it may be doing a cancel/flush).
But, yes, this makes total sense: if "ns_db releasehandle" isn't "fast"
and you do it "asynchronously" by letting it happen in your interp
cleanup phase ... then it's very possible to end up in a state where new
requests will block/timeout on getting a new handle, as all of your
available handles are still held by previous requests that still have
not cleaned up yet.
In theory, you could avoid this by ensuring that maxthreads and db
connection limit are equal. Unless, you're leaking handles in a
non-connection thread that allocates but doesn't explicitly release
handles.
-- Dossy
--
Dossy Shiobara | dossy@panoptic.com | http://dossy.org/
Panoptic Computer Network | http://panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)
|
|
|
|
|