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/15 11:53:40 UTC

[GitHub] [incubator-brpc] co0l1ce opened a new pull request, #2049: fix rpc maybe error: " libbrpc.so: undefined symbol: pthread_mutex_lo…

co0l1ce opened a new pull request, #2049:
URL: https://github.com/apache/incubator-brpc/pull/2049

   …ck "
   
   ### What problem does this PR solve?
   
   Issue Number: 1086
   https://github.com/apache/incubator-brpc/issues/1086
   
   
   
   Problem Summary:
   my Binary link libbrpc.so; then binary start will report "libbrpc.so: undefined symbol: pthread_mutex_lock"
   
   ### What is changed and the side effects?
   no effects
   
   Changed:
   reference glibc implement of dlsym (https://codebrowser.dev/glibc/glibc/dlfcn/dlsym.c.html#78)
   
   Side effects:
   - Performance effects(性能影响):
   -  no effects
   
   - Breaking backward compatibility(向后兼容性): 
   -  compatibility
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
wwbmmm merged PR #2049:
URL: https://github.com/apache/incubator-brpc/pull/2049


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