Garbage collection doesn't complete in an isolate

Project:JNode Core
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

In trying to fix some stream handling problems in isolates, I've run into a show stopper with the garbage collector. Basically, if the garbage collector runs in an isolate started with "console -n -i", it doesn't complete. This happens both when the GC is run when "js" exits (in response to a ^D) or when you run it explicitly using the "gc" command.

The easy way to reproduce the problem is to start a new console with "console -n -i", switch to the new console, and then run "gc". You see the Unsafe.debug messages for four GC phases, then nothing.

If you do the same steps, but leave off the "-i" option, the GC completes normally.

#1

Status:active» closed

I'm aware of this issues with the difference that according to my experience the GC completes normally but the isolated console blocks. This means that you might be able to switch back to the first console or if you start the gc in the first console jnode will be usable after the gc but the isolated console will not. This is a very peculiar interference between the gc and the isolates that we should track down.

#2

I've done a bit of digging, and it looks like the GC is running to completion. The problem seems to be either in the finalization thread or in the resumption of normal thread scheduling. I'm continuing to look ...

#3

Latest news: the GC is indeed running to completion, and control is returning to GcCommand.execute(..). But the execute method is getting an NPE when it tries to print out GC statistics to it's "out" stream.

The "out" stream is non-null ConsolePrintStream, but calling "out.println("hi mom")" at that point is causing an NPE. Something inside the "out" stream object must have been corrupted by / during garbage collection. (I can show you the debug code that I inserted and the resulting output ... but it seems pretty clear-cut to me.)

I wonder if the GC needs to be told that an Isolate defines more GC roots? Or maybe it needs to be told something about isolated statics?

#4

You are right. We only checked one Isolated Statics table instead of all. Should be fixed in trunk. Thanks for the hint.

#5

I've commited a fix for this, please test it. Thanks crawley and peda for the insightful comments.

#6

The fix works for me. Thanks

#7