Open swift-ci opened 7 years ago
Comment by Ted Goddard (JIRA)
Possible libcurl configuration to resolve:
you could add this to your code:
_ = signal(SIGPIPE, SIG_IGN)
Comment by Ted Goddard (JIRA)
I have tried that (in main.swift), but I'm not sure if it is propagating to the thread that receives the signal.
It's very difficult to reproduce, so I will test further to confirm that change.
Comment by Ted Goddard (JIRA)
I have reproduced a SIGPIPE signal with the provided stacktrace in libcurl and signal(SIGPIPE, SIG_IGN) set in main.swift. Is there a way to confirm if the signal mask is applied to all threads in the process?
Comment by Ted Goddard (JIRA)
It might be possible to reproduce this with the following in a docker container:
while true; do python -m SimpleHTTPServer 8000; done
while true; do kill -9 `ps -ef | fgrep python | fgrep SimpleHTTPServer | awk '{print $2}'`; sleep 0.1; done
Then run the test client from SR-5936
lldb -o run -- ./fetch http://localhost:8000
With this procedure I have not reproduced a SIGPIPE, but have reproduced:
Fatal error: Transfer completed, but there's no response.: file Foundation/URLSession/http/HTTPURLProtocol.swift, line 549
* thread #​2, name = 'fetch', stop reason = signal SIGILL: illegal instruction operand
* frame #​0: 0x00007ffff7b2a800 libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[1] = Exploded> of Swift._assertionFailure(Swift.StaticString, Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 144
frame #​1: 0x00007ffff734eef9 libFoundation.so`Foundation._HTTPURLProtocol.transferCompleted(withErrorCode: Swift.Optional<Swift.Int>) -> () + 2425
frame #​2: 0x00007ffff734f951 libFoundation.so`protocol witness for Foundation._EasyHandleDelegate.transferCompleted(withErrorCode: Swift.Optional<Swift.Int>) -> () in conformance Foundation._HTTPURLProtocol : Foundation._EasyHandleDelegate in Foundation + 17
frame #​3: 0x00007ffff7320bba libFoundation.so`Foundation._EasyHandle.completedTransfer(withErrorCode: Swift.Optional<Swift.Int>) -> () + 74
frame #​4: 0x00007ffff733308a libFoundation.so`Foundation.URLSession._MultiHandle.(readMessages in _0D88FAB2A36EC056571C12A88F9AC924)() -> () + 1034
frame #​5: 0x00007ffff7334d8e libFoundation.so`function signature specialization <Arg[0] = Owned To Guaranteed> of closure #​1 () -> () in closure #​1 () -> () in Foundation.URLSession._MultiHandle.(register in _0D88FAB2A36EC056571C12A88F9AC924)(socket: Swift.Int32, for: Swift.UnsafeMutableRawPointer, what: Swift.Int32, socketSourcePtr: Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Int32 + 78
frame #​6: 0x00007ffff733596a libFoundation.so`partial apply forwarder for closure #​1 () -> () in closure #​1 () -> () in Foundation.URLSession._MultiHandle.(register in _0D88FAB2A36EC056571C12A88F9AC924)(socket: Swift.Int32, for: Swift.UnsafeMutableRawPointer, what: Swift.Int32, socketSourcePtr: Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Int32 + 42
frame #​7: 0x00007ffff722d850 libFoundation.so`reabstraction thunk helper from @callee_owned () -> () to @callee_unowned @convention(block) () -> () + 32
frame #​8: 0x00007ffff7f3e0ee libdispatch.so`_dispatch_block_async_invoke2 + 78
frame #​9: 0x00007ffff7f3a8d0 libdispatch.so`_dispatch_continuation_pop + 288
frame #​10: 0x00007ffff7f415b7 libdispatch.so`_dispatch_source_invoke + 551
frame #​11: 0x00007ffff7f3c125 libdispatch.so`_dispatch_queue_serial_drain + 261
frame #​12: 0x00007ffff7f3ca65 libdispatch.so`_dispatch_queue_invoke + 597
frame #​13: 0x00007ffff7f3c125 libdispatch.so`_dispatch_queue_serial_drain + 261
frame #​14: 0x00007ffff7f3ca65 libdispatch.so`_dispatch_queue_invoke + 597
frame #​15: 0x00007ffff7f3edf8 libdispatch.so`_dispatch_worker_thread + 728
frame #​16: 0x00007ffff6b216ba libpthread.so.0`start_thread + 202
frame #​17: 0x00007ffff5baf3dd libc.so.6`clone + 109
Environment
Swift version 4.0.1-dev (LLVM 2dedb62a0b, Clang ab7472e733, Swift 7efb2d13a2) Target: x86_64-unknown-linux-gnu swift-4.0-DEVELOPMENT-SNAPSHOT-2017-10-04-a-ubuntu16.10.tar.gzAdditional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 2e0660fb3c09541baabb995867e3e417Issue Description:
The following stacktrace is observed: