rakslice / macemu

Basilisk II and SheepShaver Macintosh emulators
0 stars 0 forks source link

linux: hang on shutdown #60

Closed rakslice closed 3 years ago

rakslice commented 3 years ago

Testing kanjitalk755 in debian 9 x86_64 in a VirtualBox 6 VM, I ran into the following hang quite often:

After shutting down from the Finder menu, SheepShaver hangs.

Thread 0 is has requested the rendering to shut down and has joined it waiting for it to exit. Thread 7 (the rendering thread) is in ADBMouseMoved waiting for mouse_lock.

It seems to wait in this state indefinitely.

If I manually B2_unlock_mutex(mouse_lock) and continue, it exits right away without error.

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fe46b11e6dd in pthread_join (threadid=140618661218048, thread_return=thread_return@entry=0x0) at pthread_join.c:90
90      pthread_join.c: No such file or directory.
(gdb) bt
#0  0x00007fe46b11e6dd in pthread_join (threadid=140618661218048, thread_return=thread_return@entry=0x0) at pthread_join.c:90
#1  0x00007fe46aea580b in SDL_SYS_WaitThread (thread=thread@entry=0x79b860b0)
    at /home/rakslice/src/SDL2-2.0.12/src/thread/pthread/SDL_systhread.c:238
#2  0x00007fe46ae07636 in SDL_WaitThread_REAL (thread=0x79b860b0, status=0x0)
    at /home/rakslice/src/SDL2-2.0.12/src/thread/SDL_thread.c:477
#3  0x000000007808f585 in SDL_monitor_desc::video_close (this=<optimized out>) at ../SDL/video_sdl2.cpp:1589
#4  0x000000007808f5cd in VideoExit () at ../SDL/video_sdl2.cpp:1608
#5  0x000000007806419c in ExitAll () at ../main.cpp:312
#6  0x0000000078064498 in Quit () at main_unix.cpp:1167
#7  0x0000000078064659 in QuitEmulator () at main_unix.cpp:1342
#8  0x000000001091dbd5 in ?? ()
#9  0x0000000000804000 in ?? ()
#10 0x0000000000400000 in ?? ()
#11 0x0000000000000000 in ?? ()
(gdb) info thread
  Id   Target Id         Frame
* 1    Thread 0x7fe46b526500 (LWP 20075) "SheepShaver" 0x00007fe46b11e6dd in pthread_join (threadid=140618661218048,
    thread_return=thread_return@entry=0x0) at pthread_join.c:90
  2    Thread 0x7fe45b66f700 (LWP 20077) "llvmpipe-0" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7fe45ae6e700 (LWP 20078) "llvmpipe-1" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  4    Thread 0x7fe45a66d700 (LWP 20079) "llvmpipe-2" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  5    Thread 0x7fe459e6c700 (LWP 20080) "llvmpipe-3" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  6    Thread 0x7fe4577b2700 (LWP 20082) "SDLHotplugALSA" 0x00007fe46b1267fd in nanosleep ()
    at ../sysdeps/unix/syscall-template.S:84
  7    Thread 0x7fe45559c700 (LWP 20086) "Redraw Thread" __lll_lock_wait ()
    at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
(gdb) thread 7
[Switching to thread 7 (Thread 0x7fe45559c700 (LWP 20086))]
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
135     ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007fe46b11fbb5 in __GI___pthread_mutex_lock (mutex=0x0) at ../nptl/pthread_mutex_lock.c:80
#2  0x0000000078064835 in B2_lock_mutex (mutex=<optimized out>) at main_unix.cpp:1569
#3  0x0000000078072286 in ADBMouseMoved (x=358, y=124) at ../adb.cpp:241
#4  0x000000007808df0b in driver_base::mouse_moved (this=<optimized out>, y=<optimized out>, x=<optimized out>)
    at ../SDL/video_sdl2.cpp:642
#5  handle_events () at ../SDL/video_sdl2.cpp:2319
#6  0x000000007808f455 in do_video_refresh () at ../SDL/video_sdl2.cpp:2775
#7  redraw_func (arg=arg@entry=0x0) at ../SDL/video_sdl2.cpp:2825
#8  0x00007fe46ae071ac in SDL_RunThread (data=0x79b73b60) at /home/rakslice/src/SDL2-2.0.12/src/thread/SDL_thread.c:289
#9  0x00007fe46aea5639 in RunThread (data=<optimized out>)
    at /home/rakslice/src/SDL2-2.0.12/src/thread/pthread/SDL_systhread.c:79
#10 0x00007fe46b11d4a4 in start_thread (arg=0x7fe45559c700) at pthread_create.c:456
#11 0x00007fe46781dd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
(gdb) up
#1  0x00007fe46b11fbb5 in __GI___pthread_mutex_lock (mutex=0x0) at ../nptl/pthread_mutex_lock.c:80
80      ../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb)
#2  0x0000000078064835 in B2_lock_mutex (mutex=<optimized out>) at main_unix.cpp:1569
1569            pthread_mutex_lock(&mutex->m);
(gdb)
#3  0x0000000078072286 in ADBMouseMoved (x=358, y=124) at ../adb.cpp:241
241             B2_lock_mutex(mouse_lock);
(gdb) list
236      *  Mouse was moved (x/y are absolute or relative, depending on ADBSetRelMouseMode())
237      */
238
239     void ADBMouseMoved(int x, int y)
240     {
241             B2_lock_mutex(mouse_lock);
242             if (relative_mouse) {
243                     mouse_x += x; mouse_y += y;
244             } else {
245                     mouse_x = x; mouse_y = y;
(gdb)