im currently investigating what i think is a compiler concurrency bug. it only happens:
- on the 5.7.3 release toolchain (5.8 branch is unaffected)
- on release builds (debug builds are unaffected)
it has something to do with coalescing a try result.get() with the return value of an async function call, like:
try await self.getResult().get()
the segfault can be prevented by placing print statements on both sides of the async function call.
print("_")
let result = await self.getResult()
print("_")
return try result.get()
this only seems to work if the print function prints at least one character to standard output.
i tried replacing the print("_")s with:
- a call to an
@inline(never) function in the same module
- a call to an
@inline(never) function in a different module
but neither of those things worked the way print("_") does.
has anyone else run into something like this?
2 Likes
etcwilde
(Evan Wilde)
2
Is this on Linux or all OS's? And is this with a statically linked or dynamically linked standard library? I know we've been having some issues with concurrency + statically linked runtimes/stdlib + Linux and this looks similar. I'm still not entirely sure what it is though. If you have a small reproducer so that I can poke at it a bit, that would be great.
3 Likes
I have seen the crash that @etcwilde has been hinting at. Just some more questions to see if it is the same. Do you have a stack trace when you get the segfault? Is your async method taking a continuation in this case?