On Tue, 29 May 2001, jtv wrote:
>On Mon, May 28, 2001 at 10:25:31AM -0700, pgsql-interfaces@commandprompt.com wrote:
>>What is perplexing is why the destructor doesn't seem to be doing its job
>>when called from inside httpd, inexplicably. It is definitely reaching
>>that point in the code, but it just doesn't disconnect.
>Well, that's me stumped. The only other thing I can think of is that some
>query/command execution code forgets to clear up its result set structure
>pointer prior to replacing it with a new result set, thereby confusing the
>underlying C library with invalid pointers. Or something.
I thought that might be the case too, so I commented out all the code that
actually uses the PgDatabase *sqlDB variable, and it still happens. You
can imagine how frustrating this would be. ;)
I essentially have a block of code that creates a connection, does nothing
with it, SHOULD delete it when it hits the destructor, but either doesn't
destruct at all, or doesn't properly call CloseConnection, or something
more primitive goes wrong. At any rate, the connection, even unused, WILL
NOT GO AWAY! It's mind-boggling.
>>Guess what? It still keeps the connection after leaving its scope. Grr.
>How long-lived are these connections? I've been seeing my problems after
>leaving them idle for perhaps several seconds. Shortening their lifetimes
>happened to help in my case <shudder>.
Weird! Well, in my case, I'm just creating an open connection, and it just
hangs out indefinitely. I let it run a full day once just to check. They
hung around for a day or so before I re-started apache to clean up the
processes.
The next step in trouble-shooting this I suppose is to build the dummy
Apache module with libpq++ and see if it the same behavior is exhibited.
If not, it's got to be something deeper in the core of my module.
I'm not sure I like either outcome of that test.
Jw.
--
John Worsley at Command Prompt, Inc.
jlx@commandprompt.com by way of pgsql-interfaces@commandprompt.com