swift-openapi-urlsession icon indicating copy to clipboard operation
swift-openapi-urlsession copied to clipboard

Crash on HTTPBodyStreamDelegate

Open victor-osc opened this issue 10 months ago • 4 comments

Description

We are having a crash on HTTPBodyStreamDelegate

The stack trace seems odd which may be happening because of the inline optimizations or some race condition.

  • OpenAPIURLSession.BufferedStream._StateMachine._State.Initial.init(backPressureStrategy: OpenAPIURLSession.BufferedStream<A>._InternalBackPressureStrategy, iteratorInitialized: Swift.Bool, onTermination: (@Sendable () -> ())?) -> OpenAPIURLSession.BufferedStream<A>._StateMachine._State.Initial
  • OpenAPIURLSession.BufferedStream._StateMachine._State.SourceFinished.failure.setter : Swift.Error?
  • OpenAPIURLSession.BufferedStream.Source.write<A where A == A1.Element, A1: Swift.Sequence>(contentsOf: A1) async throws -> ()
  • OpenAPIURLSession.BufferedStream.Source.WriteResult.CallbackToken.id.getter : Swift.UInt
  • OpenAPIURLSession.LockStorage.unlock() -> ()

Reproduction

We don't know yet the exact steps to reproduce the issue

Package version(s)

https://github.com/apple/swift-openapi-urlsession version 1.0.2

Expected behavior

not crash

Environment

iOS 18.5

Additional information

No response

victor-osc avatar Jun 11 '25 20:06 victor-osc

Transfered over to the right repo. cc @guoye-zhang @simonjbeaumont

czechboy0 avatar Jun 11 '25 21:06 czechboy0

Would you attach a complete crash report?

guoye-zhang avatar Jun 12 '25 05:06 guoye-zhang

We are experiencing a similar crash on our end. Attached is the stack trace of one of the crashes. I don't have a way to reproduce it, but it might be related to the cancellation of the task that the upload is part of.

SIGTRAP

Crashed: HTTPBodyStreamDelegate

0  App                            0x1981afc HTTPBodyOutputStreamBridge.State.wroteFinalChunk() + 210 (HTTPBodyOutputStreamBridge.swift:210)
1  App                            0x1981990 closure #2 in closure #1 in HTTPBodyOutputStreamBridge.startWriterTask() + 75 (HTTPBodyOutputStreamBridge.swift:75)
2  App                            0x607790 <deduplicated_symbol> + 4383307664
3  libdispatch.dylib              0x5b830 <redacted> + 24
4  libdispatch.dylib              0x5ca68 <redacted> + 12
5  libdispatch.dylib              0x9a04 <redacted> + 668
6  libdispatch.dylib              0xa440 <redacted> + 384
7  libdispatch.dylib              0x134d0 <redacted> + 256
8  libdispatch.dylib              0x12dec <redacted> + 528
9  libsystem_pthread.dylib        0xa10 _pthread_wqthread + 288
10 libsystem_pthread.dylib        0xab0 start_wqthread + 8

ls-alexandre-perez avatar Aug 20 '25 12:08 ls-alexandre-perez

Hey there,

I want to contribute here, could you tell me the steps to reproduce this crash?

Best

aluco100 avatar Nov 10 '25 07:11 aluco100