Skip to content

Conversation

@ktoso
Copy link
Member

@ktoso ktoso commented Aug 29, 2019

With removal of fault handling in #51 we need something to print backtraces

Motivation:

  • we need backtraces to keep sane ¯\(ツ)
  • We should rely on and help improve swift-backtrace.

Modifications:

Use the Backtrace library.

Result:

Nice backtraces.

Fatal error: Failing on purpose: file /code/Tests/DistributedActorsTests/ActorDeferTests.swift, line 54
Current stack trace:
0    libswiftCore.so                    0x00007f7027fa43c0 swift_reportError + 50
1    libswiftCore.so                    0x00007f70280150b0 _swift_stdlib_reportFatalErrorInFile + 115
2    libswiftCore.so                    0x00007f7027f3951e <unavailable> + 3515678
3    libswiftCore.so                    0x00007f7027f39697 <unavailable> + 3516055
4    libswiftCore.so                    0x00007f7027d2ee3d <unavailable> + 1375805
5    libswiftCore.so                    0x00007f7027f10478 <unavailable> + 3347576
6    libswiftCore.so                    0x00007f7027d2e1d9 <unavailable> + 1372633
7    swift-distributed-actorsPackageTests.xctest 0x00005605c639bb49 <unavailable> + 6896457
8    swift-distributed-actorsPackageTests.xctest 0x00005605c639be49 <unavailable> + 6897225
9    swift-distributed-actorsPackageTests.xctest 0x00005605c632d6bc <unavailable> + 6444732
10   swift-distributed-actorsPackageTests.xctest 0x00005605c639c2f4 <unavailable> + 6898420
11   swift-distributed-actorsPackageTests.xctest 0x00005605c603270e <unavailable> + 3319566
12   swift-distributed-actorsPackageTests.xctest 0x00005605c62c70a5 <unavailable> + 6025381
13   swift-distributed-actorsPackageTests.xctest 0x00005605c62c5c11 <unavailable> + 6020113
14   swift-distributed-actorsPackageTests.xctest 0x00005605c62c5861 <unavailable> + 6019169
15   swift-distributed-actorsPackageTests.xctest 0x00005605c5ffaf08 <unavailable> + 3092232
16   swift-distributed-actorsPackageTests.xctest 0x00005605c61cf0fd <unavailable> + 5009661
17   swift-distributed-actorsPackageTests.xctest 0x00005605c61cf4bf <unavailable> + 5010623
18   swift-distributed-actorsPackageTests.xctest 0x00005605c61cd8fa <unavailable> + 5003514
19   swift-distributed-actorsPackageTests.xctest 0x00005605c61cd5cd <unavailable> + 5002701
20   swift-distributed-actorsPackageTests.xctest 0x00005605c61cdbc9 <unavailable> + 5004233
21   swift-distributed-actorsPackageTests.xctest 0x00005605c5e01ef4 <unavailable> + 1023732
22   swift-distributed-actorsPackageTests.xctest 0x00005605c61d3e78 <unavailable> + 5029496
23   swift-distributed-actorsPackageTests.xctest 0x00005605c602c5cc <unavailable> + 3294668
24   swift-distributed-actorsPackageTests.xctest 0x00005605c61c23f1 <unavailable> + 4957169
25   swift-distributed-actorsPackageTests.xctest 0x00005605c602c9cc <unavailable> + 3295692
26   swift-distributed-actorsPackageTests.xctest 0x00005605c61c1e71 <unavailable> + 4955761
27   swift-distributed-actorsPackageTests.xctest 0x00005605c62da327 <unavailable> + 6103847
28   swift-distributed-actorsPackageTests.xctest 0x00005605c62dafd8 <unavailable> + 6107096
29   swift-distributed-actorsPackageTests.xctest 0x00005605c62db089 <unavailable> + 6107273
30   libpthread.so.0                    0x00007f70279c96ba <unavailable> + 30394
31   libc.so.6                          0x00007f7025fd83b0 clone + 109
0x5605c5ddabc9, closure #1 (Swift.Int32) -> () in static Backtrace.Backtrace.install() -> () at /code/.build/checkouts/swift-backtrace/Sources/Backtrace/Backtrace.swift:53
0x5605c5ddabe8, @objc closure #1 (Swift.Int32) -> () in static Backtrace.Backtrace.install() -> () at /code/<compiler-generated>:0
0x7f70279d338f
0x7f7027f10485
0x7f7027d2e1d8
0x5605c639bb48, closure #1 (DistributedActors.ActorContext<Swift.String>, Swift.String) throws -> DistributedActors.Behavior<Swift.String> in DistributedActorsTests.ActorDeferTests.receiveDeferBehavior(_: DistributedActors.ActorRef<Swift.String>, deferUntil: DistributedActors.DeferUntilWhen, whenActor: DistributedActorsTests.ActorDeferTests.ReductionReaction) -> DistributedActors.Behavior<Swift.String> at /code/Tests/DistributedActorsTests/ActorDeferTests.swift:54
0x5605c639be48, partial apply forwarder for closure #1 (DistributedActors.ActorContext<Swift.String>, Swift.String) throws -> DistributedActors.Behavior<Swift.String> in DistributedActorsTests.ActorDeferTests.receiveDeferBehavior(_: DistributedActors.ActorRef<Swift.String>, deferUntil: DistributedActors.DeferUntilWhen, whenActor: DistributedActorsTests.ActorDeferTests.ReductionReaction) -> DistributedActors.Behavior<Swift.String> at /code/<compiler-generated>:0
0x5605c632d6bb, reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed DistributedActors.ActorContext<Swift.String>, @guaranteed Swift.String) -> (@owned DistributedActors.Behavior<Swift.String>, @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed DistributedActors.ActorContext<Swift.String>, @in_guaranteed Swift.String) -> (@owned DistributedActors.Behavior<Swift.String>, @error @owned Swift.Error) at /code/<compiler-generated>:0
0x5605c639c2f3, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed DistributedActors.ActorContext<Swift.String>, @guaranteed Swift.String) -> (@owned DistributedActors.Behavior<Swift.String>, @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed DistributedActors.ActorContext<Swift.String>, @in_guaranteed Swift.String) -> (@owned DistributedActors.Behavior<Swift.String>, @error @owned Swift.Error) at /code/<compiler-generated>:0
0x5605c603270d, DistributedActors.Behavior.interpretMessage(context: DistributedActors.ActorContext<A>, message: A, file: Swift.StaticString, line: Swift.UInt) throws -> DistributedActors.Behavior<A> at /code/Sources/DistributedActors/Behaviors.swift:499
0x5605c62c70a4, DistributedActors.Supervisor.interpretSupervised0(target: DistributedActors.Behavior<A>, context: DistributedActors.ActorContext<A>, processingAction: DistributedActors.ProcessingAction<A>, nFoldFailureDepth: Swift.Int) throws -> DistributedActors.Behavior<A> at /code/Sources/DistributedActors/Supervision.swift:434
0x5605c62c5c10, DistributedActors.Supervisor.interpretSupervised0(target: DistributedActors.Behavior<A>, context: DistributedActors.ActorContext<A>, processingAction: DistributedActors.ProcessingAction<A>) throws -> DistributedActors.Behavior<A> at /code/Sources/DistributedActors/Supervision.swift:423
0x5605c62c5860, DistributedActors.Supervisor.interpretSupervised(target: DistributedActors.Behavior<A>, context: DistributedActors.ActorContext<A>, message: A) throws -> DistributedActors.Behavior<A> at /code/Sources/DistributedActors/Supervision.swift:393
0x5605c5ffaf07, DistributedActors.ActorShell.interpretMessage(message: A) throws -> __C.SActActorRunResult at /code/Sources/DistributedActors/ActorShell.swift:260
0x5605c61cf0fc, closure #4 (Swift.UnsafeMutableRawPointer, Swift.UnsafeMutableRawPointer, __C.SActMailboxRunPhase) throws -> __C.SActActorRunResult in DistributedActors.Mailbox.init(shell: DistributedActors.ActorShell<A>, capacity: Swift.UInt32, maxRunLength: Swift.UInt32) -> DistributedActors.Mailbox<A> at /code/Sources/DistributedActors/Mailbox.swift:205
0x5605c61cf4be, partial apply forwarder for closure #4 (Swift.UnsafeMutableRawPointer, Swift.UnsafeMutableRawPointer, __C.SActMailboxRunPhase) throws -> __C.SActActorRunResult in DistributedActors.Mailbox.init(shell: DistributedActors.ActorShell<A>, capacity: Swift.UInt32, maxRunLength: Swift.UInt32) -> DistributedActors.Mailbox<A> at /code/<compiler-generated>:0
0x5605c61cd8f9, DistributedActors.(InterpretMessageClosureContext in _F5A1B51A24FD9930199EBF91BB3C2562).exec(cellPtr: Swift.UnsafeMutableRawPointer, messagePtr: Swift.UnsafeMutableRawPointer, runPhase: __C.SActMailboxRunPhase) throws -> __C.SActActorRunResult at /code/Sources/DistributedActors/Mailbox.swift:638
0x5605c61cd5cc, closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Optional<Swift.UnsafeMutableRawPointer>, __C.SActMailboxRunPhase) -> __C.SActActorRunResult in DistributedActors.Mailbox.init(shell: DistributedActors.ActorShell<A>, capacity: Swift.UInt32, maxRunLength: Swift.UInt32) -> DistributedActors.Mailbox<A> at /code/Sources/DistributedActors/Mailbox.swift:139
0x5605c61cdbc8, @objc closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Optional<Swift.UnsafeMutableRawPointer>, Swift.Optional<Swift.UnsafeMutableRawPointer>, __C.SActMailboxRunPhase) -> __C.SActActorRunResult in DistributedActors.Mailbox.init(shell: DistributedActors.ActorShell<A>, capacity: Swift.UInt32, maxRunLength: Swift.UInt32) -> DistributedActors.Mailbox<A> at /code/<compiler-generated>:0
0x5605c5e01ef3, cmailbox_run at Sources/CDistributedActorsMailbox/c_mailbox.c:380
0x5605c61d3e77, DistributedActors.Mailbox.run() -> () at /code/Sources/DistributedActors/Mailbox.swift:476
0x5605c602c5cb, reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) at /code/<compiler-generated>:0
0x5605c61c23f0, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) at /code/<compiler-generated>:0
0x5605c602c9cb, reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out ()) to @escaping @callee_guaranteed () -> () at /code/<compiler-generated>:0
0x5605c61c1e70, closure #1 () -> () in DistributedActors.FixedThreadPool.init(Swift.Int) throws -> DistributedActors.FixedThreadPool at /code/Sources/DistributedActors/FixedThreadPool.swift:75
0x5605c62da326, closure #1 () -> () in DistributedActors.Thread.init(() -> ()) throws -> DistributedActors.Thread at /code/Sources/DistributedActors/Thread.swift:53
0x5605c62dafd7, closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in static DistributedActors.Thread.runnerCallback.getter : (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> at /code/Sources/DistributedActors/Thread.swift:132
0x5605c62db088, @objc closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in static DistributedActors.Thread.runnerCallback.getter : (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> at /code/<compiler-generated>:0
0x7f70279c96b9
0x7f7025fd841c
0xffffffffffffffff
Exited with signal code 4

@ktoso ktoso requested a review from drexin August 29, 2019 03:37
@ktoso
Copy link
Member Author

ktoso commented Aug 29, 2019

Merge after #51 please.

@ktoso
Copy link
Member Author

ktoso commented Aug 29, 2019

The failure is expected -- it hijacked a fault-ing on purpose test.

@ktoso
Copy link
Member Author

ktoso commented Aug 29, 2019

Rebasing...

@ktoso
Copy link
Member Author

ktoso commented Aug 29, 2019

As we don't have fault tests anymore this should now pass 👍

@drexin drexin merged commit ce2c82a into apple:master Aug 29, 2019
ktoso added a commit that referenced this pull request Aug 31, 2019
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

Successfully merging this pull request may close these issues.

2 participants