instacart / TrueTime.swift

NTP library for Swift and Objective-C. Get the true time impervious to device clock changes.
https://tech.instacart.com/truetime/
Apache License 2.0
588 stars 130 forks source link

Crash on start #40

Open yehoshuanagel opened 6 years ago

yehoshuanagel commented 6 years ago

We seem to be experiencing a crash due to TrueTime on launch:

screen shot 2017-10-02 at 10 23 42 am

Very possibly due to poor network conditions when attempting to start. Any ideas?

msanders commented 6 years ago

@yehoshuanagel: Thanks for the report. What version are you seeing this on?

MarcelYipYip commented 6 years ago

I am also experiencing issues like this. A live app is seeing a lot of crash reports since my last version. I've been able to get some more information on the issue:

I'm currently applying a quick hack in my project to omit this problem, but it would be great if it can be fixed, since TrueTime has otherwise been performing greatly! Any help would be much appreciated :)

msanders commented 6 years ago

@MarcelYipYip: Thanks for the report, we're looking into this. We're still moving over to Xcode 9 so hadn't run into it yet.

otymartin commented 6 years ago

@msanders Experienced this today in xcode 9 occured here

var canRetry: Bool {
        var canRetry: Bool = false
        lockQueue.sync {
            canRetry = self.attempts < self.maxRetries && !self.didTimeout && !self.finished
        }
        return canRetry
    }

Here is the stop reason

* thread #30, queue = 'com.instacart.ntp.client', stop reason = EXC_BAD_ACCESS (code=1, address=0x55555555555555c7)
    frame #0: 0x0000000105012db4 libdispatch.dylib`dispatch_sync_f + 12
  * frame #1: 0x00000001027134b8 TrueTime`NTPConnection.canRetry.getter(self=0x0000000109be7610) at NTPConnection.swift:69
    frame #2: 0x0000000102713384 TrueTime`closure #1 in closure #3 in static NTPConnection.query($0=0x0000000109be7610) at NTPConnection.swift:42
    frame #3: 0x0000000102713500 TrueTime`thunk for @callee_owned (@owned NTPConnection) -> (@unowned Bool, @error @owned Error) at NTPConnection.swift:0
    frame #4: 0x000000010271b53c TrueTime`partial apply for thunk for @callee_owned (@owned NTPConnection) -> (@unowned Bool, @error @owned Error) at NTPConnection.swift:0
    frame #5: 0x000000010467e848 libswiftCore.dylib`function signature specialization <preserving fragile attribute, Arg[0] = Owned To Guaranteed> of (extension in Swift):Swift._ArrayProtocol.filter((A.Element) throws -> Swift.Bool) throws -> Swift.Array<A.Element> + 488
    frame #6: 0x0000000104479258 libswiftCore.dylib`(extension in Swift):Swift._ArrayProtocol.filter((A.Element) throws -> Swift.Bool) throws -> Swift.Array<A.Element> + 24
    frame #7: 0x0000000102712f98 TrueTime`closure #3 in static NTPConnection.query(connections=20 values, config=TrueTime.NTPConfig @ 0x000000016ed4e468, callbackQueue=0x0000000106702e40, onComplete=0x0000000102712e24 TrueTime`partial apply forwarder for closure #2 (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> () in static TrueTime.NTPConnection.query(addresses: Swift.Array<TrueTime.SocketAddress>, config: TrueTime.NTPConfig, logger: Swift.Optional<(Swift.String) -> ()>, callbackQueue: __ObjC.DispatchQueue, progress: (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> ()) -> Swift.Array<TrueTime.NTPConnection> at NTPConnection.swift) at NTPConnection.swift:42
    frame #8: 0x00000001027132d8 TrueTime`partial apply for closure #3 in static NTPConnection.query(addresses:config:logger:callbackQueue:progress:) at NTPConnection.swift:0
    frame #9: 0x0000000102712d3c TrueTime`closure #2 in static NTPConnection.query(connection=0x0000000109be8370, result=success, progress=0x00000001027102cc TrueTime`partial apply forwarder for closure #1 (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> () in TrueTime.NTPClient.(query in _1287656FA7524B1873A8558648EF240C)(addresses: Swift.Array<TrueTime.SocketAddress>, pool: Foundation.URL) -> () at NTPClient.swift, throttleConnections=0x000000010271322c TrueTime`partial apply forwarder for closure #3 () -> () in static TrueTime.NTPConnection.query(addresses: Swift.Array<TrueTime.SocketAddress>, config: TrueTime.NTPConfig, logger: Swift.Optional<(Swift.String) -> ()>, callbackQueue: __ObjC.DispatchQueue, progress: (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> ()) -> Swift.Array<TrueTime.NTPConnection> at NTPConnection.swift) at NTPConnection.swift:38
    frame #10: 0x000000010271736c TrueTime`closure #1 in NTPConnection.complete(onComplete=0x0000000102712e24 TrueTime`partial apply forwarder for closure #2 (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> () in static TrueTime.NTPConnection.query(addresses: Swift.Array<TrueTime.SocketAddress>, config: TrueTime.NTPConfig, logger: Swift.Optional<(Swift.String) -> ()>, callbackQueue: __ObjC.DispatchQueue, progress: (TrueTime.NTPConnection, Result.Result<TrueTime.FrozenNetworkTime, __ObjC.NSError>) -> ()) -> Swift.Array<TrueTime.NTPConnection> at NTPConnection.swift, self=0x0000000109be8370, result=success) at NTPConnection.swift:207
    frame #11: 0x000000010271aa7c TrueTime`partial apply for closure #1 in NTPConnection.complete(_:) at NTPConnection.swift:0
    frame #12: 0x00000001027000c0 TrueTime`thunk for @callee_owned () -> () at GCDLock.swift:0
    frame #13: 0x000000010500da50 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #14: 0x000000010500da10 libdispatch.dylib`_dispatch_client_callout + 16
    frame #15: 0x000000010501b2e8 libdispatch.dylib`_dispatch_queue_serial_drain + 1140
    frame #16: 0x0000000105011634 libdispatch.dylib`_dispatch_queue_invoke + 852
    frame #17: 0x000000010501b810 libdispatch.dylib`_dispatch_queue_override_invoke + 404
    frame #18: 0x000000010501d630 libdispatch.dylib`_dispatch_root_queue_drain + 552
    frame #19: 0x000000010501d39c libdispatch.dylib`_dispatch_worker_thread3 + 140
    frame #20: 0x0000000180707100 libsystem_pthread.dylib`_pthread_wqthread + 1096
    frame #21: 0x0000000180706cac libsystem_pthread.dylib`start_wqthread + 4
SalvatoreAD commented 6 years ago

I have the same crash

ShimaaMagdii commented 5 years ago

@msanders I am also experiencing the same issue, we support ios 10 and use pod version 5.0.0

screen shot 2019-02-28 at 6 17 28 pm