[Pljava-dev] postmaster hangs if JVM does not close nicely in windows

From: nathanegge at yahoo(dot)com (Nathan Egge)
To:
Subject: [Pljava-dev] postmaster hangs if JVM does not close nicely in windows
Date: 2011-11-04 12:40:42
Message-ID: 1320410442.74423.YahooMailNeo@web35706.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

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>

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Johann 'Myrkraverk' Oskarsson 2011-11-04 21:46:46 [Pljava-dev] postmaster hangs if JVM does not close nicely in windows
Previous Message Daniel Winterstein 2011-11-03 18:08:01 [Pljava-dev] Developing a db-clustering system using PL/Java