On Thu, Oct 9, 2014 at 7:18 AM, Heikki Linnakangas <hlinnakangas@vmware.com>
wrote:
> Thanks, I was able to easily reproduce this with the script.
>
I'm glad you were able to reproduce it.
> I'm not sure what to do about this. We could not unregister the callbacks,
> when the last libpq connection is closed, but there's a comment in
> destroy_ssl_system explaining why that would be bad (if libpq is later
> unloaded, the callback pointers would be left dangling). Perhaps we could
> leave the callbacks registered when the last connection is closed, and add
> a _fini() function that unregisters them when the library is unloaded. I'm
> not sure how portable that is, though.
>
> Another idea is to check if any of the locks are held, when the last libpq
> connection is closed, and leave the callbacks in place if there are.
>
I'm not informed enough to suggest a solution in this case. But I'll be
glad to stress test it again if a patch were made available.
Let me know if I could be of more help.
Cheers!
Amjith