You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/12/16 05:37:52 UTC

[GitHub] [incubator-brpc] wwbmmm commented on a diff in pull request #2049: fix rpc maybe error: " libbrpc.so: undefined symbol: pthread_mutex_lo…

wwbmmm commented on code in PR #2049:
URL: https://github.com/apache/incubator-brpc/pull/2049#discussion_r1050386205


##########
src/bthread/mutex.cpp:
##########
@@ -404,13 +404,29 @@ static pthread_once_t init_sys_mutex_lock_once = PTHREAD_ONCE_INIT;
 //   #23 0x00000000006fbb9a in tc_malloc ()
 // Call _dl_sym which is a private function in glibc to workaround the malloc
 // causing deadlock temporarily. This fix is hardly portable.
+
+/* refer dlsym implement
+ * https://codebrowser.dev/glibc/glibc/dlfcn/dlsym.c.html#78
+ * void *
+ * ___dlsym (void *handle, const char *name)
+ * {
+ *   return __dlsym (handle, name, RETURN_ADDRESS (0));
+ *   }
+ *
+ */
+
+#define RETURN_ADDRESS(nr) \
+    __builtin_extract_return_addr (__builtin_return_address (nr) )
+
 static void init_sys_mutex_lock() {
 #if defined(OS_LINUX)
     // TODO: may need dlvsym when GLIBC has multiple versions of a same symbol.
     // http://blog.fesnel.com/blog/2009/08/25/preloading-with-multiple-symbol-versions
     if (_dl_sym) {
-        sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", (void*)init_sys_mutex_lock);
-        sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", (void*)init_sys_mutex_lock);
+        // sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", (void*)init_sys_mutex_lock);
+        // sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", (void*)init_sys_mutex_lock);

Review Comment:
   Remove directly, don't comment



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org