{"id":5312,"date":"2014-03-30T20:38:54","date_gmt":"2014-03-30T20:38:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/dlopen-malloc-deadlock-collection-of-common-programming-errors\/"},"modified":"2014-03-30T20:38:54","modified_gmt":"2014-03-30T20:38:54","slug":"dlopen-malloc-deadlock-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/dlopen-malloc-deadlock-collection-of-common-programming-errors\/","title":{"rendered":"dlopen malloc deadlock-Collection of common programming errors"},"content":{"rendered":"<p>We have some unit tests that often deadlock. Closer inspection with GDB reveals the following:<\/p>\n<p><strong>Thread 1:<\/strong><\/p>\n<pre>\n(gdb) bt\n#0  0x00110424 in __kernel_vsyscall ()\n#1  0x00c681a3 in __lll_lock_wait_private () from \/lib\/libc.so.6\n#2  0x00bf09fb in _L_lock_515 () from \/lib\/libc.so.6\n#3  0x00bf068c in tr_mallochook () from \/lib\/libc.so.6\n#4  0x00bece22 in calloc () from \/lib\/libc.so.6\n#5  0x00b5ed93 in _dl_new_object () from \/lib\/ld-linux.so.2\n#6  0x00b5b287 in _dl_map_object_from_fd () from \/lib\/ld-linux.so.2\n#7  0x00b5c521 in _dl_map_object () from \/lib\/ld-linux.so.2\n#8  0x00b66f43 in dl_open_worker () from \/lib\/ld-linux.so.2\n#9  0x00b629a6 in _dl_catch_error () from \/lib\/ld-linux.so.2\n#10 0x00b66a06 in _dl_open () from \/lib\/ld-linux.so.2\n#11 0x00d38c3b in dlopen_doit () from \/lib\/libdl.so.2\n#12 0x00b629a6 in _dl_catch_error () from \/lib\/ld-linux.so.2\n#13 0x00d3903c in _dlerror_run () from \/lib\/libdl.so.2\n#14 0x00d38b71 in dlopen@@GLIBC_2.1 () from \/lib\/libdl.so.2\n...\n<\/pre>\n<p><strong>Thread 2:<\/strong><\/p>\n<pre>\n#0  0x00110424 in __kernel_vsyscall ()\n#1  0x00d4c059 in __lll_lock_wait () from \/lib\/libpthread.so.0\n#2  0x00d4740e in _L_lock_752 () from \/lib\/libpthread.so.0\n#3  0x00d4731a in pthread_mutex_lock () from \/lib\/libpthread.so.0\n#4  0x00c95dd2 in _dl_addr () from \/lib\/libc.so.6\n#5  0x00bf0425 in tr_where () from \/lib\/libc.so.6\n#6  0x00bf06bd in tr_mallochook () from \/lib\/libc.so.6\n#7  0x00bed01b in malloc () from \/lib\/libc.so.6\n....\n<\/pre>\n<p>I did a lot of searches on the Internet but I can&#8217;t really find out whether I am doing something wrong, or whether I have found a bug in the libraries.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have some unit tests that often deadlock. Closer inspection with GDB reveals the following: Thread 1: (gdb) bt #0 0x00110424 in __kernel_vsyscall () #1 0x00c681a3 in __lll_lock_wait_private () from \/lib\/libc.so.6 #2 0x00bf09fb in _L_lock_515 () from \/lib\/libc.so.6 #3 0x00bf068c in tr_mallochook () from \/lib\/libc.so.6 #4 0x00bece22 in calloc () from \/lib\/libc.so.6 #5 0x00b5ed93 in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5312","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5312"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5312\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}