Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swift-5.3-RELEASE
md5: 632ca2b1f3a11eb0fbba76200cb815ef
Issue Description:
Running the program at bottom sometimes prints:
hello
Occasionally, it prints:
hello BlockExperiment world
However, the following crash consistently reproduces on a Mac and Linux machine:
hello BlockExperiment/usr/bin/swift[0x51f95a4] /usr/bin/swift[0x51f719e] /usr/bin/swift[0x51f987c] /lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7fc7c0650980] /usr/lib/swift/linux/libswiftCore.so(+0x40d2c4)[0x7fc7bc9642c4] /usr/lib/swift/linux/libswiftCore.so(+0x3fecc6)[0x7fc7bc955cc6] /usr/lib/swift/linux/libswiftCore.so(+0x3fe20b)[0x7fc7bc95520b] /usr/lib/swift/linux/libswiftCore.so(+0x3e456d)[0x7fc7bc93b56d]
(I thought there might be a race condition in my code, so I asked about it on StackOverflow: https://stackoverflow.com/questions/64903208/is-this-crash-in-a-swift-script-caused-by-a-race-condition)
To reproduce, run this script:
import Foundation final class BlockRunner { var block: () -> () init(_ b: @escaping () -> ()) { block = b } func run() { block() } deinit { print("Deinit: \(self)") } } final class BlockExperiment { func f() { let queue = DispatchQueue(label: "Queue") let runner = BlockRunner { print("hello", self, "world") } queue.asyncAfter(deadline: .now() + 1) { runner.run() } } deinit { print("Deinit: \(self)") } } do { let e = BlockExperiment() e.f() RunLoop.current.run(until: Date() + 1 + 0.000000000000001) }
The text was updated successfully, but these errors were encountered:
@swift-ci create
Sorry, something went wrong.
The indeterministic output is easily explainable.
Though, I could not reproduce the crash (on Mac). Could you reproduce the crash on Mac?
No branches or pull requests
Environment
swift-5.3-RELEASE
Additional Detail from JIRA
md5: 632ca2b1f3a11eb0fbba76200cb815ef
Issue Description:
Running the program at bottom sometimes prints:
Occasionally, it prints:
However, the following crash consistently reproduces on a Mac and Linux machine:
(I thought there might be a race condition in my code, so I asked about it on StackOverflow: https://stackoverflow.com/questions/64903208/is-this-crash-in-a-swift-script-caused-by-a-race-condition)
To reproduce, run this script:
The text was updated successfully, but these errors were encountered: