Skip to content
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

Remangling fails on 6.0-nightly #78112

Open
glbrntt opened this issue Dec 11, 2024 · 1 comment
Open

Remangling fails on 6.0-nightly #78112

glbrntt opened this issue Dec 11, 2024 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@glbrntt
Copy link

glbrntt commented Dec 11, 2024

Description

Remangling fails using the 6.0-nightly toolchains (6.0.3) for http://github.com/grpc/grpc-swift-nio-transport/. This doesn't with 6.0.2.

Reproduction

Stack dump

Stack dump:
0.	Program arguments: /usr/bin/swift-frontend -frontend -c -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/ClientConnectionHandler.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/Connection.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/ConnectionBackoff.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/ConnectionFactory.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/ConnectivityState.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/LoadBalancer.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/LoadBalancerEvent.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/PickFirstLoadBalancer.swift -primary-file /code/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift /code/Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/Subchannel.swift /code/Sources/GRPCNIOTransportCore/Client/Connection/RequestQueue.swift /code/Sources/GRPCNIOTransportCore/Client/GRPCClientStreamHandler.swift /code/Sources/GRPCNIOTransportCore/Client/HTTP2ClientTransport.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/DNSResolver.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver+DNS.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver+IPv4.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver+IPv6.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver+UDS.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver+VSOCK.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolver.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/NameResolverRegistry.swift /code/Sources/GRPCNIOTransportCore/Client/Resolver/SocketAddress.swift /code/Sources/GRPCNIOTransportCore/Compression/CompressionAlgorithm.swift /code/Sources/GRPCNIOTransportCore/Compression/Zlib.swift /code/Sources/GRPCNIOTransportCore/GRPCMessageDecoder.swift /code/Sources/GRPCNIOTransportCore/GRPCMessageFramer.swift /code/Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift /code/Sources/GRPCNIOTransportCore/Internal/CallOptions+MethodConfig.swift /code/Sources/GRPCNIOTransportCore/Internal/ConstantAsyncSequence.swift /code/Sources/GRPCNIOTransportCore/Internal/ContentType.swift /code/Sources/GRPCNIOTransportCore/Internal/DiscardingTaskGroup+CancellableHandle.swift /code/Sources/GRPCNIOTransportCore/Internal/GRPCStatusMessageMarshaller.swift /code/Sources/GRPCNIOTransportCore/Internal/MethodConfigs.swift /code/Sources/GRPCNIOTransportCore/Internal/NIOChannelPipeline+GRPC.swift /code/Sources/GRPCNIOTransportCore/Internal/NIOSocketAddress+GRPCSocketAddress.swift /code/Sources/GRPCNIOTransportCore/Internal/PercentEncoding.swift /code/Sources/GRPCNIOTransportCore/Internal/ProcessUniqueID.swift /code/Sources/GRPCNIOTransportCore/Internal/Result+Catching.swift /code/Sources/GRPCNIOTransportCore/Internal/Timer.swift /code/Sources/GRPCNIOTransportCore/ListeningServerTransport.swift /code/Sources/GRPCNIOTransportCore/OneOrManyQueue.swift /code/Sources/GRPCNIOTransportCore/Server/CommonHTTP2ServerTransport.swift /code/Sources/GRPCNIOTransportCore/Server/Connection/GRPCServerFlushNotificationHandler.swift /code/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnection.swift /code/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler+StateMachine.swift /code/Sources/GRPCNIOTransportCore/Server/Connection/ServerConnectionManagementHandler.swift /code/Sources/GRPCNIOTransportCore/Server/GRPCServerStreamHandler.swift /code/Sources/GRPCNIOTransportCore/Server/HTTP2ListenerFactory.swift /code/Sources/GRPCNIOTransportCore/Server/HTTP2ServerTransport.swift /code/Sources/GRPCNIOTransportCore/TLSConfig.swift -supplementary-output-file-map /tmp/TemporaryDirectory.gSBiF9/supplementaryOutputs-1 -target aarch64-unknown-linux-gnu -Xllvm -aarch64-use-tbi -disable-objc-interop -I /code/.build/aarch64-unknown-linux-gnu/debug/Modules -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /code/.build/aarch64-unknown-linux-gnu/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-upcoming-feature ExistentialAny -enable-upcoming-feature InternalImportsByDefault -empty-abi-descriptor -resource-dir /usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /code -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CNIOLLHTTP.build/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIOLLHTTP/include -Xcc -fmodule-map-file=/code/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-atomics/Sources/_AtomicsShims/include -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CNIOWASI.build/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIOWASI/include -Xcc -fmodule-map-file=/code/.build/checkouts/swift-nio/Sources/CNIOWindows/include/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIOWindows/include -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CNIOLinux.build/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIOLinux/include -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CNIODarwin.build/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIODarwin/include -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CNIOAtomics.build/module.modulemap -Xcc -I -Xcc /code/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -Xcc -fmodule-map-file=/code/.build/aarch64-unknown-linux-gnu/debug/CGRPCZlib.build/module.modulemap -Xcc -I -Xcc /code/Sources/CGRPCZlib/include -Xcc -fPIC -Xcc -g -Xcc -fno-omit-frame-pointer -module-name GRPCNIOTransportCore -package-name code -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -parse-as-library -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/ClientConnectionHandler.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/Connection.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/ConnectionBackoff.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/ConnectionFactory.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/ConnectivityState.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/GRPCChannel.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/LoadBalancer.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/LoadBalancerEvent.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/PickFirstLoadBalancer.swift.o -o /code/.build/aarch64-unknown-linux-gnu/debug/GRPCNIOTransportCore.build/RoundRobinLoadBalancer.swift.o -index-store-path /code/.build/aarch64-unknown-linux-gnu/debug/index/store -index-system-modules
1.	Swift version 6.0.3-dev (LLVM 2e6139970eda445, Swift 7fb200b953a7343)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/code/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift")
4.	While silgen emitFunction SIL function "@$s20GRPCNIOTransportCore11GRPCChannelC7enqueue33_51FC59EAF52ADB56A3D23C3BFB3C88F4LL12waitForReadyAA12LoadBalancerOSb_tYaKF".
 for 'enqueue(waitForReady:)' (at /code/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift:331:11)
5.	While silgen closureexpr SIL function "@$s20GRPCNIOTransportCore11GRPCChannelC7enqueue33_51FC59EAF52ADB56A3D23C3BFB3C88F4LL12waitForReadyAA12LoadBalancerOSb_tYaKFAHyYaKXEfU_".
 for expression at [/code/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift:333:50 - line:355:5] RangeText="{
      try await withCheckedThrowingContinuation { continuation in
        if Task.isCancelled {
          continuation.resume(throwing: CancellationError())
          return
        }

        let (enqueued, loadBalancer) = self.state.withLock { state in
          state.enqueue(continuation: continuation, waitForReady: waitForReady, id: id)
        }

        if let loadBalancer = loadBalancer {
          // Attempting to pick a subchannel will trigger a connect event if the subchannel is idle.
          _ = loadBalancer.pickSubchannel()
        }

        // Not enqueued because the channel is shutdown or shutting down.
        if !enqueued {
          let error = RPCError(code: .unavailable, message: "channel is shutdown")
          continuation.resume(throwing: error)
        }
      }
    "
6.	While silgen closureexpr SIL function "@$s20GRPCNIOTransportCore11GRPCChannelC7enqueue33_51FC59EAF52ADB56A3D23C3BFB3C88F4LL12waitForReadyAA12LoadBalancerOSb_tYaKFAHyYaKXEfU_yScCyAHs5Error_pGXEfU_".
 for expression at [/code/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift:334:49 - line:354:7] RangeText="{ continuation in
        if Task.isCancelled {
          continuation.resume(throwing: CancellationError())
          return
        }

        let (enqueued, loadBalancer) = self.state.withLock { state in
          state.enqueue(continuation: continuation, waitForReady: waitForReady, id: id)
        }

        if let loadBalancer = loadBalancer {
          // Attempting to pick a subchannel will trigger a connect event if the subchannel is idle.
          _ = loadBalancer.pickSubchannel()
        }

        // Not enqueued because the channel is shutdown or shutting down.
        if !enqueued {
          let error = RPCError(code: .unavailable, message: "channel is shutdown")
          continuation.resume(throwing: error)
        }
      "

Expected behavior

Shouldn't crash.

Environment

Swift version 6.0.3-dev (LLVM 2e6139970eda445, Swift 7fb200b)
Target: aarch64-unknown-linux-gnu

Additional information

No response

@glbrntt glbrntt added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Dec 11, 2024
@glbrntt
Copy link
Author

glbrntt commented Feb 3, 2025

Note that changing this:

        let (enqueued, loadBalancer) = self.state.withLock { state in
          state.enqueue(continuation: continuation, waitForReady: waitForReady, id: id)
        }

to:

        let (enqueued, loadBalancer) = self.state.withLock { state -> (Bool, LoadBalancer?) in
          state.enqueue(continuation: continuation, waitForReady: waitForReady, id: id)
        }

work around the issue.

glbrntt added a commit to glbrntt/grpc-swift-nio-transport that referenced this issue Feb 3, 2025
Motivation:

Nightly toolchains are crashing when compiling this project. This is
tracked in swiftlang/swift#78112

Modifications:

- Add extra type info as this appears to work around the crash.

Result:

CI green on nightly toolchains.
glbrntt added a commit to grpc/grpc-swift-nio-transport that referenced this issue Feb 4, 2025
Motivation:

Nightly toolchains are crashing when compiling this project. This is
tracked in swiftlang/swift#78112

Modifications:

- Add extra type info as this appears to work around the crash.

Result:

CI green on nightly toolchains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant