hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] toddlipcon commented on a change in pull request #595: HDFS-14304: High lock contention on hdfsHashMutex in libhdfs
Date Tue, 19 Mar 2019 19:14:21 GMT
toddlipcon commented on a change in pull request #595: HDFS-14304: High lock contention on
hdfsHashMutex in libhdfs
URL: https://github.com/apache/hadoop/pull/595#discussion_r267053653
 
 

 ##########
 File path: hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c
 ##########
 @@ -534,6 +545,21 @@ JNIEnv* getJNIEnv(void)
 
     state->env = getGlobalJNIEnv();
     mutexUnlock(&jvmMutex);
+
+    if (!jclassesInitialized) {
+      mutexLock(&jclassInitMutex);
+      if (!jclassesInitialized) {
 
 Review comment:
   this double-checked locking idiom isn't safe unless you insert a memory barrier before
the store to jclassesInitialized. (it has to be a store with "release" semantics)
   
   Otherwise, the compiler (and/or CPU) is free to decide to reorder the store to 'jclassesInitialized
= 1' up earlier within the critical section.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message