{"action":"created","issue":{"url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/158","repository_url":"https://api.github.com/repos/IBM-Swift/Kitura-net","labels_url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/158/comments","events_url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/158/events","html_url":"https://github.com/IBM-Swift/Kitura-net/issues/158","id":194179186,"number":158,"title":"Running into SIGPIPE","user":{"login":"terhechte","id":132234,"avatar_url":"https://avatars.githubusercontent.com/u/132234?v=3","gravatar_id":"","url":"https://api.github.com/users/terhechte","html_url":"https://github.com/terhechte","followers_url":"https://api.github.com/users/terhechte/followers","following_url":"https://api.github.com/users/terhechte/following{/other_user}","gists_url":"https://api.github.com/users/terhechte/gists{/gist_id}","starred_url":"https://api.github.com/users/terhechte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terhechte/subscriptions","organizations_url":"https://api.github.com/users/terhechte/orgs","repos_url":"https://api.github.com/users/terhechte/repos","events_url":"https://api.github.com/users/terhechte/events{/privacy}","received_events_url":"https://api.github.com/users/terhechte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-07T21:44:15Z","updated_at":"2016-12-08T11:00:28Z","closed_at":null,"body":"Hey,\r\n\r\nI'm using Kitura-net because I have a Linux app that's doing a lot of networking. Originally, I was using Swift Foundation's networking, however I ran into too many problems with it (the macOS version worked fine, the Swift one not). I've switched to kitura-net for my networking and it works a lot better. However, after a certain amount of requests, I'm running into a SIGPIPE:\r\n\r\n(my LLDB session output)\r\n```\r\n* thread #1: tid = 20019, 0x00007ffff671035d libpthread.so.0`__libc_write + 45, name = 'CSPTest', stop reason = signal SIGPIPE\r\n    frame #0: 0x00007ffff671035d libpthread.so.0`__libc_write + 45\r\nlibpthread.so.0`__libc_write:\r\n->  0x7ffff671035d <+45>: movq   (%rsp), %rdi\r\n    0x7ffff6710361 <+49>: movq   %rax, %rdx\r\n    0x7ffff6710364 <+52>: callq  0x7ffff670fe80            ; __pthread_disable_asynccancel\r\n    0x7ffff6710369 <+57>: movq   %rdx, %rax\r\n(lldb) up\r\nframe #1: 0x00007ffff78807a6 libcrypto.so.1.0.0`___lldb_unnamed_symbol566$$libcrypto.so.1.0.0 + 38\r\nlibcrypto.so.1.0.0`___lldb_unnamed_symbol566$$libcrypto.so.1.0.0:\r\n    0x7ffff78807a6 <+38>: movl   $0xf, %esi\r\n    0x7ffff78807ab <+43>: movq   %rax, %rbx\r\n    0x7ffff78807ae <+46>: movq   %rbp, %rdi\r\n    0x7ffff78807b1 <+49>: callq  0x7ffff787e650            ; BIO_clear_flags\r\n(lldb) up\r\nframe #2: 0x00007ffff787e84b libcrypto.so.1.0.0`BIO_write + 107\r\nlibcrypto.so.1.0.0`BIO_write:\r\n    0x7ffff787e84b <+107>: testl  %eax, %eax\r\n    0x7ffff787e84d <+109>: jle    0x7ffff787e856            ; <+118>\r\n    0x7ffff787e84f <+111>: movslq %eax, %rdx\r\n    0x7ffff787e852 <+114>: addq   %rdx, 0x58(%rbx)\r\n(lldb) up\r\nframe #3: 0x00007ffff7b9cc12 libssl.so.1.0.0`___lldb_unnamed_symbol79$$libssl.so.1.0.0 + 114\r\nlibssl.so.1.0.0`___lldb_unnamed_symbol79$$libssl.so.1.0.0:\r\n    0x7ffff7b9cc12 <+114>: movl   0x11c(%rbx), %ecx\r\n    0x7ffff7b9cc18 <+120>: cmpl   %ecx, %eax\r\n    0x7ffff7b9cc1a <+122>: je     0x7ffff7b9cc90            ; <+240>\r\n    0x7ffff7b9cc1c <+124>: testl  %eax, %eax\r\n(lldb) up\r\nframe #4: 0x00007ffff7b9e7f3 libssl.so.1.0.0`___lldb_unnamed_symbol85$$libssl.so.1.0.0 + 51\r\nlibssl.so.1.0.0`___lldb_unnamed_symbol85$$libssl.so.1.0.0:\r\n    0x7ffff7b9e7f3 <+51>: movl   %eax, %ebp\r\n    0x7ffff7b9e7f5 <+53>: movq   0x80(%rbx), %rax\r\n    0x7ffff7b9e7fc <+60>: testl  %ebp, %ebp\r\n    0x7ffff7b9e7fe <+62>: jle    0x7ffff7b9e890            ; <+208>\r\n(lldb) up\r\nframe #5: 0x00007ffff7b9acf2 libssl.so.1.0.0`___lldb_unnamed_symbol53$$libssl.so.1.0.0 + 178\r\nlibssl.so.1.0.0`___lldb_unnamed_symbol53$$libssl.so.1.0.0:\r\n    0x7ffff7b9acf2 <+178>: movq   0x80(%rbx), %rax\r\n    0x7ffff7b9acf9 <+185>: movl   0x1d4(%rax), %ecx\r\n    0x7ffff7b9acff <+191>: testl  %ecx, %ecx\r\n    0x7ffff7b9ad01 <+193>: jne    0x7ffff7b9acd0            ; <+144>\r\n(lldb) up\r\nframe #6: 0x00007ffff60e139e libcurl.so.4`___lldb_unnamed_symbol610$$libcurl.so.4 + 30\r\nlibcurl.so.4`___lldb_unnamed_symbol610$$libcurl.so.4:\r\n    0x7ffff60e139e <+30>: movq   0x10(%rbx), %rdi\r\n    0x7ffff60e13a2 <+34>: callq  0x7ffff609be60            ; symbol stub for: SSL_set_connect_state\r\n    0x7ffff60e13a7 <+39>: movq   0x10(%rbx), %rdi\r\n    0x7ffff60e13ab <+43>: callq  0x7ffff609c740            ; symbol stub for: SSL_free\r\n(lldb) up\r\nframe #7: 0x00007ffff60b238b libcurl.so.4`___lldb_unnamed_symbol168$$libcurl.so.4 + 267\r\nlibcurl.so.4`___lldb_unnamed_symbol168$$libcurl.so.4:\r\n    0x7ffff60b238b <+267>: movq   0x60(%rbp), %rdi\r\n    0x7ffff60b238f <+271>: callq  0x7ffff60c3da0            ; ___lldb_unnamed_symbol303$$libcurl.so.4\r\n    0x7ffff60b2394 <+276>: testb  %al, %al\r\n    0x7ffff60b2396 <+278>: jne    0x7ffff60b23d8            ; <+344>\r\n(lldb) up\r\nframe #8: 0x00007ffff60b5c02 libcurl.so.4`___lldb_unnamed_symbol184$$libcurl.so.4 + 322\r\nlibcurl.so.4`___lldb_unnamed_symbol184$$libcurl.so.4:\r\n    0x7ffff60b5c02 <+322>: testl  %eax, %eax\r\n    0x7ffff60b5c04 <+324>: jne    0x7ffff60b5c90            ; <+464>\r\n    0x7ffff60b5c0a <+330>: movq   $0x0, (%r12)\r\n    0x7ffff60b5c12 <+338>: movq   %rbp, %rdi\r\n(lldb) up\r\nframe #9: 0x00007ffff60c57db libcurl.so.4`___lldb_unnamed_symbol316$$libcurl.so.4 + 2411\r\nlibcurl.so.4`___lldb_unnamed_symbol316$$libcurl.so.4:\r\n    0x7ffff60c57db <+2411>: movq   0x18(%rsp), %rdi\r\n    0x7ffff60c57e0 <+2416>: testq  %rdi, %rdi\r\n    0x7ffff60c57e3 <+2419>: je     0x7ffff60c5144            ; <+724>\r\n    0x7ffff60c57e9 <+2425>: leaq   0x234258(%rip), %rax\r\n(lldb) up\r\nframe #10: 0x00007ffff60c5f01 libcurl.so.4`curl_multi_perform + 145\r\nlibcurl.so.4`curl_multi_perform:\r\n    0x7ffff60c5f01 <+145>: cmpl   $-0x1, %eax\r\n    0x7ffff60c5f04 <+148>: je     0x7ffff60c5ef0            ; <+128>\r\n    0x7ffff60c5f06 <+150>: cmpb   $0x0, 0x6f0(%rbx)\r\n    0x7ffff60c5f0d <+157>: je     0x7ffff60c5f2c            ; <+188>\r\n(lldb) up\r\nframe #11: 0x00007ffff60bd533 libcurl.so.4`curl_easy_perform + 259\r\nlibcurl.so.4`curl_easy_perform:\r\n    0x7ffff60bd533 <+259>: testl  %eax, %eax\r\n    0x7ffff60bd535 <+261>: jne    0x7ffff60bd590            ; <+352>\r\n    0x7ffff60bd537 <+263>: movl   0x14(%rsp), %eax\r\n    0x7ffff60bd53b <+267>: testl  %eax, %eax\r\n(lldb) up\r\nframe #12: 0x000000000076adb6 CSPTest`CurlInvoker.(ptr=<unavailable>, self=<unavailable>, rc=<unavailable>) -> CURLcode).(closure #1) + 70 at ClientRequest.swift:484\r\n```\r\n\r\nI did add a signal handler for SIGPIPE in my main.swift:\r\n\r\n```\r\nsignal(SIGPIPE, SIG_IGN)\r\n```\r\n\r\nbut that didn't seem to help. Is there something else I can do?\r\n\r\nCheers & Thanks,\r\nBenedikt"},"comment":{"url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/comments/265713571","html_url":"https://github.com/IBM-Swift/Kitura-net/issues/158#issuecomment-265713571","issue_url":"https://api.github.com/repos/IBM-Swift/Kitura-net/issues/158","id":265713571,"user":{"login":"shmuelk","id":16103068,"avatar_url":"https://avatars.githubusercontent.com/u/16103068?v=3","gravatar_id":"","url":"https://api.github.com/users/shmuelk","html_url":"https://github.com/shmuelk","followers_url":"https://api.github.com/users/shmuelk/followers","following_url":"https://api.github.com/users/shmuelk/following{/other_user}","gists_url":"https://api.github.com/users/shmuelk/gists{/gist_id}","starred_url":"https://api.github.com/users/shmuelk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shmuelk/subscriptions","organizations_url":"https://api.github.com/users/shmuelk/orgs","repos_url":"https://api.github.com/users/shmuelk/repos","events_url":"https://api.github.com/users/shmuelk/events{/privacy}","received_events_url":"https://api.github.com/users/shmuelk/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T11:00:28Z","updated_at":"2016-12-08T11:00:28Z","body":"@terhechte Let me make sure I understand. You are using KituraNet's HTTP.request function to create an outgoing HTTP request?\r\n\r\nAlso can you provide a backtrace (bt) from lldb. That would be a lot better."}}
{"actor":{"display_login":"shmuelk"}}