sioyek icon indicating copy to clipboard operation
sioyek copied to clipboard

bug: Adding shared_database_path to configs causes startup crash on macOS

Open mil-ad opened this issue 2 years ago • 1 comments

I noticed that if I add a shared_database_path and point to an existing database that sync'd from my other machines sioyek crashes on startup (report below). This only happens on macOS and also if I point shared_database_path to a file that doesn't exist it starts fine.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               sioyek [41603]
Path:                  /Applications/sioyek.app/Contents/MacOS/sioyek
Identifier:            info.sioyek.sioyek
Version:               2.0 (???)
Code Type:             X86-64 (Translated)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-05-16 10:12:23.9369 +0100
OS Version:            macOS 13.3.1 (22E772610a)
Report Version:        12
Anonymous UUID:        2BD134F9-967F-8D2F-B6B9-0B957C2528F6

Sleep/Wake UUID:       FF9A5502-9A81-472A-9C42-01A076610F3B

Time Awake Since Boot: 150000 seconds
Time Since Wake:       2862 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes:       0x0000000000000001, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [41603]

VM Region Info: 0 is not in any region.  Bytes before following region: 4344967168
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      102faf000-1056cb000    [ 39.1M] r-x/r-x SM=COW  .../MacOS/sioyek

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib      	    0x7ff812e15f12 _platform_strlen + 18
1   sioyek                        	       0x102fc1520 handle_error(int, char*) + 64
2   sioyek                        	       0x102fc6866 DatabaseManager::get_prev_path_hash_pairs(std::__1::vector<std::__1::pair<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t>>, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t>>, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t>>>>>&) + 182
3   sioyek                        	       0x103013b8e main + 2878
4   dyld                          	       0x205aed41f start + 1903

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                       	    0x7ff7ffea2694 0x7ff7ffe9e000 + 18068

Thread 2:
0   runtime                       	    0x7ff7ffec087c 0x7ff7ffe9e000 + 141436

Thread 3:
0   runtime                       	    0x7ff7ffec087c 0x7ff7ffe9e000 + 141436

Thread 4:
0   runtime                       	    0x7ff7ffec087c 0x7ff7ffe9e000 + 141436

Thread 5:: com.apple.CFSocket.private
0   ???                           	    0x7ff8a29b69a8 ???
1   libsystem_kernel.dylib        	    0x7ff812db5282 __select + 10
2   CoreFoundation                	    0x7ff812eee342 __CFSocketManager + 617
3   libsystem_pthread.dylib       	    0x7ff812deb1d3 _pthread_start + 125
4   libsystem_pthread.dylib       	    0x7ff812de6bd3 thread_start + 15


Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007ff8564c58e0  rbx: 0x00007ff8564c58e0  rcx: 0x0000000000000000  rdx: 0x0000000000000000
  rdi: 0x0000000000000000  rsi: 0x00000000000120a8  rbp: 0x000000030cb94a50  rsp: 0x000000030cb94a50
   r8: 0x00007ff8564c2c98   r9: 0x0000000000000000  r10: 0x00000000ffffff00  r11: 0x00007ff8564c2c90
  r12: 0x000000030cb94eb0  r13: 0x00007fb1e0048000  r14: 0x0000000000000000  r15: 0x0000000000000015
  rip: <unavailable>       rfl: 0x0000000000000202
 tmp0: 0x00007ff8a2ebae88 tmp1: 0x0000000105f81120 tmp2: 0x00007ff812e15f00


Binary Images:
       0x205ae7000 -        0x205b82fff dyld (*) <f22a1143-9732-3e23-a8b7-cbade6bb8301> /usr/lib/dyld
    0x7ff7ffe9e000 -     0x7ff7ffecdfff runtime (*) <baf9136b-e1ff-3661-ad17-0f4ca7ce58f9> /usr/libexec/rosetta/runtime
       0x10e0f3000 -        0x10e146fff libRosettaRuntime (*) <73cd5d0d-71d4-353e-9740-af3964d9a4ae> /Library/Apple/*/libRosettaRuntime
       0x102faf000 -        0x1056cafff info.sioyek.sioyek (2.0) <9d3aebca-e526-3fbe-93f9-8abeb2a3e190> /Applications/sioyek.app/Contents/MacOS/sioyek
       0x10e6cb000 -        0x10e700fff org.qt-project.QtOpenGL (5.15) <3bb34a4a-a084-3a6d-afd4-72b02c295355> /Applications/sioyek.app/Contents/Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL
       0x10f020000 -        0x10f466fff org.qt-project.QtWidgets (5.15) <b432d666-dcab-320a-8496-78a67f554c0e> /Applications/sioyek.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
       0x10e7f5000 -        0x10e833fff org.qt-project.Qt3DInput (5.15) <6d708698-3d87-31b4-8d41-df03d0e6bcfc> /Applications/sioyek.app/Contents/Frameworks/Qt3DInput.framework/Versions/5/Qt3DInput
       0x10e945000 -        0x10e982fff org.qt-project.Qt3DCore (5.15) <3abd5946-b539-3540-8aca-9b0a2f0b6a4b> /Applications/sioyek.app/Contents/Frameworks/Qt3DCore.framework/Versions/5/Qt3DCore
       0x10e795000 -        0x10e7a6fff org.qt-project.QtGamepad (5.15) <299ece41-1467-3357-bcb2-9075abbefe1d> /Applications/sioyek.app/Contents/Frameworks/QtGamepad.framework/Versions/5/QtGamepad
       0x1103c6000 -        0x1108affff org.qt-project.QtGui (5.15) <cbcec35a-ee54-354f-9c2b-188ac6b2790d> /Applications/sioyek.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
       0x10ebce000 -        0x10ecdefff org.qt-project.QtNetwork (5.15) <c09a61c8-678f-339b-ad2e-b2a4a9b16bab> /Applications/sioyek.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
       0x1118a8000 -        0x111e18fff org.qt-project.QtCore (5.15) <c723812a-f7a5-3001-98d5-e60e8daa6ffb> /Applications/sioyek.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
       0x10ff86000 -        0x1100f4fff libqcocoa.dylib (*) <d4ab240b-4535-3aec-b72b-5ffc4750e4e5> /Applications/sioyek.app/Contents/PlugIns/platforms/libqcocoa.dylib
       0x10fdcb000 -        0x10fe2afff org.qt-project.QtDBus (5.15) <f6c498cb-9925-350d-b597-6c3f102e09d5> /Applications/sioyek.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus
       0x10ef3e000 -        0x10ef69fff org.qt-project.QtPrintSupport (5.15) <be399b08-503c-39e3-acac-268a9d866624> /Applications/sioyek.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
       0x115be9000 -        0x115c58fff com.apple.AppleMetalOpenGLRenderer (1.0) <027e9813-3b69-34e6-95b7-f301ddc36c36> /System/Library/Extensions/AppleMetalOpenGLRenderer.bundle/Contents/MacOS/AppleMetalOpenGLRenderer
       0x115b05000 -        0x115b2afff libqmacstyle.dylib (*) <5b9adb30-04ac-325f-bb42-6e40df6d7e6a> /Applications/sioyek.app/Contents/PlugIns/styles/libqmacstyle.dylib
    0x7ff812e15000 -     0x7ff812e1efef libsystem_platform.dylib (*) <c99e2bcf-5fa3-3690-9f4b-5e9a08b57343> /usr/lib/system/libsystem_platform.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
    0x7ff812dab000 -     0x7ff812de4ff7 libsystem_kernel.dylib (*) <08606a44-7008-3658-9f00-6c250b80e9c3> /usr/lib/system/libsystem_kernel.dylib
    0x7ff812e4a000 -     0x7ff8132e4fff com.apple.CoreFoundation (6.9) <9ba40f2c-8716-3a1a-873b-f576ccc44fe6> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7ff812de5000 -     0x7ff812df0fff libsystem_pthread.dylib (*) <86dfa543-95fa-36b4-83c6-bf03d01b2aad> /usr/lib/system/libsystem_pthread.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 2
    thread_create: 2
    thread_set_state: 2

VM Region Summary:
ReadOnly portion of Libraries: Total=489.4M resident=0K(0%) swapped_out_or_unallocated=489.4M(100%)
Writable regions: Total=1.1G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.1G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
ColorSync                          236K       24 
CoreGraphics                         4K        1 
Kernel Alloc Once                    8K        1 
MALLOC                           182.2M       26 
MALLOC guard page                  192K        8 
MALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
Rosetta Arena                     4096K        2 
Rosetta Generic                   1076K      266 
Rosetta IndirectBranch             256K        1 
Rosetta JIT                      128.0M        1 
Rosetta Return Stack               100K       10 
Rosetta Thread Context             100K       10 
STACK GUARD                         12K        3 
Stack                             10.1M        5 
Stack Guard                       56.0M        2 
VM_ALLOCATE                       8236K       20 
VM_ALLOCATE (reserved)              20K        2         reserved VM address space (unallocated)
__CTF                               824        1 
__DATA                            17.1M      335 
__DATA_CONST                      14.3M      196 
__DATA_DIRTY                       671K      108 
__FONT_DATA                        2352        1 
__GLSLBUILTINS                    5174K        1 
__LINKEDIT                       175.5M       21 
__OBJC_RO                         66.2M        1 
__OBJC_RW                         2009K        2 
__TEXT                           313.9M      352 
dyld private memory                260K        2 
mapped file                        4.3G     1344 
shared memory                      800K       14 
unshared pmap                     8320K        6 
===========                     =======  ======= 
TOTAL                              6.0G     2771 
TOTAL, minus reserved VM space     5.3G     2771 

mil-ad avatar May 16 '23 09:05 mil-ad

oh I'm an idiot. It crashes because the file doesn't exist (because macOS's home directory is not in the usual /home/username and is instead in /Users/username. It'd be great if:

  • sioyek complained that database file doesn't exist instead of crashing
  • sioyek configs could expand ~ or $HOME. It currently doesn't

mil-ad avatar May 16 '23 09:05 mil-ad