Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My project crashes when calling .sync() #579

Open
viktorstrate opened this issue Aug 17, 2020 · 1 comment
Open

My project crashes when calling .sync() #579

viktorstrate opened this issue Aug 17, 2020 · 1 comment

Comments

@viktorstrate
Copy link

viktorstrate commented Aug 17, 2020

I have difficult bug, for one of my open-source side projects Time-Agent, that I've been trying to fix on and off for the last half a year or so.

The app somtimes crashes when I sync CoreData with a json file using this library.
The biggest mystery is that it only happends when a debugger isn't attached, so I can only debug it through the mac Console application. (Could it possibly be a race condition problem?)

To crash the app, I have to:

  1. Open the app from outside of XCode without a debugger attached (it can be a debug build though)
  2. Edit an item in CoreData
  3. Press the sync button, which calls the load() function described below.
    If I restart the app before pressing the sync button, it doesn't crash and no data is lost.

This could very well be a programming error on my side, but I am opening this issue because the crash report states that it is this library that causes the crash: Sync/Source/Sync/NSManagedObject+Sync.swift, line 60.

From the crash logs, it looks like all date columns are nil, that is createdAt and updatedAt, and that it crashes because these fields are required.
I don't understand why these values would be nil, they are not nil in the .json file, because they are logged after Projects to sync with the proper dates. And I would imagine that CoreData wouldn't let me save invalid entities in the first place.
So I'm left to believe that it could have something to do with the internals of this library?

Any help is much appreciated 😊

Function that causes the crash:

func load() {
        NSLog("Loading from sync file...")
        
        guard let data = try? Data(contentsOf: self.path) else {
            NSLog("Warn: Sync file does not exist, nothing to load, saving instead...")
            self.save()
            return
        }
        
        guard let json = try? JSONSerialization.jsonObject(with: data, options: []) as? [String : Any] else {
            NSLog("ERROR: Could not parse content of sync file")
            return
        }
        
        guard let projects = json["projects"] as? [[String: Any]] else {
            NSLog("ERROR: Could not get projects from synced file")
            return
        }
        
        NSLog("Projects to sync: \(projects)")
        
        let rootGroupsPredicate = NSPredicate(format: "parent == nil", argumentArray: [])
            
        Model.context.sync(projects, inEntityNamed: "Project", predicate: rootProjectsPredicate, parent: nil) { (error) in
            if let error = error {
                print("Root projects sync error: \(error)")
                return
            }
        }
}

Console output of the load() function above:

