Forum OpenACS Q&A: DB handle error met in filter

Collapse
Posted by Ke Wang on
I added some trace filter to my openacs website. But sometimes there
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!

Collapse
Posted by Robert Ezman on
I'm not exactly sure by what you mean by trace filter but I've seen this error in cases where I've done something dumb like adding the ns_db gethandle call in a loop. Or in a long page tried to aquire the handle twice.

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.

Collapse
Posted by Ke Wang on
But it's strange when I only access .html files without any db operation, I still got such error.

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.

Collapse
Posted by Robert Ezman on
I have an old version of OpenACS running and am also not sure which one you're running so I'll tell you what I would do if I had the same problem.

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.
Collapse
Posted by David Walker on
html files do use db operations

look at tcl/ad-html.tcl for these procedures.