Commit fef8c0d
Fix for swift test : _Concurrency/Executor.swift:357: Fatal error (#639)
Fix the issue described at
#640
Here is the proposed fix:
I added a new function `assumeIsolatedOnEventLoop` — a nonisolated
method that:
1. Calls `self.eventLoop.preconditionInEventLoop()` to verify we're on
the correct event loop (NIO's own thread-identity check, which always
works)
2. Uses `unsafeBitCast` to strip the isolated annotation, the same
pattern NIO uses internally and that I found on the Swift Forums.
See:
https://github.com/swiftlang/swift/blob/main/stdlib/public/Concurrency/ExecutorAssertions.swift#L348
See:
https://forums.swift.org/t/actor-assumeisolated-erroneously-crashes-when-using-a-dispatch-queue-as-the-underlying-executor/72434/3
---------
Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent a8a54d9 commit fef8c0d
File tree
1 file changed
+29
-3
lines changed- Sources/AWSLambdaRuntime/HTTPClient
1 file changed
+29
-3
lines changedLines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
136 | 162 | | |
137 | 163 | | |
138 | 164 | | |
| |||
435 | 461 | | |
436 | 462 | | |
437 | 463 | | |
438 | | - | |
439 | | - | |
| 464 | + | |
| 465 | + | |
440 | 466 | | |
441 | 467 | | |
442 | 468 | | |
| |||
483 | 509 | | |
484 | 510 | | |
485 | 511 | | |
486 | | - | |
| 512 | + | |
487 | 513 | | |
488 | 514 | | |
489 | 515 | | |
| |||
0 commit comments