mono / mono

Mono open source ECMA CLI, C# and .NET implementation.
https://www.mono-project.com
Other
11.11k stars 3.82k forks source link

Mono crashes after resuming from standby (keepass, linux, pthread_kill) #21714

Open t00 opened 1 year ago

t00 commented 1 year ago

Steps to Reproduce

  1. Leave keepass running for possibly a long time, with sleep - resume cycles inbetween, minimized
  2. Power on
  3. Restore minimized keepass window

Current Behavior

keepass window disappears, core dump is created

Expected Behavior

no issues

On which platforms did you notice this

[ ] macOS [X] Linux [ ] Windows

Version Used:

> mono --version
Mono JIT compiler version 6.12.0 (makepkg/d9a6e8710b3 Thu Aug 31 10:53:20 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          supported, not enabled.
    Suspend:       hybrid
    GC:            sgen (concurrent by default)
> keepass --version
KeePass 2.54
Copyright © 2003-2023 Dominik Reichl
> gnome-shell --version
GNOME Shell 44.5

Stacktrace

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fcece37d8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fcece32d668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fcece3154b8 in __GI_abort () at abort.c:79
#4  0x000055f12da21190 in altstack_handle_and_restore (ctx=0x55f12f774740, obj=0x0, flags=<optimized out>) at /usr/src/debug/mono/mono/mono/mini/exceptions-amd64.c:881
#5  0x00007fcece4ea496 in x86_64_fallback_frame_state (context=0x7ffed864a730, fs=0x7ffed864a820) at ./md-unwind-support.h:63
#6  uw_frame_state_for (context=context@entry=0x7ffed864a730, fs=fs@entry=0x7ffed864a820) at /usr/src/debug/gcc/gcc/libgcc/unwind-dw2.c:1013
#7  0x00007fcece4ec354 in _Unwind_Backtrace (trace=0x7fcece40ccc0 <backtrace_helper>, trace_argument=0x7ffed864a960) at /usr/src/debug/gcc/gcc/libgcc/unwind.inc:303
#8  0x00007fcece40cdc3 in __GI___backtrace (array=array@entry=0x7ffed864ac10, size=size@entry=256) at backtrace.c:78
#9  0x000055f12dac5f19 in dump_native_stacktrace (signal=0x55f12dd9563c "SIGSEGV", mctx=0x55f12f774740) at /usr/src/debug/mono/mono/mono/mini/mini-posix.c:976
#10 0x000055f12da6f437 in mono_dump_native_crash_info (info=<optimized out>, mctx=0x55f12f774740, signal=0x55f12dd9563c "SIGSEGV") at /usr/src/debug/mono/mono/mono/mini/mini-posix.c:1155
#11 mono_handle_native_crash (signal=0x55f12dd9563c "SIGSEGV", mctx=0x55f12f774740, info=<optimized out>) at /usr/src/debug/mono/mono/mono/mini/mini-exceptions.c:3423
#12 0x000055f12dab48e5 in altstack_handle_and_restore (ctx=0x55f12f774740, obj=0x0, flags=<optimized out>) at /usr/src/debug/mono/mono/mono/mini/exceptions-amd64.c:879
#13 0x0000000000000271 in  ()
#14 0x000000000000000f in  ()
#15 0x0000000040d57123 in  ()
#16 0x00007fcec29c9e30 in  ()
#17 0x0000000000000000 in  ()

Downloading separate debug info for /usr/lib/libz.so.1
Downloading separate debug info for /usr/lib/../lib/libmono-native.so                                                                                                                                                              
Downloading separate debug info for /usr/lib/libgssapi_krb5.so.2                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libkrb5.so.3                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libk5crypto.so.3                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libcom_err.so.2                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libkrb5support.so.0                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libkeyutils.so.1                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libMonoSupportW.so                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libX11.so.6
Downloading separate debug info for /usr/lib/libxcb.so.1                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libXau.so.6                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libXdmcp.so.6                                                                                                                                                                         
Downloading separate debug info for /usr/lib/../lib/libMonoPosixHelper.so                                                                                                                                                          
Downloading separate debug info for /usr/lib/libgdiplus.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libglib-2.0.so.0                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libcairo.so.2                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libfreetype.so.6                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libjpeg.so.8                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libtiff.so.6                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libgif.so.7                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libpng16.so.16                                                                                                                                                                        
Downloading separate debug info for /usr/lib/libexif.so.12                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libfontconfig.so.1                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libpcre2-8.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libXext.so.6                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libXrender.so.1                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libxcb-render.so.0                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libxcb-shm.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libpixman-1.so.0                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libbz2.so.1.0                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libharfbuzz.so.0                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libbrotlidec.so.1                                                                                                                                                                     
Downloading separate debug info for /usr/lib/libzstd.so.1                                                                                                                                                                          
Downloading separate debug info for /usr/lib/liblzma.so.5                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libjbig.so.2.1                                                                                                                                                                        
Downloading separate debug info for /usr/lib/libexpat.so.1                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libgraphite2.so.3                                                                                                                                                                     
Downloading separate debug info for /usr/lib/libbrotlicommon.so.1                                                                                                                                                                  
Downloading separate debug info for /usr/lib/libgtk-x11-2.0.so.0                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libgdk-x11-2.0.so.0                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libgmodule-2.0.so.0                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libpangocairo-1.0.so.0                                                                                                                                                                
Downloading separate debug info for /usr/lib/libXfixes.so.3                                                                                                                                                                        
Downloading separate debug info for /usr/lib/libatk-1.0.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libgdk_pixbuf-2.0.so.0                                                                                                                                                                
Downloading separate debug info for /usr/lib/libgio-2.0.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libpangoft2-1.0.so.0                                                                                                                                                                  
Downloading separate debug info for /usr/lib/libpango-1.0.so.0                                                                                                                                                                     
Downloading separate debug info for /usr/lib/libgobject-2.0.so.0                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libXinerama.so.1                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libXi.so.6                                                                                                                                                                            
Downloading separate debug info for /usr/lib/libXrandr.so.2                                                                                                                                                                        
Downloading separate debug info for /usr/lib/libXcursor.so.1                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libXcomposite.so.1                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libXdamage.so.1                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libmount.so.1                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libfribidi.so.0                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libthai.so.0                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libffi.so.8                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libblkid.so.1                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libdatrie.so.1                                                                                                                                                                        
Downloading separate debug info for /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so                                                                                                                                                   
Downloading separate debug info for /usr/lib/gtk-2.0/2.10.0/engines/libadwaita.so                                                                                                                                                  
Downloading separate debug info for /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so                                                                                                                                                  
Downloading separate debug info for /usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so                                                                                                                                             
Downloading separate debug info for /usr/lib/libcanberra-gtk.so.0                                                                                                                                                                  
Downloading separate debug info for /usr/lib/libcanberra.so.0                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libvorbisfile.so.3                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libtdb.so.1                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libltdl.so.7                                                                                                                                                                          
Downloading separate debug info for /usr/lib/libvorbis.so.0                                                                                                                                                                        
Downloading separate debug info for /usr/lib/libogg.so.0                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libnss_mymachines.so.2                                                                                                                                                                
Downloading separate debug info for /usr/lib/libcap.so.2                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libnss_resolve.so.2                                                                                                                                                                   
Downloading separate debug info for /usr/lib/libnss_myhostname.so.2                                                                                                                                                                
Downloading separate debug info for /usr/lib/../lib/libmono-btls-shared.so                                                                                                                                                         
Downloading separate debug info for /usr/lib/libgcrypt.so.20                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libgpg-error.so.0                                                                                                                                                                     
Downloading separate debug info for /usr/lib/gio/modules/libgvfsdbus.so                                                                                                                                                            
Downloading separate debug info for /usr/lib/gvfs/libgvfscommon.so                                                                                                                                                                 
Downloading separate debug info for system-supplied DSO at 0x7ffed87d2000                                                                                                                                                          
[Thread debugging using libthread_db enabled]                                                                                                                                                                                      
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `mono --debug --nollvm -v --verify-all /usr/share/keepass/KeePass.exe'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                                                            
[Current thread is 1 (Thread 0x7fcece2ee040 (LWP 3098))]

keepass debug log tail

Method bool System.Windows.Forms.ToolStripMenuItem:get_IsMdiWindowListEntry () emitted at 0x40ff7210 to 0x40ff7236 (code length 38) [KeePass.exe]
converting method void System.Windows.Forms.ToolStripItem:OnClick (System.EventArgs)
Method void System.Windows.Forms.ToolStripItem:OnClick (System.EventArgs) emitted at 0x40ff7240 to 0x40ff72f4 (code length 180) [KeePass.exe]
converting method void System.Net.Sockets.Socket/<>c__DisplayClass355_0:<QueueIOSelectorJob>b__0 (System.Threading.Tasks.Task)
Method void System.Net.Sockets.Socket/<>c__DisplayClass355_0:<QueueIOSelectorJob>b__0 (System.Threading.Tasks.Task) emitted at 0x40ff7390 to 0x40ff73f5 (code length 101) [KeePass.exe]
converting method void System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.IO.Stream>:AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<System.Net.WebRequestStream>, System.Net.WebOperation/<GetRequestStream>d__50> (System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<System.Net.WebRequestStream>&,System.Net.WebOperation/<GetRequestStream>d__50&)
Method void System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.IO.Stream>:AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<System.Net.WebRequestStream>, System.Net.WebOperation/<GetRequestStream>d__50> (System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<System.Net.WebRequestStream>&,System.Net.WebOperation/<GetRequestStream>d__50&) emitted at 0x40ff7400 to 0x40ff7624 (code length 548) [KeePass.exe]
converting method void System.Net.WebOperation/<GetRequestStream>d__50:SetStateMachine (System.Runtime.CompilerServices.IAsyncStateMachine)
Method void System.Net.WebOperation/<GetRequestStream>d__50:SetStateMachine (System.Runtime.CompilerServices.IAsyncStateMachine) emitted at 0x40ff7630 to 0x40ff7680 (code length 80) [KeePass.exe]
converting method void System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.IO.Stream>:AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<bool>, System.Net.HttpWebRequest/<RunWithTimeoutWorker>d__244`1<System.IO.Stream>> (System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<bool>&,System.Net.HttpWebRequest/<RunWithTimeoutWorker>d__244`1<System.IO.Stream>&)
Method void System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.IO.Stream>:AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<bool>, System.Net.HttpWebRequest/<RunWithTimeoutWorker>d__244`1<System.IO.Stream>> (System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1/ConfiguredTaskAwaiter<bool>&,System.Net.HttpWebRequest/<RunWithTimeoutWorker>d__244`1<System.IO.Stream>&) emitted at 0x40ff76c0 to 0x40ff78dc (code length 540) [KeePass.exe]
converting method System.Drawing.Size System.Windows.Forms.SystemInformation:get_DragSize ()
Method System.Drawing.Size System.Windows.Forms.SystemInformation:get_DragSize () emitted at 0x40ff7960 to 0x40ff7991 (code length 49) [KeePass.exe]
converting method System.Drawing.Size System.Windows.Forms.XplatUI:get_DragSize ()
Method System.Drawing.Size System.Windows.Forms.XplatUI:get_DragSize () emitted at 0x40ff79a0 to 0x40ff79e2 (code length 66) [KeePass.exe]
converting method System.Drawing.Size System.Windows.Forms.XplatUIX11:get_DragSize ()
Method System.Drawing.Size System.Windows.Forms.XplatUIX11:get_DragSize () emitted at 0x40ff79f0 to 0x40ff7a2e (code length 62) [KeePass.exe]

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
./kp.sh: line 2:  3098 Aborted                 (core dumped) mono --debug --nollvm -v --verify-all /usr/share/keepass/KeePass.exe

journal log entry

Oct 05 06:43:31 archlinux systemd-coredump[471169]: [🡕] Process 3098 (mono) of user 1000 dumped core.

                                                    Module KeePass.exe.so without build-id.
                                                    Module mscorlib.dll.so without build-id.
                                                    Stack trace of thread 3098:
                                                    #0  0x00007fcece37d83c n/a (libc.so.6 + 0x8e83c)
                                                    #1  0x00007fcece32d668 raise (libc.so.6 + 0x3e668)
                                                    #2  0x00007fcece3154b8 abort (libc.so.6 + 0x264b8)
                                                    #3  0x000055f12da21190 n/a (mono-sgen + 0x2b190)
                                                    #4  0x00007fcece4ea496 x86_64_fallback_frame_state (libgcc_s.so.1 + 0x19496)
                                                    #5  0x00007fcece4ec354 _Unwind_Backtrace (libgcc_s.so.1 + 0x1b354)
                                                    #6  0x00007fcece40cdc3 __backtrace (libc.so.6 + 0x11ddc3)
                                                    #7  0x000055f12dac5f19 n/a (mono-sgen + 0xcff19)
                                                    #8  0x000055f12da6f437 n/a (mono-sgen + 0x79437)
                                                    #9  0x000055f12dab48e5 n/a (mono-sgen + 0xbe8e5)
                                                    #10 0x0000000000000271 n/a (n/a + 0x0)
                                                    #11 0x0000000040d603c5 n/a (n/a + 0x0)
                                                    ELF object binary architecture: AMD x86-64
ceng1996 commented 11 months ago

I have experienced a similar problem. Is there any additional information on this bug?

t00 commented 11 months ago

@ceng1996 I bought a low power laptop and leave it always on :) It still happens occasionally on my desktop, with weekly Arch Linux updates. No difference after switching to KeePass SSH kdbx storage from WebDAV so it must be some WND event loop bug.