Xopendisplay() and popen getting locked

Posted on

I am using fp = popen("whoami", "r") to get the current logged in user and XOpenDisplay(pszdname) API to open the display. Both the calls are getting locked in internal library function calls as can be seen from the below thread trace. Please let me know if anyone has faced similar issue and the fix for the same.
glibc - 2.17
Thread Trace :

Thread 3 (Thread 0x7fd89e40c700 (LWP 13123)):

0 0x00007fd89ff2deec in __lll_lock_wait_private () from /lib64/libc.so.6

1 0x00007fd89feaafed in _L_lock_14442 () from /lib64/libc.so.6

2 0x00007fd89fea7e6c in __malloc_fork_lock_parent () from /lib64/libc.so.6

3 0x00007fd89fee725b in fork () from /lib64/libc.so.6

4 0x00007fd89fe94bbc in _IO_proc_open@@GLIBC_2.2.5 () from /lib64/libc.so.6

5 0x00007fd89fe94e4c in popen@@GLIBC_2.2.5 () from /lib64/libc.so.6

6 0x0000000000409f4f in GetCurrUser ()

7 0x0000000000406c1f in AllocateOfflineTimes ()

8 0x0000000000406b82 in CheckIdleActivity ()

9 0x00000000004073d8 in MonitorOffline ()

10 0x00007fd8a1432e25 in start_thread () from /lib64/libpthread.so.0

11 0x00007fd89ff2034d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fd89dc0b700 (LWP 13124)):

0 0x00007fd8a1436945 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0

1 0x000000000040544c in XmlwriterTree ()

2 0x000000000040741f in XMLDumper ()

3 0x00007fd8a1432e25 in start_thread () from /lib64/libpthread.so.0

4 0x00007fd89ff2034d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fd8a184b740 (LWP 13122)):

0 0x00007fd89ff2deec in __lll_lock_wait_private () from /lib64/libc.so.6

1 0x00007fd89feab05d in _L_lock_14730 () from /lib64/libc.so.6

2 0x00007fd89fea8163 in malloc () from /lib64/libc.so.6

3 0x00007fd8a16543f8 in _dl_map_object_deps () from /lib64/ld-linux-x86-64.so.2

4 0x00007fd8a165a9fb in dl_open_worker () from /lib64/ld-linux-x86-64.so.2

5 0x00007fd8a1656314 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2

6 0x00007fd8a165a30b in _dl_open () from /lib64/ld-linux-x86-64.so.2

7 0x00007fd89ff5ba72 in do_dlopen () from /lib64/libc.so.6

8 0x00007fd8a1656314 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2

---Type to continue, or q to quit---

9 0x00007fd89ff5bb32 in __libc_dlopen_mode () from /lib64/libc.so.6

10 0x00007fd89ff342a5 in init () from /lib64/libc.so.6

11 0x00007fd8a1437e20 in pthread_once () from /lib64/libpthread.so.0

12 0x00007fd89ff343bc in backtrace () from /lib64/libc.so.6

13 0x0000000000409b2a in segfault_handler ()

14

15 0x00007fd89fea35aa in malloc_consolidate () from /lib64/libc.so.6

16 0x00007fd89fea53a5 in _int_malloc () from /lib64/libc.so.6

17 0x00007fd89fea8b64 in calloc () from /lib64/libc.so.6

18 0x00007fd89fc0bcec in xcb_connect_to_fd () from /lib64/libxcb.so.1

19 0x00007fd89fc0fa6a in xcb_connect_to_display_with_auth_info () from /lib64/libxcb.so.1

20 0x00007fd8a112edda in _XConnectXCB () from /lib64/libX11.so.6

21 0x00007fd8a111fc92 in XOpenDisplay () from /lib64/libX11.so.6

22 0x0000000000407522 in WDOpenDisplay ()

23 0x000000000040b530 in SapienceDumper ()

24 0x000000000040386d in ProcessStart ()

25 0x0000000000403ae8 in ExecuteCliReq ()

26 0x0000000000403f22 in ccliProcessCLIRequest ()

27 0x0000000000403171 in main ()

Responses