default	18:39:24.727413+0200	Time Agent	Loading from sync file...
default	18:39:24.729429+0200	Time Agent	Projects to sync: [["tasks": <__NSArrayI 0x600001b63000>(
{
    archived = 0;
    "created_at" = "2020-08-17T18:11:04+02:00";
    duration = "62.39944994449615";
    id = "812B95E0-2D25-43E0-A641-A59DB923E4AD";
    name = asdf;
    start = "2020-08-17T18:11:02+02:00";
    "updated_at" = "2020-08-17T18:11:07+02:00";
},
<...>
default	18:39:24.739981+0200	Time Agent	Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." UserInfo={NSDetailedErrors=(
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Project: 0x600002dfa580> (entity: Project; id: 0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>; data: {\n    createdAt = nil;\n    group = nil;\n    id = \"FD229F24-3078-4127-8359-FBAB9BED01AD\";\n    name = \"Test project 123\";\n    tasks =     (\n        \"0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>\",\n        \"0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>\",\n        \"0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>\",\n        \"0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>\",\n        \"0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F<…>

Detailed crash report:

Process:               Time Agent [33408]
Path:                  /Users/USER/Library/Developer/Xcode/DerivedData/Time_Agent-dlaquvzanbkahmflfxhuzthjmijx/Build/Products/Debug/Time Agent.app/Contents/MacOS/Time Agent
Identifier:            com.viktorstrate.Time-Agent
Version:               1.0 (1)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Time Agent [33408]
User ID:               501

Date/Time:             2020-08-17 18:39:24.741 +0200
OS Version:            Mac OS X 10.15.4 (19E287)
Report Version:        12
Anonymous UUID:        6E14EEC4-0DDA-7E95-CACA-73A447927D7F


Time Awake Since Boot: 6500 seconds

System Integrity Protection: disabled

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

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [33408]

Application Specific Information:
Performing @selector(syncAction:) from sender NSButton 0x7f9779541680
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." UserInfo={NSDetailedErrors=(
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Project: 0x600002dfa580> (entity: Project; id: 0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>; data: {\n    createdAt = nil;\n    group = nil;\n    id = \"FD229F24-3078-4127-8359-FBAB9BED01AD\";\n    name = \"Test project 123\";\n    tasks =     (\n        \"0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>\",\n        \"0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>\",\n        \"0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>\",\n        \"0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>\",\n        \"0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p706>\"\n    );\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Project: 0x600002dfa580> (entity: Project; id: 0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>; data: {\n    createdAt = nil;\n    group = nil;\n    id = \"FD229F24-3078-4127-8359-FBAB9BED01AD\";\n    name = \"Test project 123\";\n    tasks =     (\n        \"0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>\",\n        \"0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>\",\n        \"0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>\",\n        \"0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>\",\n        \"0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p706>\"\n    );\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfab70> (entity: Task; id: 0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"4.2135009765625\";\n    id = \"BE481305-E763-4F40-A01A-F41D02C7A1B5\";\n    name = \"New one 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfab70> (entity: Task; id: 0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"4.2135009765625\";\n    id = \"BE481305-E763-4F40-A01A-F41D02C7A1B5\";\n    name = \"New one 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"start is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfab70> (entity: Task; id: 0xb68cee5ee6e512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p711>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"4.2135009765625\";\n    id = \"BE481305-E763-4F40-A01A-F41D02C7A1B5\";\n    name = \"New one 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=start, NSLocalizedDescription=start is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac10> (entity: Task; id: 0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"62.39944994449615\";\n    id = \"812B95E0-2D25-43E0-A641-A59DB923E4AD\";\n    name = asdf;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac10> (entity: Task; id: 0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"62.39944994449615\";\n    id = \"812B95E0-2D25-43E0-A641-A59DB923E4AD\";\n    name = asdf;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"start is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac10> (entity: Task; id: 0xb68cee5ee66512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p709>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"62.39944994449615\";\n    id = \"812B95E0-2D25-43E0-A641-A59DB923E4AD\";\n    name = asdf;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=start, NSLocalizedDescription=start is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac60> (entity: Task; id: 0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"3601.547034978867\";\n    id = \"AD7EF86B-92A1-43A4-9076-7508430036BD\";\n    name = \"new test\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac60> (entity: Task; id: 0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"3601.547034978867\";\n    id = \"AD7EF86B-92A1-43A4-9076-7508430036BD\";\n    name = \"new test\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"start is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfac60> (entity: Task; id: 0xb68cee5ee62512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p708>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"3601.547034978867\";\n    id = \"AD7EF86B-92A1-43A4-9076-7508430036BD\";\n    name = \"new test\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=start, NSLocalizedDescription=start is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfabc0> (entity: Task; id: 0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"14220.62462496758\";\n    id = \"94D43893-4443-4CBE-ABB1-F2929469C2AF\";\n    name = \"Edited test 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfabc0> (entity: Task; id: 0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"14220.62462496758\";\n    id = \"94D43893-4443-4CBE-ABB1-F2929469C2AF\";\n    name = \"Edited test 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"start is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfabc0> (entity: Task; id: 0xb68cee5ee6a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p710>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"14220.62462496758\";\n    id = \"94D43893-4443-4CBE-ABB1-F2929469C2AF\";\n    name = \"Edited test 2\";\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=start, NSLocalizedDescription=start is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"createdAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfacb0> (entity: Task; id: 0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p706>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"6.293033957481384\";\n    id = \"D9C5F84A-E411-42E4-8FC2-C2E03DC77BB2\";\n    name = test;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=createdAt, NSLocalizedDescription=createdAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"updatedAt is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfacb0> (entity: Task; id: 0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p706>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"6.293033957481384\";\n    id = \"D9C5F84A-E411-42E4-8FC2-C2E03DC77BB2\";\n    name = test;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=updatedAt, NSLocalizedDescription=updatedAt is a required value.}",
    "Error Domain=NSCocoaErrorDomain Code=1570 \"start is a required value.\" UserInfo={NSValidationErrorObject=<Task: 0x600002dfacb0> (entity: Task; id: 0xb68cee5ee7a512ff <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Task/p706>; data: {\n    archived = 0;\n    createdAt = nil;\n    duration = \"6.293033957481384\";\n    id = \"D9C5F84A-E411-42E4-8FC2-C2E03DC77BB2\";\n    name = test;\n    project = \"0xb68cee5ee76512df <x-coredata://1FC30782-FCC1-427F-AAB0-090789C8D9FC/Project/p705>\";\n    start = nil;\n    updatedAt = nil;\n}), NSValidationErrorKey=start, NSLocalizedDescription=start is a required value.}"
)}: file /Users/viktorstrate/Development/xcode/Time-Agent/Pods/Sync/Source/Sync/NSManagedObject+Sync.swift, line 60
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib            	0x00007fff6819730f _assertionFailure(_:_:file:line:flags:) + 863
1   libswiftCore.dylib            	0x00007fff681c6096 swift_unexpectedError + 582
2   org.cocoapods.Sync            	0x0000000104623f96 NSManagedObject.sync_fill(with:parent:parentRelationship:context:operations:shouldContinueBlock:objectJSONBlock:) + 16182
3   org.cocoapods.Sync            	0x000000010465e0d3 closure #2 in static Sync.changes(_:inEntityNamed:predicate:parent:parentRelationship:inContext:operations:shouldContinueBlock:objectJSONBlock:) + 691
4   org.cocoapods.Sync            	0x000000010465e132 partial apply for closure #2 in static Sync.changes(_:inEntityNamed:predicate:parent:parentRelationship:inContext:operations:shouldContinueBlock:objectJSONBlock:) + 66
5   org.cocoapods.Sync            	0x00000001046065ce static DataFilter.changes(_:inEntityNamed:predicate:operations:localPrimaryKey:remotePrimaryKey:context:inserted:updated:) + 7406
6   org.cocoapods.Sync            	0x000000010465b56d static Sync.changes(_:inEntityNamed:predicate:parent:parentRelationship:inContext:operations:shouldContinueBlock:objectJSONBlock:) + 3309
7   org.cocoapods.Sync            	0x000000010464a89d static Sync.changes(_:inEntityNamed:predicate:parent:parentRelationship:inContext:operations:completion:) + 589
8   org.cocoapods.Sync            	0x000000010464b4c2 NSManagedObjectContext.sync(_:inEntityNamed:predicate:parent:completion:) + 242
9   com.viktorstrate.Time-Agent   	0x00000001043ca070 FileSync.load() + 3776 (FileSync.swift:107)
10  com.viktorstrate.Time-Agent   	0x00000001043b9ea7 ProjectViewController.syncAction(_:) + 279 (ProjectViewController.swift:188)
11  com.viktorstrate.Time-Agent   	0x00000001043b9f10 @objc ProjectViewController.syncAction(_:) + 80
12  com.apple.AppKit              	0x00007fff2c0b4437 -[NSApplication(NSResponder) sendAction:to:from:] + 299
13  com.apple.AppKit              	0x00007fff2c0b42d2 -[NSControl sendAction:to:] + 86
14  com.apple.AppKit              	0x00007fff2c0b4204 __26-[NSCell _sendActionFrom:]_block_invoke + 136
15  com.apple.AppKit              	0x00007fff2c0b4106 -[NSCell _sendActionFrom:] + 171
16  com.apple.AppKit              	0x00007fff2c0b404d -[NSButtonCell _sendActionFrom:] + 96
17  com.apple.AppKit              	0x00007fff2c0b032b NSControlTrackMouse + 1745
18  com.apple.AppKit              	0x00007fff2c0afc32 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 130
19  com.apple.AppKit              	0x00007fff2c0afaf1 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 691
20  com.apple.AppKit              	0x00007fff2c0aee6d -[NSControl mouseDown:] + 748
21  com.apple.AppKit              	0x00007fff2c0ad280 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4914
22  com.apple.AppKit              	0x00007fff2c017a81 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
23  com.apple.AppKit              	0x00007fff2c016e29 -[NSWindow(NSEventRouting) sendEvent:] + 349
24  com.apple.AppKit              	0x00007fff2c0151b4 -[NSApplication(NSEvent) sendEvent:] + 352
25  com.apple.AppKit              	0x00007fff2be6221f -[NSApplication run] + 707
26  com.apple.AppKit              	0x00007fff2be33ff6 NSApplicationMain + 777
27  com.viktorstrate.Time-Agent   	0x00000001043e0c4d main + 13 (AppDelegate.swift:12)
28  libdyld.dylib                 	0x00007fff68b3bcc9 start + 1

Thread 1:
0   libsystem_pthread.dylib       	0x00007fff68d3bb68 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	0x00007fff68d3bb68 start_wqthread + 0

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

Thread 4:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	0x00007fff68c7cdfa mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff68c7d170 mach_msg + 60
2   com.apple.CoreFoundation      	0x00007fff2ebf50b5 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation      	0x00007fff2ebf3b82 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation      	0x00007fff2ebf2ffe CFRunLoopRunSpecific + 462
5   com.apple.AppKit              	0x00007fff2c0135b4 _NSEventThread + 132
6   libsystem_pthread.dylib       	0x00007fff68d40109 _pthread_start + 148
7   libsystem_pthread.dylib       	0x00007fff68d3bb8b thread_start + 15

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

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

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

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000200000002  rbx: 0x00007f977b859000  rcx: 0xfffffffe00000000  rdx: 0x0000000000000002
  rdi: 0x00007f977b859008  rsi: 0x0000000000000600  rbp: 0x00007ffeeb861380  rsp: 0x00007ffeeb861330
   r8: 0x0000000000008001   r9: 0x00007f977a0b7000  r10: 0x00007f977a0b7000  r11: 0x00007f977a000000
  r12: 0x0000000000000000  r13: 0x0000000000000001  r14: 0x0000000000002d02  r15: 0x00007fff684e80c5
  rip: 0x00007fff6819730f  rfl: 0x0000000000010246  cr2: 0x00000001046f9000
  
Logical CPU:     2
Error Code:      0x00000000
Trap Number:     6


Binary Images:
       0x10439a000 -        0x104419fff +com.viktorstrate.Time-Agent (1.0 - 1) <E09A9FAB-994E-3351-8D5E-4CBEF21282F4> /Users/USER/Library/Developer/Xcode/DerivedData/Time_Agent-dlaquvzanbkahmflfxhuzthjmijx/Build/Products/Debug/Time Agent.app/Contents/MacOS/Time Agent
       0x1044c4000 -        0x1044daff7 +org.cocoapods.PathKit (0.9.2 - 1) <32EEA760-ED35-365E-A1F8-75B0709D2162> /Users/USER/Library/Developer/Xcode/DerivedData/Time_Agent-dlaquvzanbkahmflfxhuzthjmijx/Build/Products/Debug/Time Agent.app/Contents/Frameworks/PathKit.framework/Versions/A/PathKit
       0x10450c000 -        0x104570fff +org.cocoapods.Stencil (0.13.1 - 1) <167FBF85-D2F9-3A10-8218-C63189B315D7> /Users/USER/Library/Developer/Xcode/DerivedData/Time_Agent-dlaquvzanbkahmflfxhuzthjmijx/Build/Products/Debug/Time Agent.app/Contents/Frameworks/Stencil.framework/Versions/A/Stencil
       0x1045f7000 -        0x10466bff7 +org.cocoapods.Sync (6.0.0 - 1) <6DB62867-60BE-38B9-B1EB-15D2ABCBA860> /Users/USER/Library/Developer/Xcode/DerivedData/Time_Agent-dlaquvzanbkahmflfxhuzthjmijx/Build/Products/Debug/Time Agent.app/Contents/Frameworks/Sync.framework/Versions/A/Sync
       0x106f99000 -        0x106f9c047  libobjc-trampolines.dylib (787.1) <CCA8AC98-12A2-3984-ACD6-1D77DAD6C0AD> /usr/lib/libobjc-trampolines.dylib

Edit:
It's also tested with the newest version of Sync v6.0.3, with the exact same output

@3lvis
Copy link
Owner

3lvis commented Oct 4, 2020

Hi @viktorstrate, sorry for not following up earlier. I tried building your app and wasn't able to do so.

From the logs I believe some of the JSON is sending an empty createdAt date or a createdAt format that it's not parsable and it's crashing because it has been marked as a required attribute.

If you mark it as optional or make sure a proper date is always provided then it should be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants