corda/src/avian
Joel Dice 4a83b671b3 fix crash on exit due to order of operations bug in ~RawMonitorResource
The problem (which we've only been able to reproduce consistently with
the openjdk-src process=interpret build on Linux virtual machines) was
a race condition during VM shutdown.  Thread "A" would exit, see there
were other threads still running and thus enter ZombieState, which
involves acquiring and releasing a lock using RawMonitorResource.
Then the last thread (thread "B") would exit, wait for thread "A" to
release the lock, then shut down the VM, freeing all memory.  However,
thread "A" writes to its Thread object one last time after releasing
the lock (in ~Resource, the destructor of the superclass of
RawMonitorResource, which sets Thread::resource).  If thread "B" frees
that Thread before ~Resource runs, we end up writing to freed memory.

Thus, we need to update Thread::resource before releasing the lock.
Apparently C++ destructors run in order from most derived to least
derived, which is not what we want here.  My solution to split
Resource into two classes, one that has no destructor and another that
extends it (called AutoResource) which does hafe a destructor.  Now
all the classes which used to extend Resource extend AutoResource,
except for RawMonitorResource, which extends Resource directly so it
can control the order of operations.
2014-05-10 23:25:59 -06:00
..
alloc-vector.h update copyright years 2014-04-23 15:33:41 -06:00
append.h update copyright years 2014-04-23 15:33:41 -06:00
arch.h remove powerpc support 2014-04-29 13:26:40 -06:00
arm.h update copyright years 2014-04-23 15:33:41 -06:00
bootimage.h update copyright years 2014-04-23 15:33:41 -06:00
classpath-common.h Merge pull request #245 from dicej/jdk8 2014-04-24 18:50:38 -06:00
common.h remove powerpc support 2014-04-29 13:26:40 -06:00
constants.h Merge pull request #245 from dicej/jdk8 2014-04-24 18:50:38 -06:00
embed.h update copyright years 2014-04-23 15:33:41 -06:00
environment.h remove powerpc support 2014-04-29 13:26:40 -06:00
finder.h update copyright years 2014-04-23 15:33:41 -06:00
heapwalk.h update copyright years 2014-04-23 15:33:41 -06:00
java-common.h update copyright years 2014-04-23 15:33:41 -06:00
jnienv.h update copyright years 2014-04-23 15:33:41 -06:00
lzma-util.h update copyright years 2014-04-23 15:33:41 -06:00
lzma.h update copyright years 2014-04-23 15:33:41 -06:00
machine.h fix crash on exit due to order of operations bug in ~RawMonitorResource 2014-05-10 23:25:59 -06:00
process.h update copyright years 2014-04-23 15:33:41 -06:00
processor.h update copyright years 2014-04-23 15:33:41 -06:00
target-fields.h update copyright years 2014-04-23 15:33:41 -06:00
target.h update copyright years 2014-04-23 15:33:41 -06:00
types.h update copyright years 2014-04-23 15:33:41 -06:00
util.h update copyright years 2014-04-23 15:33:41 -06:00
x86.h update copyright years 2014-04-23 15:33:41 -06:00
zlib-custom.h update copyright years 2014-04-23 15:33:41 -06:00
zone.h update copyright years 2014-04-23 15:33:41 -06:00