HDFS-12494. libhdfs SIGSEGV in setTLSExceptionStrings. Contributed by John Zhuge.
(cherry picked from commit 2856eb207b
)
This commit is contained in:
parent
ae9f82c603
commit
7dfe97d84f
|
@ -522,19 +522,21 @@ JNIEnv* getJNIEnv(void)
|
||||||
/* Create a ThreadLocalState for this thread */
|
/* Create a ThreadLocalState for this thread */
|
||||||
state = threadLocalStorageCreate();
|
state = threadLocalStorageCreate();
|
||||||
if (!state) {
|
if (!state) {
|
||||||
|
mutexUnlock(&jvmMutex);
|
||||||
fprintf(stderr, "getJNIEnv: Unable to create ThreadLocalState\n");
|
fprintf(stderr, "getJNIEnv: Unable to create ThreadLocalState\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (threadLocalStorageSet(state)) {
|
||||||
|
mutexUnlock(&jvmMutex);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
THREAD_LOCAL_STORAGE_SET_QUICK(state);
|
||||||
|
|
||||||
state->env = getGlobalJNIEnv();
|
state->env = getGlobalJNIEnv();
|
||||||
mutexUnlock(&jvmMutex);
|
mutexUnlock(&jvmMutex);
|
||||||
if (!state->env) {
|
if (!state->env) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (threadLocalStorageSet(state)) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
THREAD_LOCAL_STORAGE_SET_QUICK(state);
|
|
||||||
|
|
||||||
return state->env;
|
return state->env;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
Loading…
Reference in New Issue