Xopendisplay() and popen getting locked
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---