agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] postmaster hangs if JVM does not close nicely in windows
Date: Fri, 4 Nov 2011 05:40:42 -0700 (PDT)
Message-ID: <1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com> (raw)
I came across an interesting problem the other day using pl/Java. ?When I deployed my application in Linux everything worked just fine but when I ran it under Windows, every client connection would leave a postmaster process running, and shutting down the PostgreSQL 9.1 service would fail.
I finally traced it back to the fact that the services I was running in the JVM were not shutting down when the client disconnected (the finalize() method was not being called) and so the file resources they'd locked were not being released and the JVM process would not stop. ?This hung the postmaster process for each client connection (along with ~80MB of memory) and became a problem pretty quickly.
I ended up creating a patch for pl/Java that allowed me to get a Java event right before the JVM is destroyed (the onDestroyJavaVM event) which I could use to clean up and shutdown the services running, before pl/Java tried to stop the JVM. ?This may be useful to anyone else who is running complex Java services inside their database, so I have attached my patch to the issue Tracker here:
http://pgfoundry.org/tracker/index.php?func=detail&aid=1011111&group_id=1000038&atid=336
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20111104/b1ea3aac/attachment.html;
view thread (2+ messages) latest in thread
Message-ID: <1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com>
Permalink: ../1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com/
Also on: postgresql.org/message-id/1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] postmaster hangs if JVM does not close nicely in windows
In-Reply-To: <1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox