Hi Marcus,
I think all the copyrights need to be updated.
Since I had been able to reproduce the problem on nearly every run, I
tried your fix and the crash no longer occurs. However, I now see that
in about 1 in 5 runs, the final message that used to trigger the crash
now gets printed twice. EG:
Exception: java.lang.OutOfMemoryError thrown from the
UncaughtExceptionHandler in thread "main"
[3.624s][info ][gc] GC(28) Pause Initial Mark (G1 Evacuation Pause)
39M->39M(40M) (3.621s, 3.624s) 3.173ms
[3.624s][info ][gc] GC(29) Concurrent Mark (3.624s)
[3.627s][info ][gc] GC(30) Pause Young (G1 Evacuation Pause)
39M->39M(40M) (3.624s, 3.627s) 2.299ms
[3.948s][info ][gc] GC(31) Pause Full (Allocation Failure)
39M->39M(40M) (3.627s, 3.948s) 321.141ms
[4.270s][info ][gc] GC(32) Pause Full (Allocation Failure)
39M->39M(40M) (3.948s, 4.270s) 321.400ms
[4.271s][info ][gc] GC(29) Concurrent Mark abort
[4.271s][info ][gc] GC(29) Concurrent Mark abort
The change looks OK to me, but I can't explain the above.
Tom
On 1/19/2016 8:58 AM, Marcus Larsson wrote:
Hi,
Please review the following patch to fix an issue in UL causing the VM
to crash during shutdown.
The problem is that the static LogStdoutOutput is deinitialized before
the last use of it (G1 concurrent thread tries to log very late during
VM shutdown). The solution is to make sure neither LogStdoutOutput nor
LogStderrOutput are deinitialized during the full lifetime of the VM.
To accomplish this I've changed the storage from static objects to
static pointers to heap instances that are allocated & initialized on
first use [0]. These instances are never deleted and can always be
used. Also updated LogConfiguration::finalize to disable all file
outputs before deleting & freeing them.
Webrev:
http://cr.openjdk.java.net/~mlarsson/8146009/webrev.00/
Issue:
https://bugs.openjdk.java.net/browse/JDK-8146009
Testing:
- local runs of the reproducer (500+ iterations without crashing)
- JPRT
Thanks,
Marcus
[0]: https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use