Forum OpenACS Q&A: DB handle error met in filter
is error like this, even when there is only one session open:
[05/Nov/2001:16:09:25][12008.7173][-conn0-] Error: dbinit: db handle
limit exceeded: thread already owns 1 handle from pool 'log'
But I only add one trace filter, and perfomed the "ns_db
releasehandle $db" operation. There is no such error when I didn't
add this filter.
What's the possible reason for it?
Thanks a lot!
I think that the main page/function you are calling the filtering code from already has a handle to the log pool and then the filter function tries to aquire one too.
One solution is to aquire the db handle in the main function/page and pass it into your trace filtering function as an argument.
I can see from log that the ad-referer-filter worked well and inside it there is release handle. But after it when my own filter run, there is error occured. I am wondering where can the thread get its db handle.
If you go to the main tcl directory for your OpenACS site. (probably /web/your_server/tcl)
From that directory do a grep on ns_register_proc (If you want to get a more in depth explanation of the function you can check out this url: Sites That Are Really Programs or the AOLServer documentation). In essence it registers a tcl procedure to handle a certain url. Within the system there are various procedures that handle various things. Eg. on my system ad_server_html_page is registered to html pages.
It's possible that, that registered function or any number of other registered functions grabs a "log" pool db handle and doesn't release it.
Now just as an aside.... if you just want debug logging you can use the ns_log functionality to print stuff into you server log.
look at tcl/ad-html.tcl for these procedures.