I have had another hang.
Thread 1 (Thread 0x78d1e73a6040 (LWP 157369) "redacted"):
#0 0x000078d1e9298d61 in __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x31e47e8) at ./nptl/futex-internal.c:57
#1 __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x31e47e8) at ./nptl/futex-internal.c:87
#2 __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x31e47e8, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3 0x000078d1e929b7dd in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x31e4798, cond=0x31e47c0) at ./nptl/pthread_cond_wait.c:503
#4 ___pthread_cond_wait (cond=0x31e47c0, mutex=0x31e4798) at ./nptl/pthread_cond_wait.c:627
#5 0x000078d1e99ccf10 in ?? () from /redacted Libs/XojoGUIFramework64.so
#6 0x000078d1e99caf6c in ?? () from /redacted Libs/XojoGUIFramework64.so
#7 0x000078d1e99c911a in ?? () from /redacted Libs/XojoGUIFramework64.so
#8 0x000078d1e99be7bf in ?? () from /redacted Libs/XojoGUIFramework64.so
#9 0x00000000007d99c8 in DesktopApplication._CallFunctionWithExceptionHandling%%o<DesktopApplication>p ()
#10 0x000078d1e99be6cb in ?? () from /redacted Libs/XojoGUIFramework64.so
#11 0x000078d1e99be8b2 in ?? () from /redacted Libs/XojoGUIFramework64.so
#12 0x000078d1e99bd406 in RuntimeRun () from /redacted Libs/XojoGUIFramework64.so
#13 0x0000000000849063 in REALbasic._RuntimeRun ()
#14 0x0000000001b3e96c in _Main ()
#15 0x0000000001b3e1c3 in main ()
I put a watch on the condition and then tried to release it with a signal to see it it might continue somewhere else or at least crash, however, it just goes right back to waiting.
(gdb) print ___pthread_cond_signal(0x31e47c0)
All the other threads appear to be working correctly. They wake after the right amount of time, do their thing and go back to sleep. Looking at the condition and pthread_cond_wait source (very convoluted) it would appear there are 2 waiters?
cond.__data = {
__wseq = {
__value64 = 680560182,
__value32 = {
__low = 680560182,
__high = 0
}
},
__g1_start = {
__value64 = 680560178,
__value32 = {
__low = 680560178,
__high = 0
}
},
__g_refs = {
2,
0
},
__g_size = {
0,
0
},
__g1_orig_size = 4,
__wrefs = 10,
__g_signals = {
0,
0
}
}
I can see that “RuntimeBackgroundTask” is being called from other threads so it should be yielding time back to the main thread, however, nothing in the main thread is being called (no event handlers, gtk_main_iteration_do, etc.)
If I make an app that does some blocking operation on another thread (synchronous serial), it seems to still at least be in some sort of event loop (gtk_main_iteration_do):
#0 0x00007ffff5098d61 in __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x7107dc) at ./nptl/futex-internal.c:57
#1 __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x7107dc) at ./nptl/futex-internal.c:87
#2 __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7107dc, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at ./nptl/futex-internal.c:139
#3 0x00007ffff509b7dd in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x710788, cond=0x7107b0) at ./nptl/pthread_cond_wait.c:503
#4 ___pthread_cond_wait (cond=0x7107b0, mutex=0x710788) at ./nptl/pthread_cond_wait.c:627
#5 0x00007ffff57ccf10 in ?? () from /redacted Libs/XojoGUIFramework64.so
#6 0x00007ffff57caf6c in ?? () from /redacted Libs/XojoGUIFramework64.so
#7 0x00007ffff57c911a in ?? () from /redacted Libs/XojoGUIFramework64.so
#8 0x00007ffff565e3f4 in ?? () from /redacted Libs/XojoGUIFramework64.so
#9 0x00007ffff4545522 in g_timeout_dispatch (source=source@entry=0x741b50, callback=<optimized out>, user_data=<optimized out>) at ../../../glib/gmain.c:4989
#10 0x00007ffff454448e in g_main_dispatch (context=0x72a1e0) at ../../../glib/gmain.c:3344
#11 0x00007ffff45a3717 in g_main_context_dispatch_unlocked (context=0x72a1e0) at ../../../glib/gmain.c:4152
#12 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x72a1e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4217
#13 0x00007ffff4543a53 in g_main_context_iteration (context=0x72a1e0, context@entry=0x0, may_block=may_block@entry=1) at ../../../glib/gmain.c:4282
#14 0x00007ffff49fec6d in gtk_main_iteration_do (blocking=1) at ../../../gtk/gtkmain.c:1457
#15 0x00007ffff57be78a in ?? () from /redacted Libs/XojoGUIFramework64.so
#16 0x0000000000618b58 in DesktopApplication._CallFunctionWithExceptionHandling%%o<DesktopApplication>p ()
#17 0x00007ffff57be6cb in ?? () from /redacted Libs/XojoGUIFramework64.so
#18 0x00007ffff57be8b2 in ?? () from /redacted Libs/XojoGUIFramework64.so
#19 0x00007ffff57bd406 in RuntimeRun () from /redacted Libs/XojoGUIFramework64.so
#20 0x0000000000646853 in REALbasic._RuntimeRun ()
#21 0x00000000006e8a4a in _Main ()
#22 0x00000000006e8213 in main ()
Not sure where to go with this, I feel like the function at “0x000078d1e99be7bf” would give some clues, however, I can’t seem to place it exactly in the disassembly but it seems to be stuck at
sub_3ca4cb(0x1, rsi, rdx, 0x0);
in
int sub_3be747() {
if (*(int8_t *)byte_28c8048 == 0x0) {
if (__cxa_guard_acquire(byte_28c8048) != 0x0) {
*qword_28c8040 = g_main_context_new();
__cxa_guard_release(byte_28c8048);
}
}
if (*(int8_t *)byte_28c8058 == 0x0) {
if (__cxa_guard_acquire(byte_28c8058) != 0x0) {
rsi = 0x1;
*qword_28c8050 = g_main_loop_new(*qword_28c8040, rsi);
__cxa_guard_release(byte_28c8058);
}
}
sub_41ed5c();
COND = sub_25e6fb() != 0x0;
rax = *(int8_t *)byte_28be564 & 0xff;
if (COND) {
rax = 0x0;
}
gtk_main_iteration_do(rax & 0xff);
if (*qword_28c8038 != 0x0) {
rdi = *qword_28c8038;
(*(*rdi + 0x1b8))(rdi);
}
sub_342441();
RunFireSerial();
sub_3e268e(0x0);
sub_25e422(0x1);
sub_3ca4cb(0x1, rsi, rdx, 0x0);
rax = 0x28c0e40;
if (*(int8_t *)rax != 0x0) {
rax = 0x28c0e58;
if (*rax == 0x0) {
rax = 0x28c0e58;
if ((*(int8_t *)byte_28c8030 & 0x1) == 0x0) {
rax = *0x28c0e28;
if (rax != 0x0) {
rax = *0x28c0e28;
if (*(int8_t *)(rax + 0x59) != 0x0) {
rax = sub_25d5a1(0x0, 0x1);
}
}
}
}
}
return rax;
}