Skip to content

Potential issue after threadDeath #35

@leelamv

Description

@leelamv

Timers can send signals even after they are deleted. It isn't clear how this happen (Not a kernel expert). However, when a signal is handled and try to read JNIEnv, this can be dead thread already from the jvm perspective. When we call JVM function here at , we will essentially asking jvm to get stack trace for a dead thread.

How to prove my theory ?
a) Maintain a flag which states thread death status and update that flag when OnThreadEnd is called.
b) When signal is handled here , build an assert check to confirm if it isnt a dead thread.

To increase the possibility of this issue happen:

  • Create a JNI Thread with lot of pthread_key and also have destructors with short sleeps.
  • Attach the jni thread to jvm.

Some suggestions for fix

  • Reset the JNIEnv in OnThreadEnd callback.
  • You may also use flag and turn the invariant mentioned above into a condition .

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions