-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
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
_NIOFileSystem crash in swift v6 #2743
Comments
Can you please attach a crash report or backtrace? You can find crash reports in Console.app. |
swift package edit swift-nio Go to Edit the public func info(
forFileAt path: FilePath,
infoAboutSymbolicLink: Bool
) async throws -> FileInfo? {
+ print("FileSystem::info() #1")
return try await threadPool.runIfActive {
+ print("FileSystem::info() #2")
- try self._info(forFileAt: path, infoAboutSymbolicLink: infoAboutSymbolicLink).get()
+ return try self._info(forFileAt: path, infoAboutSymbolicLink: infoAboutSymbolicLink).get()
}
} No run again: ~/d/P/s/swift-nio-crash ❮❮❮ /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.xctoolchain/usr/bin/swift run
warning: 'swift-system': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/Users/patwoz/dev/Personal/swift/swift-nio-crash/.build/checkouts/swift-system/Sources/System/CMakeLists.txt
Building for debugging...
/Users/patwoz/dev/Personal/swift/swift-nio-crash/Packages/swift-nio/Sources/NIOFileSystem/Internal/BufferedStream.swift:247:9: warning: @frozen has no effect on non-public enums
245 |
246 | /// A type that indicates the result of writing elements to the source.
247 | @frozen
| `- warning: @frozen has no effect on non-public enums
248 | internal enum WriteResult: Sendable {
249 | /// A token that is returned when the asynchronous stream's backpressure strategy indicated that production should
[16/16] Applying swift-nio-crash
Build of product 'swift-nio-crash' complete! (2.30s)
FileSystem::info() #1
[1] 51400 segmentation fault run The first "print" gets printed but not the second one. So it have must something todo with |
Wow that was fast. Ok will do that. |
Heh, you got lucky and I was looking at my email when the email came in 😉 |
|
This looks to be a crash in the Swift runtime. I'll see if I can reproduce it. |
I uploaded the repo: https://github.com/patlux/swift-nio-crash |
just tried the docker image and it seems to work ~/d/P/s/swift-nio-crash ❮❮❮ docker run --rm -v ${PWD}:/usr/src/app --workdir /usr/src/app swiftlang/swift:nightly-6.0-jammy swift run ✘ 130 main
warning: 'swift-system': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/usr/src/app/.build/checkouts/swift-system/Sources/System/CMakeLists.txt
Building for debugging...
[0/2] Write swift-version-24593BA9C3E375BF.txt
Build of product 'swift-nio-crash' complete! (0.19s)
FileSystem::info() #1
FileSystem::info() #2
demise-of-dave.txt doesn't exist
Hello, world! So either my swift setup is broken or the macos version is broken. |
Interesting, I hadn't caught up with the fact that you were using a nightly toolchain. The beta xcode works fine. |
This is very likely to be a regression on the mainline nightly toolchain. I'm loading up this toolchain now, but I suspect you'll need to file a bug report on Swift. |
Ah right, I forgot that, the Xcode beta works fine for building and running on macos. But the problem with the xcode beta is, that I can't use it for compiling a static executable for linux, because: | `- error: compiled module was created by a different version of the compiler ''; rebuild 'Foundation' and try again: /Users/patwoz/Library/org.swift.swiftpm/swift-sdks/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1.artifactbundle/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-06-08-a_static-linux-0.0.1/swift-linux-musl/musl-1.2.5.sdk/aarch64/usr/lib/swift_static/linux-static/aarch64/Foundation.swiftmodule But at least I can now develop with the xcode beta and use the docker image for compiling the static executable for linux. |
Ok, I think this is an issue with the nightly toolchain. Can you please file this as a bug report against Swift directly? Thanks so much! ✨ |
I did. Thanks for the help! |
I'm new to swift and trying to compile my small swift server to a static library for linux. It seems it only works with swift v6, so I'm trying to use swift v6 with vapor, but it crashes whenever using
FileSystem.shared.info
.If you need more details, please ask and explain to me how I can provide it to you.
Thank you!
Expected behavior
No crash
Actual behavior
Steps to reproduce
main.swift
Package.swift
If possible, minimal yet complete reproducer code (or URL to code)
See above
SwiftNIO version/commit hash
System & version information
macOS 14.5
Swift v6 2024-06-13 and 2024-06-8
The text was updated successfully, but these errors were encountered: