Author Adel
Recipients Adel, zyasoft
Date 2014-09-08.07:59:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I fixed the issue by clear the reference for the "shutdownHook" instance variable in the "cleanup" method that exist in the static inner class PySystemStateCloser. It is only the last line in the cleanup method, As the following:-

private synchronized void cleanup() {
	if (isCleanup) {
	this.isCleanup = true;

	if (shutdownHook != null) {
		try {
		} catch (IllegalStateException e) {

	for (Callable callable : this.resourceClosers) {
		try {;
		} catch (Exception e) {
	// The below line is the only change to fix the issue.	
+	shutdownHook = null;

Clear the strong reference which is "shutdownHook" instance variable inside "PySystemStateCloser" class, will remove all "ShutdownCloser" objects from the memory when call GC, since all objects of type "ShutdownCloser" is added to a static concurrent map called "syscloser" in the class "PySystemState" as a weak reference and this weak reference will be removed when call GC if the object doesn't has any strong reference to it or doesn't contains any strong reference, and the "shutdownHook" instance variable is a strong reference inside "ShutdownCloser" objects. So after remove its reference on the cleanup method, the GC will remove the objects from the static concurrent map "syscloser" and then from the memory.

After that, Is it possible to fix it inside 2.5 version?
Date User Action Args
2014-09-08 07:59:47Adelsetmessageid: <>
2014-09-08 07:59:47Adelsetrecipients: + Adel, zyasoft
2014-09-08 07:59:47Adellinkissue2199 messages
2014-09-08 07:59:47Adelcreate