Closed marius-se closed 1 year ago
I’m not sure why this is crashing out in the tests, all tests pass when I run from Xcode.
On the macOS run it errored out with:
NIOPosix/ThreadPosix.swift:109: Precondition failed: Unable to create thread: 35
Yeah I got the same results. Locally the tests passed on macOS and Linux/Docker. Which Xcode version are you using? I'm on 14.1.
Maybe try triggering the actions again?
14.2 which is what is on GitHub Actions
nope, that didn't help unfortunately
I actually got the same error running the tests using Xcode 14.3 on my MBP.
NIOPosix/ThreadPosix.swift:109: Precondition failed: Unable to create thread: 35
Hi, I managed to fix the crash NIOPosix/ThreadPosix.swift:109: Precondition failed: Unable to create thread: 35
by adding some missing app.shutdown()
across the tests.
Here the commit that fix the crashing test issue on Xcode 96113206d6e2b4c62103e03108ed11155558732d (from this fork), I am not sure if I need to do a pull request for this fix or if you can cherry-pick my changes.
@alexandre-pod if you can create a PR into the fix/token_scope_test
that would be great!
@alexandre-pod if you can create a PR into the
fix/token_scope_test
that would be great!
Its created: https://github.com/brokenhandsio/vapor-oauth/pull/15
@marius-se looks like we have a CI failure now
I had tried running the tests from ubuntu and it worked, but it seems than when launching the test from ubuntu inside docker the tests crash with this error. I will try to have a look at it
NIOPosix/ThreadPosix.swift:109: Precondition failed: Unable to create thread: 11
After some investigation I was able to reproduce the issue, for that I needed to use Ubuntu 22.04.2 and it only occurs on x86 arch (The test were working on a ubuntu VM on Apple silicon).
4 tests are causing a crash:
AuthorizationResponseTests.testThatRedirectURIMustBeHTTPSForProduction
ImplicitGrantTests.testThatRedirectURIMustBeHTTPSForProduction
ImplicitGrantTests.testThatUserIDIsSetOnToken
ImplicitGrantTests.testThatUserMustBeLoggedInWhenMakingImplicitTokenRequest
The crash is a segmentation fault that seems to occur when capturing the stack trace during the creation of the default Abort
error while creating OAuthUser.guardMiddleware()
in OAuth2.swift
.
I have found different solution to make the tests pass on Linux:
StackTrace.isCaptureEnabled = false
)OAuthUser.guardMiddleware(throwing: Abord(.unauthorized, reason: "\(OAuthUser.self) not authenticated", stackTrace: nil))
)try await Task.sleep(nanosecond: 1)
just after having created the application. (This change be seen working in this action runner logs)As I am not used to develop and debug swift app on Linux, I am out of ideas to try finding the real root cause of this issue. If anyone has an idea on how to properly fix those tests, let me know.
For now let me know if one of the "fix" I proposed is good enough for you to be added to the tests and finally merge this pull request.
Okay at this point I'm also out of ideas. @alexandre-pod
and maybe the stranger one (and the better maybe ?) : add in those 4 failing tests a try await Task.sleep(nanosecond: 1)
Let's try this then? Seems like a bug, so we could easily remove this in the future
Here the PR with the fix #16 @marius-se
Looks like I accidentally removed an else block during the Vapor 4 migration.