I switched from Carthage to Swift Package Manager for integrating Quick and Nimble into a project. My tests use toEventually() in some places.
toEventually() should either finish or timeout eventually.
toEventually() never stops, it polls forever and doesn't even timeout. I tried to debug the issue by setting a breakpoint in AwaitPromise.resolveResult() https://github.com/Quick/Nimble/blob/9a4564effa6607cd571adbccf990bb0e6f8558db/Sources/Nimble/Utils/Await.swift#L118-L125
however, the code seems to never be executed. I also set a breakpoint here https://github.com/Quick/Nimble/blob/9a4564effa6607cd571adbccf990bb0e6f8558db/Sources/Nimble/Utils/Await.swift#L330 and observed that the line is called which is really strange.
When executing tests in Release configuration everything works as expected so I assume this is a compiler bug.
List the software versions you're using:
Xcode Default.)Please also mention which package manager you used and its version. Delete the
other package managers in this list:
Swift Package Manager 5.1.0 (swiftpm-15502) (Use swift build --version in Terminal)
Thanks for moving this to the correct place!
I can verify that running the tests with release configuration works, but I use a mock library that resolves function addresses in a way that fails when tests run in release configuration.
Yes, me mentioning that it works in release configuration was not meant as a solution but more of an information to be able to track down the issue. I'd also try to fix it myself but I don't really know where to start here and currently don't have the time to further investigate so would be happy if somebody could look into this in more detail.
Sorry, that was not how I meant it. I rather meant that the release approach could have worked as a workaround until this is fixed (which would make it a less blocking bug), but that it doesn't work due to the mock problems.
I am seeing this same issue using SPM and only on Xcode 11.2. Prior to updating to 11.2 there was no issues, which makes me think @tomquist may be right about this being a compiler bug.
After more experimentation, setting DEAD_CODE_STRIPPING = NO fixed the issue, so I think the root cause is the compiler bug SR-11564. I guess disabling dead code stripping is the workaround until this is fixed.
I already have dead code stripping disabled for my framework and test target, and it hangs.
@tomquist This is no longer a problem in Xcode 11.3. toEventually works great.
@danielsaidi Yes, can confirm but I'd still merge this PR since it
Yeah, it would be great to get it merged. I wonder what's going on with the radio silence?
v8.0.5 has been released.
@ikesyo Great! However, CwlPreconditionTesting still crashes, like we've discussed before. You said that replacing that it requires a major version bump, right?
I'm still getting hanging forever on Xcode 11.3 with Nimble v8.0.5. Mine is happening on waitUntil though.
Can we re-open this and investigate further, or should I make a new ticket?
Stacktrace:
#0 0x00007fff523b621a in mach_msg_trap ()
#1 0x00007fff523b67f8 in mach_msg ()
#2 0x00007fff23bd3cf5 in __CFRunLoopServiceMachPort ()
#3 0x00007fff23bcea17 in __CFRunLoopRun ()
#4 0x00007fff23bce066 in CFRunLoopRunSpecific ()
#5 0x00007fff2576b86f in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#6 0x000000010f217cc5 in closure #3 in AwaitPromiseBuilder.wait(_:file:line:) at ~/Documents/repo/project/Pods/Nimble/Sources/Nimble/Utils/Await.swift:261
#7 0x000000010f20e96c in thunk for @callee_guaranteed () -> () ()
#8 0x000000010f20e9d1 in thunk for @escaping @callee_guaranteed () -> () ()
#9 0x000000010f208ff8 in -[NMBExceptionCapture tryBlock:] at ~/Documents/repos/project/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m:21
#10 0x000000010f217770 in AwaitPromiseBuilder.wait(_:file:line:) at ~/Documents/repos/project/Pods/Nimble/Sources/Nimble/Utils/Await.swift:251
#11 0x000000010f249879 in static NMBWait.throwableUntil(timeout:file:line:action:) at ~/Documents/repos/project/Pods/Nimble/Sources/Nimble/DSL+Wait.swift:67
#12 0x000000010f2492d1 in static NMBWait.until(timeout:file:line:action:) at ~/Documents/repos/project/Pods/Nimble/Sources/Nimble/DSL+Wait.swift:24
#13 0x000000010f24b6ac in waitUntil(timeout:file:line:action:) at ~/Documents/repos/project/Pods/Nimble/Sources/Nimble/DSL+Wait.swift:121
@AnthonyMDev would be great if you could create a PR with a test case that produces this bug when run using ./test ios_xcodespm
I'll try my best. I've got a complicated test suite and it's happening semi-sporadically so not sure how to reproduce it... I'll update you.
@tomquist Looks like this is already reported and an open issue. https://github.com/Quick/Nimble/issues/509
Can we track this there? It's open, but is not active recently.
The issue @AnthonyMDev is facing seems like a duplicate of #509.