Kitura / SwiftyRequest

SwiftyRequest is an HTTP networking library built for Swift.
Apache License 2.0
110 stars 19 forks source link

SIGPIPE failure in testCircuitBreakFailure with 5.1 2019-07-25-a #72

Open djones6 opened 5 years ago

djones6 commented 5 years ago

Running with the latest Swift 5.1 snapshot (2019-07-25-a), the testCircuitBreakFailure test causes a SIGPIPE crash.

This failure does not occur with an earlier (2019-07-02-a) snapshot.

For some reason the backtrace in the Travis job is missing, but I recreated it locally:

Process 675 launched: '/swift-project/.build/debug/SwiftyRequestPackageTests.xctest' (x86_64)
Test Suite 'All tests' started at 2019-08-09 16:05:15.657
Test Suite 'debug.xctest' started at 2019-08-09 16:05:15.658
Test Suite 'SwiftyRequestTests' started at 2019-08-09 16:05:15.658
Test Case 'SwiftyRequestTests.testInsecureConnection' started at 2019-08-09 16:05:15.658
Test Case 'SwiftyRequestTests.testInsecureConnection' passed (0.023 seconds)
Test Case 'SwiftyRequestTests.testEchoData' started at 2019-08-09 16:05:15.682
Test Case 'SwiftyRequestTests.testEchoData' passed (0.003 seconds)
Test Case 'SwiftyRequestTests.testGetValidCert' started at 2019-08-09 16:05:15.684
Test Case 'SwiftyRequestTests.testGetValidCert' passed (0.113 seconds)
Test Case 'SwiftyRequestTests.testGetClientCert' started at 2019-08-09 16:05:15.797
Test Case 'SwiftyRequestTests.testGetClientCert' passed (0.0 seconds)
Test Case 'SwiftyRequestTests.testResponseData' started at 2019-08-09 16:05:15.797
Test Case 'SwiftyRequestTests.testResponseData' passed (0.051 seconds)
Test Case 'SwiftyRequestTests.testResponseObject' started at 2019-08-09 16:05:15.848
Test Case 'SwiftyRequestTests.testResponseObject' passed (0.052 seconds)
Test Case 'SwiftyRequestTests.testQueryObject' started at 2019-08-09 16:05:15.900
Test Case 'SwiftyRequestTests.testQueryObject' passed (0.052 seconds)
Test Case 'SwiftyRequestTests.testResponseArray' started at 2019-08-09 16:05:15.953
Test Case 'SwiftyRequestTests.testResponseArray' passed (0.052 seconds)
Test Case 'SwiftyRequestTests.testResponseString' started at 2019-08-09 16:05:16.004
Test Case 'SwiftyRequestTests.testResponseString' passed (0.135 seconds)
Test Case 'SwiftyRequestTests.testResponseVoid' started at 2019-08-09 16:05:16.140
Test Case 'SwiftyRequestTests.testResponseVoid' passed (0.052 seconds)
Test Case 'SwiftyRequestTests.testFileDownload' started at 2019-08-09 16:05:16.192
Test Case 'SwiftyRequestTests.testFileDownload' passed (0.335 seconds)
Test Case 'SwiftyRequestTests.testRequestUserAgent' started at 2019-08-09 16:05:16.527
Test Case 'SwiftyRequestTests.testRequestUserAgent' passed (0.053 seconds)
Test Case 'SwiftyRequestTests.testCircuitBreakResponseString' started at 2019-08-09 16:05:16.580
[VERBOSE] [CircuitBreaker.swift:306 handleSuccess()] Handling success...
Test Case 'SwiftyRequestTests.testCircuitBreakResponseString' passed (0.052 seconds)
Test Case 'SwiftyRequestTests.testCircuitBreakFailure' started at 2019-08-09 16:05:16.632
[VERBOSE] [CircuitBreaker.swift:266 handleFailure(error:fallbackArgs:)] Handling failure...
[VERBOSE] [CircuitBreaker.swift:266 handleFailure(error:fallbackArgs:)] Handling failure...
[VERBOSE] [CircuitBreaker.swift:295 handleFailure(error:fallbackArgs:)] Reached maximum number of failures allowed before tripping circuit.
[VERBOSE] [CircuitBreaker.swift:336 fastFail(fallbackArgs:)] Breaker open... failing fast.
Process 675 stopped
* thread #7, name = 'SwiftyRequestPa', stop reason = signal SIGPIPE
    frame #0: 0x00007ffff6dbc2b7 libpthread.so.0`__libc_write + 71
libpthread.so.0`__libc_write:
->  0x7ffff6dbc2b7 <+71>: cmpq   $-0x1000, %rax            ; imm = 0xF000
    0x7ffff6dbc2bd <+77>: ja     0x7ffff6dbc2f4            ; <+132>
    0x7ffff6dbc2bf <+79>: movl   %r8d, %edi
    0x7ffff6dbc2c2 <+82>: movq   %rax, 0x8(%rsp)
Target 0: (SwiftyRequestPackageTests.xctest) stopped.
(lldb) bt
* thread #7, name = 'SwiftyRequestPa', stop reason = signal SIGPIPE
  * frame #0: 0x00007ffff6dbc2b7 libpthread.so.0`__libc_write + 71
    frame #1: 0x00007ffff1343be5 libcrypto.so.1.1`___lldb_unnamed_symbol314$$libcrypto.so.1.1 + 37
    frame #2: 0x00007ffff133ef7a libcrypto.so.1.1`___lldb_unnamed_symbol239$$libcrypto.so.1.1 + 26
    frame #3: 0x00007ffff133dfd5 libcrypto.so.1.1`___lldb_unnamed_symbol236$$libcrypto.so.1.1 + 133
    frame #4: 0x00007ffff133e473 libcrypto.so.1.1`BIO_write + 35
    frame #5: 0x00007ffff177fcb7 libssl.so.1.1`___lldb_unnamed_symbol113$$libssl.so.1.1 + 151
    frame #6: 0x00007ffff1780bd5 libssl.so.1.1`___lldb_unnamed_symbol114$$libssl.so.1.1 + 3557
    frame #7: 0x00007ffff178a6cc libssl.so.1.1`___lldb_unnamed_symbol201$$libssl.so.1.1 + 92
    frame #8: 0x00007ffff17887a5 libssl.so.1.1`___lldb_unnamed_symbol182$$libssl.so.1.1 + 197
    frame #9: 0x00007ffff17936bf libssl.so.1.1`SSL_shutdown + 63
    frame #10: 0x00007ffff2aac385 libcurl.so.4`___lldb_unnamed_symbol778$$libcurl.so.4 + 21
    frame #11: 0x00007ffff2aac3f1 libcurl.so.4`___lldb_unnamed_symbol779$$libcurl.so.4 + 33
    frame #12: 0x00007ffff2a6f359 libcurl.so.4`___lldb_unnamed_symbol165$$libcurl.so.4 + 265
    frame #13: 0x00007ffff2a734c4 libcurl.so.4`___lldb_unnamed_symbol181$$libcurl.so.4 + 11092
    frame #14: 0x00007ffff2a852cb libcurl.so.4`___lldb_unnamed_symbol326$$libcurl.so.4 + 2315
    frame #15: 0x00007ffff2a866b5 libcurl.so.4`___lldb_unnamed_symbol327$$libcurl.so.4 + 485
    frame #16: 0x00007ffff2a86887 libcurl.so.4`curl_multi_socket_action + 23
    frame #17: 0x00007ffff638749d libFoundationNetworking.so`FoundationNetworking.URLSession._MultiHandle.(readAndWriteAvailableData in _76FB65EF45BDE9115477B690E87F5E28)(on: Swift.Int32) throws -> () + 45
    frame #18: 0x00007ffff6387157 libFoundationNetworking.so`FoundationNetworking.URLSession._MultiHandle.add(FoundationNetworking._EasyHandle) -> () + 199
    frame #19: 0x00007ffff63a1ae3 libFoundationNetworking.so`protocol witness for FoundationNetworking.URLSessionProtocol.add(handle: FoundationNetworking._EasyHandle) -> () in conformance FoundationNetworking.URLSession : FoundationNetworking.URLSessionProtocol in FoundationNetworking + 19
    frame #20: 0x00007ffff638c58e libFoundationNetworking.so`FoundationNetworking._NativeProtocol.internalState.didset : FoundationNetworking._NativeProtocol._InternalState + 270
    frame #21: 0x00007ffff638c80b libFoundationNetworking.so`FoundationNetworking._NativeProtocol.internalState.setter : FoundationNetworking._NativeProtocol._InternalState + 235
    frame #22: 0x00007ffff63914af libFoundationNetworking.so`FoundationNetworking._NativeProtocol.resume() -> () + 1135
    frame #23: 0x00007ffff6395095 libFoundationNetworking.so`function signature specialization <Arg[0] = Exploded> of FoundationNetworking._NativeProtocol.startNewTransfer(with: FoundationNetworking.URLRequest) -> () + 1061
    frame #24: 0x00007ffff63912f2 libFoundationNetworking.so`FoundationNetworking._NativeProtocol.resume() -> () + 690
    frame #25: 0x00007ffff63c5285 libFoundationNetworking.so`partial apply forwarder for closure #1 () -> () in closure #1 (Swift.Optional<FoundationNetworking.URLProtocol>) -> () in closure #1 () -> () in FoundationNetworking.URLSessionTask.resume() -> () + 53
    frame #26: 0x00007ffff6348949 libFoundationNetworking.so`reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 25
    frame #27: 0x00007ffff7f6a547 libdispatch.so`_dispatch_call_block_and_release + 7
    frame #28: 0x00007ffff7f7600b libdispatch.so`_dispatch_lane_serial_drain + 747
    frame #29: 0x00007ffff7f76cea libdispatch.so`_dispatch_lane_invoke + 890
    frame #30: 0x00007ffff7f75e98 libdispatch.so`_dispatch_lane_serial_drain + 376
    frame #31: 0x00007ffff7f76cea libdispatch.so`_dispatch_lane_invoke + 890
    frame #32: 0x00007ffff7f7ebaa libdispatch.so`_dispatch_worker_thread + 602
    frame #33: 0x00007ffff6db26db libpthread.so.0`start_thread + 219
    frame #34: 0x00007ffff5a3c88f libc.so.6`clone + 63
djones6 commented 5 years ago

@pushkarnk Could someone look into this? At first glance, this could be a regression in Foundation.

djones6 commented 5 years ago

Updated to 2019-09-09-a and the SIGPIPE with testCircuitBreakFailure has gone, but there's now a new error:

Test Case 'SwiftyRequestTests.testURLTemplateNoParams' started at 2019-09-11
  09:16:27.413

Fatal error: Couldn't find a protocol appropriate for request: : file
  /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-18_04/
  swift-corelibs-foundation/Foundation/URLSession/URLSessionTask.swift, line 126

Exited with signal code 4