Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Fix JNIEnv* share between start thread and receive thread #285

Merged
merged 1 commit into from
Jun 1, 2017

Conversation

yfakariya
Copy link
Contributor

This PR fixes issue #275.

This commit moves JNIEnv* variable from JAVA_MODULE_HANDLE_DATA structure to local variable.
The variable is assigned by JVM in AttachCurrentThread in both of start and receive functions,
it causes race condition of the variable, then segmentation fault is occurred in ExceptionOccurred JNI function.
So, the JNIEnv* variable should be local instead of a part of JAVA_MODULE_HANDLE_DATA.

This commit moves JNIEnv* variable from JAVA_MODULE_HANDLE_DATA structure to local variable.
The variable is assigned by JVM in AttachCurrentThread in both of start and receive functions,
it causes race condition of the variable, then segmentation fault is occurred in ExceptionOccurred JNI function.
So, the JNIEnv* variable should be local instead of a part of JAVA_MODULE_HANDLE_DATA.
@az-iot-builder-01 az-iot-builder-01 merged commit f00b9c3 into Azure:master Jun 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants