wakatime / macos-wakatime

Mac system tray app for automatic time tracking and metrics generated from your Xcode, Figma, Postman, etc. usage.
https://wakatime.com/mac
BSD 3-Clause "New" or "Revised" License
128 stars 22 forks source link

Crashing in background #75

Closed Demircivi closed 1 year ago

Demircivi commented 1 year ago

Sometimes the app crashes in the background, and I only realize it a couple of hours after the crash by realizing the missing icon in the system tray. See me not realizing the crash for two days :);

CleanShot 2023-06-02 at 22 12 31@2x

I want to supply some helpful info regarding this, but I need to figure out how we log things and get a reasonable trace to fix this issue.

Any help?

alanhamlett commented 1 year ago

Can you check for the crash error message or traceback in your Console.app?

https://support.apple.com/guide/console/reports-cnsl664be99a/mac

We don't have automatic collection of crash reports, since the app isn't on the App Store.

Demircivi commented 1 year ago

Thanks!

Some clues from me: see the process.launch() call here.

IIRC in the past Apple deprecated this method, and run should be used instead because the launch doesn't have the throws flag on it. At least, we can use the exception that it throws back.

Here is the crash log:

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

Process:               WakaTime [2059]
Path:                  /Applications/WakaTime.app/Contents/MacOS/WakaTime
Identifier:            macos-wakatime.WakaTime
Version:               0.6.0 (2)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-05-31 19:36:36.2463 +0300
OS Version:            macOS 13.2.1 (22D68)
Report Version:        12
Anonymous UUID:        FAB9A1F3-F1A3-6F8A-B2F4-7442A5B90BC1

Sleep/Wake UUID:       2AFF4618-FC77-41B4-A4B1-D1DA629741B1

Time Awake Since Boot: 160000 seconds
Time Since Wake:       24319 seconds

System Integrity Protection: enabled

Crashed Thread:        9  Dispatch queue: com.WakaTime.Watcher.callbackQueue

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000f744b9f93e10 -> 0x00007744b9f93e10 (possible pointer authentication failure)
Exception Codes:       0x0000000000000001, 0x0000f744b9f93e10

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

VM Region Info: 0x7744b9f93e10 is not in any region.  Bytes after previous region: 25583408463377  
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)
--->  
      UNUSED SPACE AT END

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib                 0x18e3312f0 __posix_spawn + 8
1   libsystem_kernel.dylib                 0x18e331288 posix_spawn + 480
2   Foundation                             0x18f3bfb4c -[NSConcreteTask launchWithDictionary:error:] + 2932
3   WakaTime                               0x100b89a18 WakaTime.handleEvent(app:file:isWrite:isBuilding:) + 1668
4   WakaTime                               0x100b8d360 partial apply for implicit closure #2 in implicit closure #1 in WakaTime.init() + 84
5   WakaTime                               0x100b95a70 specialized observerCallback(_:_:_:_:) + 1012
6   WakaTime                               0x100b91ef8 @objc observerCallback(_:_:_:_:) + 88
7   HIServices                             0x193bedb64 _XXMIGPostNotification + 888
8   HIServices                             0x193c1875c _XPostNotification + 392
9   HIServices                             0x193bcfba8 mshMIGPerform + 204
10  CoreFoundation                         0x18e449f98 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
11  CoreFoundation                         0x18e449eb8 __CFRunLoopDoSource1 + 520
12  CoreFoundation                         0x18e4488a4 __CFRunLoopRun + 2264
13  CoreFoundation                         0x18e447878 CFRunLoopRunSpecific + 612
14  HIToolbox                              0x197b27fa0 RunCurrentEventLoopInMode + 292
15  HIToolbox                              0x197b27de4 ReceiveNextEventCommon + 672
16  HIToolbox                              0x197b27b2c _BlockUntilNextEventMatchingListInModeWithFilter + 72
17  AppKit                                 0x1916cd84c _DPSNextEvent + 632
18  AppKit                                 0x1916cc9dc -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
19  AppKit                                 0x1916c0e0c -[NSApplication run] + 464
20  AppKit                                 0x191698250 NSApplicationMain + 880
21  SwiftUI                                0x1b509b41c 0x1b4fef000 + 705564
22  SwiftUI                                0x1b6250f4c 0x1b4fef000 + 19275596
23  SwiftUI                                0x1b5a74aa0 0x1b4fef000 + 11033248
24  WakaTime                               0x100b819e8 main + 40
25  dyld                                   0x18e03fe50 start + 2544

Thread 1:: com.apple.NSEventThread
0   libsystem_kernel.dylib                 0x18e32a050 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x18e33c11c mach_msg2_internal + 80
2   libsystem_kernel.dylib                 0x18e332c24 mach_msg_overwrite + 452
3   libsystem_kernel.dylib                 0x18e32a3cc mach_msg + 24
4   CoreFoundation                         0x18e449bb0 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                         0x18e44849c __CFRunLoopRun + 1232
6   CoreFoundation                         0x18e447878 CFRunLoopRunSpecific + 612
7   AppKit                                 0x1917f819c _NSEventThread + 172
8   libsystem_pthread.dylib                0x18e36a06c _pthread_start + 148
9   libsystem_pthread.dylib                0x18e364e2c thread_start + 8

Thread 2:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib                 0x18e32a050 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x18e33c11c mach_msg2_internal + 80
2   libsystem_kernel.dylib                 0x18e332c24 mach_msg_overwrite + 452
3   libsystem_kernel.dylib                 0x18e32a3cc mach_msg + 24
4   CoreFoundation                         0x18e449bb0 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                         0x18e44849c __CFRunLoopRun + 1232
6   CoreFoundation                         0x18e447878 CFRunLoopRunSpecific + 612
7   CFNetwork                              0x192e49488 0x192bf6000 + 2438280
8   Foundation                             0x18f34c0d0 __NSThread__start__ + 716
9   libsystem_pthread.dylib                0x18e36a06c _pthread_start + 148
10  libsystem_pthread.dylib                0x18e364e2c thread_start + 8

Thread 3:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 9 Crashed::  Dispatch queue: com.WakaTime.Watcher.callbackQueue
0   libobjc.A.dylib                        0x18dffd820 objc_msgSend + 32
1   libswiftCore.dylib                     0x19c5144a8 swift_bridgeObjectRetain + 44
2   libswiftCore.dylib                     0x19c490114 initializeWithCopy for Character + 32
3   Combine                                0x19e0af230 initializeWithCopy for Published + 280
4   libswiftCore.dylib                     0x19c27cd08 RawKeyPathComponent._projectReadOnly<A, B, C>(_:to:endingWith:) + 1108
5   libswiftCore.dylib                     0x19c27c478 closure #1 in KeyPath._projectReadOnly(from:) + 664
6   libswiftCore.dylib                     0x19c476558 partial apply for closure #1 in KeyPath._projectReadOnly(from:) + 40
7   libswiftCore.dylib                     0x19c4bd1f0 closure #1 in KeyPath._projectReadOnly(from:)partial apply + 16
8   libswiftCore.dylib                     0x19c280c08 swift_getAtKeyPath + 236
9   Combine                                0x19e0ae098 static Published.subscript.getter + 364
10  WakaTime                               0x100b8bcac WakaTime.shouldSendHeartbeat(file:time:isWrite:) + 124
11  WakaTime                               0x100b89450 WakaTime.handleEvent(app:file:isWrite:isBuilding:) + 188
12  WakaTime                               0x100b8d360 partial apply for implicit closure #2 in implicit closure #1 in WakaTime.init() + 84
13  WakaTime                               0x100b93734 closure #1 in Watcher.handleNotificationEvent(path:isWrite:) + 420
14  WakaTime                               0x100b937c4 thunk for @escaping @callee_guaranteed () -> () + 28
15  libdispatch.dylib                      0x18e1e09dc _dispatch_call_block_and_release + 32
16  libdispatch.dylib                      0x18e1e2504 _dispatch_client_callout + 20
17  libdispatch.dylib                      0x18e1e9bbc _dispatch_lane_serial_drain + 672
18  libdispatch.dylib                      0x18e1ea708 _dispatch_lane_invoke + 384
19  libdispatch.dylib                      0x18e1f534c _dispatch_workloop_worker_thread + 652
20  libsystem_pthread.dylib                0x18e366100 _pthread_wqthread + 288
21  libsystem_pthread.dylib                0x18e364e20 start_wqthread + 8

Thread 10:
0   libsystem_pthread.dylib                0x18e364e18 start_wqthread + 0

Thread 9 crashed with ARM Thread State (64-bit):
    x0: 0x0000600001f43e00   x1: 0x00000001de62cf8a   x2: 0x00000001ea98a048   x3: 0x000060000247c090
    x4: 0x0000000000000000   x5: 0x00000000000035c0   x6: 0x000060000337f5c0   x7: 0x00000001e9999880
    x8: 0x4000600001f43e00   x9: 0x00000001ea989ff8  x10: 0x6ae1600001f43e00  x11: 0x000060000337c000
   x12: 0x0000000000000010  x13: 0x00000000001ff800  x14: 0x0000f744b9f93e00  x15: 0x0000f744b9f93e00
   x16: 0x0000f744b9f93e00  x17: 0x80006000031764a0  x18: 0x0000000000000000  x19: 0x4000600001f43e00
   x20: 0x0000000000000010  x21: 0x0000000000000011  x22: 0x0000000000000000  x23: 0x0000000100ba1a28
   x24: 0x0000000000000011  x25: 0x000000016f64e210  x26: 0x0000000000000008  x27: 0x000000016f64e1f0
   x28: 0x00000001ea992f70   fp: 0x000000016f64e190   lr: 0x000000019c5144a8
    sp: 0x000000016f64e180   pc: 0x000000018dffd820 cpsr: 0x20001000
   far: 0x0000f744b9f93e10  esr: 0x92000004 (Data Abort) byte read Translation fault

Binary Images:
       0x18e329000 -        0x18e362feb libsystem_kernel.dylib (*) <3dcd49b9-b3c5-3d90-be40-a3b807cb9cd7> /usr/lib/system/libsystem_kernel.dylib
       0x18f2f5000 -        0x18fd2efff com.apple.Foundation (6.9) <c62e0110-c636-396a-9cb6-c3c08392b3fa> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
       0x100b80000 -        0x100b9bfff macos-wakatime.WakaTime (0.6.0) <1d70d162-9fb8-3e32-b0f0-5b67be364195> /Applications/WakaTime.app/Contents/MacOS/WakaTime
       0x193bc4000 -        0x193c27fff com.apple.HIServices (1.22) <2bb62b67-c2cc-3584-841f-531216249cb3> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices
       0x18e3c8000 -        0x18e89ffff com.apple.CoreFoundation (6.9) <18260df4-69a8-30d3-8175-fb8ae7ae7709> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       0x197af6000 -        0x197e29fff com.apple.HIToolbox (2.1.1) <c68fe2e2-e0f3-3caf-ada3-bcc72fba79d0> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       0x191694000 -        0x19259ffff com.apple.AppKit (6.9) <88722053-0df0-3d4f-bf55-7e3c2d2c8e29> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       0x1b4fef000 -        0x1b6872fff com.apple.SwiftUI (4.3.3.1.400) <a2ed7102-543e-3c8c-8d24-9ed33a1db942> /System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI
       0x18e03a000 -        0x18e0c4ba3 dyld (*) <191e84f1-4b95-39c8-b253-1c1ef56c0fa8> /usr/lib/dyld
       0x18e363000 -        0x18e36fffb libsystem_pthread.dylib (*) <9f3b729a-ed04-3e65-adac-d75ad06ebbdc> /usr/lib/system/libsystem_pthread.dylib
       0x192bf6000 -        0x192fb7fff com.apple.CFNetwork (1404.0.5) <1a0e7c82-ee42-31d5-86c4-9cc499d1d749> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
       0x18dff4000 -        0x18e039d9f libobjc.A.dylib (*) <951f5871-2d10-31ac-999d-7584ad121fa6> /usr/lib/libobjc.A.dylib
       0x19c111000 -        0x19c65efff libswiftCore.dylib (*) <5034430d-70ab-3345-9d7d-f5e05067eeb2> /usr/lib/swift/libswiftCore.dylib
       0x19e056000 -        0x19e1a5ff7 com.apple.combine (1.0) <d59d0597-14f4-328a-8896-a2fe0e507d73> /System/Library/Frameworks/Combine.framework/Versions/A/Combine
       0x18e1de000 -        0x18e225fff libdispatch.dylib (*) <4d52c3a5-32e6-37a2-9d6c-23c612038354> /usr/lib/system/libdispatch.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

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: 6
    thread_create: 0
    thread_set_state: 364

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

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               256K        2 
Activity Tracing                   256K        1 
CG image                            32K        2 
ColorSync                          528K       25 
CoreAnimation                       48K        3 
CoreGraphics                       240K       15 
Foundation                          16K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           321.5M       67 
MALLOC guard page                  288K       14 
MALLOC_MEDIUM (reserved)           1.2G       10         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
SQLite page cache                  256K        2 
STACK GUARD                       56.2M       11 
Stack                             13.3M       11 
VM_ALLOCATE                       1216K        9 
__AUTH                            1182K      235 
__AUTH_CONST                      18.4M      429 
__CTF                               756        1 
__DATA                            7600K      414 
__DATA_CONST                      18.9M      431 
__DATA_DIRTY                      1281K      142 
__FONT_DATA                        2352        1 
__LINKEDIT                       768.1M        3 
__OBJC_CONST                      2219K      192 
__OBJC_RO                         65.5M        1 
__OBJC_RW                         1988K        1 
__TEXT                           417.3M      451 
dyld private memory                256K        1 
libnetwork                        1664K       24 
mapped file                      189.1M       38 
shared memory                      848K       12 
===========                     =======  ======= 
TOTAL                              3.4G     2551 
TOTAL, minus reserved VM space     1.8G     2551 

-----------
Full Report
-----------

{"app_name":"WakaTime","timestamp":"2023-05-31 19:36:38.00 +0300","app_version":"0.6.0","slice_uuid":"1d70d162-9fb8-3e32-b0f0-5b67be364195","build_version":"2","platform":1,"bundleID":"macos-wakatime.WakaTime","share_with_app_devs":1,"is_first_party":0,"bug_type":"309","os_version":"macOS 13.2.1 (22D68)","roots_installed":0,"name":"WakaTime","incident_id":"D2097CEB-CB42-4EE9-993C-A26CD559E897"}
{
  "uptime" : 160000,
  "procRole" : "Default",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,2",
  "coalitionID" : 927,
  "osVersion" : {
    "train" : "macOS 13.2.1",
    "build" : "22D68",
    "releaseType" : "User"
  },
  "captureTime" : "2023-05-31 19:36:36.2463 +0300",
  "incident" : "D2097CEB-CB42-4EE9-993C-A26CD559E897",
  "pid" : 2059,
  "translated" : false,
  "cpuType" : "ARM-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2023-05-26 23:13:54.9794 +0300",
  "procStartAbsTime" : 2027710094,
  "procExitAbsTime" : 4011862861412,
  "procName" : "WakaTime",
  "procPath" : "\/Applications\/WakaTime.app\/Contents\/MacOS\/WakaTime",
  "bundleInfo" : {"CFBundleShortVersionString":"0.6.0","CFBundleVersion":"2","CFBundleIdentifier":"macos-wakatime.WakaTime"},
  "storeInfo" : {"deviceIdentifierForVendor":"AF2A67F1-F4DC-5792-B1BC-0B7769AD3D7C","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "macos-wakatime.WakaTime",
  "crashReporterKey" : "FAB9A1F3-F1A3-6F8A-B2F4-7442A5B90BC1",
  "throttleTimeout" : 2147483647,
  "wakeTime" : 24319,
  "sleepWakeUUID" : "2AFF4618-FC77-41B4-A4B1-D1DA629741B1",
  "sip" : "enabled",
  "vmRegionInfo" : "0x7744b9f93e10 is not in any region.  Bytes after previous region: 25583408463377  \n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)\n--->  \n      UNUSED SPACE AT END",
  "exception" : {"codes":"0x0000000000000001, 0x0000f744b9f93e10","rawCodes":[1,271874549956112],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000f744b9f93e10 -> 0x00007744b9f93e10 (possible pointer authentication failure)"},
  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":2059},
  "vmregioninfo" : "0x7744b9f93e10 is not in any region.  Bytes after previous region: 25583408463377  \n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)\n--->  \n      UNUSED SPACE AT END",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":364,"task_for_pid":6},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 9,
  "threads" : [{"id":12957,"queue":"com.apple.main-thread","frames":[{"imageOffset":33520,"symbol":"__posix_spawn","symbolLocation":8,"imageIndex":0},{"imageOffset":33416,"symbol":"posix_spawn","symbolLocation":480,"imageIndex":0},{"imageOffset":830284,"symbol":"-[NSConcreteTask launchWithDictionary:error:]","symbolLocation":2932,"imageIndex":1},{"imageOffset":39448,"symbol":"WakaTime.handleEvent(app:file:isWrite:isBuilding:)","symbolLocation":1668,"imageIndex":2},{"imageOffset":54112,"symbol":"partial apply for implicit closure #2 in implicit closure #1 in WakaTime.init()","symbolLocation":84,"imageIndex":2},{"imageOffset":88688,"symbol":"specialized observerCallback(_:_:_:_:)","symbolLocation":1012,"imageIndex":2},{"imageOffset":73464,"symbol":"@objc observerCallback(_:_:_:_:)","symbolLocation":88,"imageIndex":2},{"imageOffset":170852,"symbol":"_XXMIGPostNotification","symbolLocation":888,"imageIndex":3},{"imageOffset":345948,"symbol":"_XPostNotification","symbolLocation":392,"imageIndex":3},{"imageOffset":48040,"symbol":"mshMIGPerform","symbolLocation":204,"imageIndex":3},{"imageOffset":532376,"symbol":"__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__","symbolLocation":60,"imageIndex":4},{"imageOffset":532152,"symbol":"__CFRunLoopDoSource1","symbolLocation":520,"imageIndex":4},{"imageOffset":526500,"symbol":"__CFRunLoopRun","symbolLocation":2264,"imageIndex":4},{"imageOffset":522360,"symbol":"CFRunLoopRunSpecific","symbolLocation":612,"imageIndex":4},{"imageOffset":204704,"symbol":"RunCurrentEventLoopInMode","symbolLocation":292,"imageIndex":5},{"imageOffset":204260,"symbol":"ReceiveNextEventCommon","symbolLocation":672,"imageIndex":5},{"imageOffset":203564,"symbol":"_BlockUntilNextEventMatchingListInModeWithFilter","symbolLocation":72,"imageIndex":5},{"imageOffset":235596,"symbol":"_DPSNextEvent","symbolLocation":632,"imageIndex":6},{"imageOffset":231900,"symbol":"-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]","symbolLocation":728,"imageIndex":6},{"imageOffset":183820,"symbol":"-[NSApplication run]","symbolLocation":464,"imageIndex":6},{"imageOffset":16976,"symbol":"NSApplicationMain","symbolLocation":880,"imageIndex":6},{"imageOffset":705564,"imageIndex":7},{"imageOffset":19275596,"imageIndex":7},{"imageOffset":11033248,"imageIndex":7},{"imageOffset":6632,"symbol":"main","symbolLocation":40,"imageIndex":2},{"imageOffset":24144,"symbol":"start","symbolLocation":2544,"imageIndex":8}]},{"id":13046,"name":"com.apple.NSEventThread","frames":[{"imageOffset":4176,"symbol":"mach_msg2_trap","symbolLocation":8,"imageIndex":0},{"imageOffset":78108,"symbol":"mach_msg2_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":39972,"symbol":"mach_msg_overwrite","symbolLocation":452,"imageIndex":0},{"imageOffset":5068,"symbol":"mach_msg","symbolLocation":24,"imageIndex":0},{"imageOffset":531376,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":160,"imageIndex":4},{"imageOffset":525468,"symbol":"__CFRunLoopRun","symbolLocation":1232,"imageIndex":4},{"imageOffset":522360,"symbol":"CFRunLoopRunSpecific","symbolLocation":612,"imageIndex":4},{"imageOffset":1458588,"symbol":"_NSEventThread","symbolLocation":172,"imageIndex":6},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":9},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":9}]},{"id":13792,"name":"com.apple.NSURLConnectionLoader","frames":[{"imageOffset":4176,"symbol":"mach_msg2_trap","symbolLocation":8,"imageIndex":0},{"imageOffset":78108,"symbol":"mach_msg2_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":39972,"symbol":"mach_msg_overwrite","symbolLocation":452,"imageIndex":0},{"imageOffset":5068,"symbol":"mach_msg","symbolLocation":24,"imageIndex":0},{"imageOffset":531376,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":160,"imageIndex":4},{"imageOffset":525468,"symbol":"__CFRunLoopRun","symbolLocation":1232,"imageIndex":4},{"imageOffset":522360,"symbol":"CFRunLoopRunSpecific","symbolLocation":612,"imageIndex":4},{"imageOffset":2438280,"imageIndex":10},{"imageOffset":356560,"symbol":"__NSThread__start__","symbolLocation":716,"imageIndex":1},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":9},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":9}]},{"id":3128654,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"id":3130853,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"id":3130857,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"id":3131275,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"id":3131276,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"id":3131277,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]},{"triggered":true,"id":3131278,"threadState":{"x":[{"value":105553149050368},{"value":8025984906,"objc-selector":"retain"},{"value":8230838344,"symbolLocation":0,"symbol":"type metadata for String"},{"value":105553154523280},{"value":0},{"value":13760},{"value":105553170265536},{"value":8214124672,"symbolLocation":2856,"symbol":"InitialAllocationPool"},{"value":4611791571576438272},{"value":8230838264,"symbolLocation":16,"symbol":"value witness table for String"},{"value":7701542390929309184},{"value":105553170251776},{"value":16},{"value":2095104},{"value":271874549956096},{"value":271874549956096},{"value":271874549956096},{"value":9223477590022907040},{"value":0},{"value":4611791571576438272},{"value":16},{"value":17},{"value":0},{"value":4307163688,"symbolLocation":0,"symbol":"type metadata for State"},{"value":17},{"value":6163849744},{"value":8},{"value":6163849712},{"value":8230874992,"symbolLocation":0,"symbol":"value witness table for Builtin.NativeObject"}],"flavor":"ARM_THREAD_STATE64","lr":{"value":6917538984},"cpsr":{"value":536875008},"fp":{"value":6163849616},"sp":{"value":6163849600},"esr":{"value":2449473540,"description":"(Data Abort) byte read Translation fault"},"pc":{"value":6677321760,"matchesCrashFrame":1},"far":{"value":271874549956112}},"queue":"com.WakaTime.Watcher.callbackQueue","frames":[{"imageOffset":38944,"symbol":"objc_msgSend","symbolLocation":32,"imageIndex":11},{"imageOffset":4207784,"symbol":"swift_bridgeObjectRetain","symbolLocation":44,"imageIndex":12},{"imageOffset":3666196,"symbol":"initializeWithCopy for Character","symbolLocation":32,"imageIndex":12},{"imageOffset":365104,"symbol":"initializeWithCopy for Published","symbolLocation":280,"imageIndex":13},{"imageOffset":1490184,"symbol":"RawKeyPathComponent._projectReadOnly<A, B, C>(_:to:endingWith:)","symbolLocation":1108,"imageIndex":12},{"imageOffset":1487992,"symbol":"closure #1 in KeyPath._projectReadOnly(from:)","symbolLocation":664,"imageIndex":12},{"imageOffset":3560792,"symbol":"partial apply for closure #1 in KeyPath._projectReadOnly(from:)","symbolLocation":40,"imageIndex":12},{"imageOffset":3850736,"symbol":"closure #1 in KeyPath._projectReadOnly(from:)partial apply","symbolLocation":16,"imageIndex":12},{"imageOffset":1506312,"symbol":"swift_getAtKeyPath","symbolLocation":236,"imageIndex":12},{"imageOffset":360600,"symbol":"static Published.subscript.getter","symbolLocation":364,"imageIndex":13},{"imageOffset":48300,"symbol":"WakaTime.shouldSendHeartbeat(file:time:isWrite:)","symbolLocation":124,"imageIndex":2},{"imageOffset":37968,"symbol":"WakaTime.handleEvent(app:file:isWrite:isBuilding:)","symbolLocation":188,"imageIndex":2},{"imageOffset":54112,"symbol":"partial apply for implicit closure #2 in implicit closure #1 in WakaTime.init()","symbolLocation":84,"imageIndex":2},{"imageOffset":79668,"symbol":"closure #1 in Watcher.handleNotificationEvent(path:isWrite:)","symbolLocation":420,"imageIndex":2},{"imageOffset":79812,"symbol":"thunk for @escaping @callee_guaranteed () -> ()","symbolLocation":28,"imageIndex":2},{"imageOffset":10716,"symbol":"_dispatch_call_block_and_release","symbolLocation":32,"imageIndex":14},{"imageOffset":17668,"symbol":"_dispatch_client_callout","symbolLocation":20,"imageIndex":14},{"imageOffset":48060,"symbol":"_dispatch_lane_serial_drain","symbolLocation":672,"imageIndex":14},{"imageOffset":50952,"symbol":"_dispatch_lane_invoke","symbolLocation":384,"imageIndex":14},{"imageOffset":95052,"symbol":"_dispatch_workloop_worker_thread","symbolLocation":652,"imageIndex":14},{"imageOffset":12544,"symbol":"_pthread_wqthread","symbolLocation":288,"imageIndex":9},{"imageOffset":7712,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":9}]},{"id":3131279,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":9}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6680645632,
    "size" : 237548,
    "uuid" : "3dcd49b9-b3c5-3d90-be40-a3b807cb9cd7",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6697209856,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.Foundation",
    "size" : 10723328,
    "uuid" : "c62e0110-c636-396a-9cb6-c3c08392b3fa",
    "path" : "\/System\/Library\/Frameworks\/Foundation.framework\/Versions\/C\/Foundation",
    "name" : "Foundation",
    "CFBundleVersion" : "1953.300"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4307025920,
    "CFBundleShortVersionString" : "0.6.0",
    "CFBundleIdentifier" : "macos-wakatime.WakaTime",
    "size" : 114688,
    "uuid" : "1d70d162-9fb8-3e32-b0f0-5b67be364195",
    "path" : "\/Applications\/WakaTime.app\/Contents\/MacOS\/WakaTime",
    "name" : "WakaTime",
    "CFBundleVersion" : "2"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6773555200,
    "CFBundleShortVersionString" : "1.22",
    "CFBundleIdentifier" : "com.apple.HIServices",
    "size" : 409600,
    "uuid" : "2bb62b67-c2cc-3584-841f-531216249cb3",
    "path" : "\/System\/Library\/Frameworks\/ApplicationServices.framework\/Versions\/A\/Frameworks\/HIServices.framework\/Versions\/A\/HIServices",
    "name" : "HIServices"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6681296896,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.CoreFoundation",
    "size" : 5079040,
    "uuid" : "18260df4-69a8-30d3-8175-fb8ae7ae7709",
    "path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation",
    "name" : "CoreFoundation",
    "CFBundleVersion" : "1953.300"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6839820288,
    "CFBundleShortVersionString" : "2.1.1",
    "CFBundleIdentifier" : "com.apple.HIToolbox",
    "size" : 3358720,
    "uuid" : "c68fe2e2-e0f3-3caf-ada3-bcc72fba79d0",
    "path" : "\/System\/Library\/Frameworks\/Carbon.framework\/Versions\/A\/Frameworks\/HIToolbox.framework\/Versions\/A\/HIToolbox",
    "name" : "HIToolbox"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6734561280,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.AppKit",
    "size" : 15777792,
    "uuid" : "88722053-0df0-3d4f-bf55-7e3c2d2c8e29",
    "path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit",
    "name" : "AppKit",
    "CFBundleVersion" : "2299.40.118"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7331573760,
    "CFBundleShortVersionString" : "4.3.3.1.400",
    "CFBundleIdentifier" : "com.apple.SwiftUI",
    "size" : 25706496,
    "uuid" : "a2ed7102-543e-3c8c-8d24-9ed33a1db942",
    "path" : "\/System\/Library\/Frameworks\/SwiftUI.framework\/Versions\/A\/SwiftUI",
    "name" : "SwiftUI",
    "CFBundleVersion" : "4.3.3.1.400"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6677569536,
    "size" : 568228,
    "uuid" : "191e84f1-4b95-39c8-b253-1c1ef56c0fa8",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6680883200,
    "size" : 53244,
    "uuid" : "9f3b729a-ed04-3e65-adac-d75ad06ebbdc",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6756982784,
    "CFBundleShortVersionString" : "1404.0.5",
    "CFBundleIdentifier" : "com.apple.CFNetwork",
    "size" : 3940352,
    "uuid" : "1a0e7c82-ee42-31d5-86c4-9cc499d1d749",
    "path" : "\/System\/Library\/Frameworks\/CFNetwork.framework\/Versions\/A\/CFNetwork",
    "name" : "CFNetwork",
    "CFBundleVersion" : "1404.0.5"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6677282816,
    "size" : 286112,
    "uuid" : "951f5871-2d10-31ac-999d-7584ad121fa6",
    "path" : "\/usr\/lib\/libobjc.A.dylib",
    "name" : "libobjc.A.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6913331200,
    "size" : 5562368,
    "uuid" : "5034430d-70ab-3345-9d7d-f5e05067eeb2",
    "path" : "\/usr\/lib\/swift\/libswiftCore.dylib",
    "name" : "libswiftCore.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6946119680,
    "CFBundleShortVersionString" : "1.0",
    "CFBundleIdentifier" : "com.apple.combine",
    "size" : 1376248,
    "uuid" : "d59d0597-14f4-328a-8896-a2fe0e507d73",
    "path" : "\/System\/Library\/Frameworks\/Combine.framework\/Versions\/A\/Combine",
    "name" : "Combine",
    "CFBundleVersion" : "310"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6679289856,
    "size" : 294912,
    "uuid" : "4d52c3a5-32e6-37a2-9d6c-23c612038354",
    "path" : "\/usr\/lib\/system\/libdispatch.dylib",
    "name" : "libdispatch.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 6676922368,
  "size" : 3447455744,
  "uuid" : "835716ae-b363-3187-b065-cf94139bfc85"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)\nWritable regions: Total=1.9G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.9G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nAccelerate framework               256K        2 \nActivity Tracing                   256K        1 \nCG image                            32K        2 \nColorSync                          528K       25 \nCoreAnimation                       48K        3 \nCoreGraphics                       240K       15 \nFoundation                          16K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           321.5M       67 \nMALLOC guard page                  288K       14 \nMALLOC_MEDIUM (reserved)           1.2G       10         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSQLite page cache                  256K        2 \nSTACK GUARD                       56.2M       11 \nStack                             13.3M       11 \nVM_ALLOCATE                       1216K        9 \n__AUTH                            1182K      235 \n__AUTH_CONST                      18.4M      429 \n__CTF                               756        1 \n__DATA                            7600K      414 \n__DATA_CONST                      18.9M      431 \n__DATA_DIRTY                      1281K      142 \n__FONT_DATA                        2352        1 \n__LINKEDIT                       768.1M        3 \n__OBJC_CONST                      2219K      192 \n__OBJC_RO                         65.5M        1 \n__OBJC_RW                         1988K        1 \n__TEXT                           417.3M      451 \ndyld private memory                256K        1 \nlibnetwork                        1664K       24 \nmapped file                      189.1M       38 \nshared memory                      848K       12 \n===========                     =======  ======= \nTOTAL                              3.4G     2551 \nTOTAL, minus reserved VM space     1.8G     2551 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.WakaTime.Watcher.callbackQueue"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "5f72dc58705eff005a46b3a9",
      "factorPackIds" : {

      },
      "deploymentId" : 240000015
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000021
    }
  ],
  "experiments" : [
    {
      "treatmentId" : "c9ac7ace-da9d-41f5-b424-a422a874751d",
      "experimentId" : "63b8ec83fd1d345f491884ba",
      "deploymentId" : 400000024
    },
    {
      "treatmentId" : "c28e4ee6-1b08-4f90-8e05-2809e78310a3",
      "experimentId" : "6317d2003d24842ff850182a",
      "deploymentId" : 400000013
    }
  ]
}
}
alanhamlett commented 1 year ago

Looks like it's crashing here:

https://github.com/wakatime/macos-wakatime/blob/a12076a515881e60a5b90d75700977571a26b008/WakaTime/WakaTime.swift#L292

Demircivi commented 1 year ago

Yeah, that's what I also mentioned. A cautious approach would fit here, I would do it when I have some free time.

starbugs commented 1 year ago

I looked at the crash logs in more detail and to me it looks as if thread 9 has crashed, not the main thread.

Thread 9 Crashed::  Dispatch queue: com.WakaTime.Watcher.callbackQueue
0   libobjc.A.dylib                        0x18dffd820 objc_msgSend + 32
1   libswiftCore.dylib                     0x19c5144a8 swift_bridgeObjectRetain + 44
2   libswiftCore.dylib                     0x19c490114 initializeWithCopy for Character + 32
3   Combine                                0x19e0af230 initializeWithCopy for Published + 280
4   libswiftCore.dylib                     0x19c27cd08 RawKeyPathComponent._projectReadOnly<A, B, C>(_:to:endingWith:) + 1108
5   libswiftCore.dylib                     0x19c27c478 closure #1 in KeyPath._projectReadOnly(from:) + 664
6   libswiftCore.dylib                     0x19c476558 partial apply for closure #1 in KeyPath._projectReadOnly(from:) + 40
7   libswiftCore.dylib                     0x19c4bd1f0 closure #1 in KeyPath._projectReadOnly(from:)partial apply + 16
8   libswiftCore.dylib                     0x19c280c08 swift_getAtKeyPath + 236
9   Combine                                0x19e0ae098 static Published.subscript.getter + 364
10  WakaTime                               0x100b8bcac WakaTime.shouldSendHeartbeat(file:time:isWrite:) + 124

The code executed here is no longer existing in the latest macos-wakatime version. Combine is part of SwiftUI, which we no longer use. It's quite strange that the app would crash at this point, but possible.

I will provide a PR to make sure that exceptions thrown when launching wakatime-cli will be handled properly.

Regarding this particular crash, I think there's a high probability that it won't occur anymore if you update to the latest version.