{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/3790","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/3790/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/3790/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/3790/events","html_url":"https://github.com/dotnet/corefx/issues/3790","id":111061012,"number":3790,"title":"Sending http requests segfaults sometimes on Mac if the request fails","user":{"login":"moozzyk","id":1438884,"avatar_url":"https://avatars.githubusercontent.com/u/1438884?v=3","gravatar_id":"","url":"https://api.github.com/users/moozzyk","html_url":"https://github.com/moozzyk","followers_url":"https://api.github.com/users/moozzyk/followers","following_url":"https://api.github.com/users/moozzyk/following{/other_user}","gists_url":"https://api.github.com/users/moozzyk/gists{/gist_id}","starred_url":"https://api.github.com/users/moozzyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moozzyk/subscriptions","organizations_url":"https://api.github.com/users/moozzyk/orgs","repos_url":"https://api.github.com/users/moozzyk/repos","events_url":"https://api.github.com/users/moozzyk/events{/privacy}","received_events_url":"https://api.github.com/users/moozzyk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/Mac%20OSX","name":"Mac OSX","color":"fef2c0"},{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.Net","name":"System.Net","color":"d4c5f9"},{"url":"https://api.github.com/repos/dotnet/corefx/labels/X-Plat","name":"X-Plat","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"kapilash","id":113322,"avatar_url":"https://avatars.githubusercontent.com/u/113322?v=3","gravatar_id":"","url":"https://api.github.com/users/kapilash","html_url":"https://github.com/kapilash","followers_url":"https://api.github.com/users/kapilash/followers","following_url":"https://api.github.com/users/kapilash/following{/other_user}","gists_url":"https://api.github.com/users/kapilash/gists{/gist_id}","starred_url":"https://api.github.com/users/kapilash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kapilash/subscriptions","organizations_url":"https://api.github.com/users/kapilash/orgs","repos_url":"https://api.github.com/users/kapilash/repos","events_url":"https://api.github.com/users/kapilash/events{/privacy}","received_events_url":"https://api.github.com/users/kapilash/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/4","html_url":"https://github.com/dotnet/corefx/milestones/1.0.0-rtm","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/4/labels","id":1248719,"number":4,"title":"1.0.0-rtm","description":"Q1 2016 (https://github.com/aspnet/Home/wiki/Roadmap)","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":228,"closed_issues":108,"state":"open","created_at":"2015-08-10T18:04:00Z","updated_at":"2015-12-10T11:35:50Z","due_on":"2016-03-31T07:00:00Z","closed_at":null},"comments":6,"created_at":"2015-10-12T21:38:21Z","updated_at":"2015-12-10T11:35:50Z","closed_at":"2015-12-10T11:35:50Z","body":"I noticed this issue when trying dnx beta-8 bits on Mac. When I restore packages of my dnx app I frequently (~50% of the time) get a segfault if the request fails with an HTTP error (e.g. 404 or 400). I am not exactly sure if this is a bug in coreclr, libcurl or somewhere else. I was not able to repro this issue on Linux. I also don’t seem to be getting the segfault if the request succeeds.\r\n\r\nException details:\r\n```\r\nProcess 51039 stopped\r\n* thread #7: tid = 0x51dec4, 0x00007fff8ddc7852 libsystem_coretls.dylib`tls_handshake_set_peer_trust + 4, stop reason = EXC_BAD_ACCESS (code=1, address=0x48)\r\n    frame #0: 0x00007fff8ddc7852 libsystem_coretls.dylib`tls_handshake_set_peer_trust + 4\r\nlibsystem_coretls.dylib`tls_handshake_set_peer_trust:\r\n->  0x7fff8ddc7852 <+4>:  movl   %esi, 0x48(%rdi)\r\n    0x7fff8ddc7855 <+7>:  xorl   %eax, %eax\r\n    0x7fff8ddc7857 <+9>:  popq   %rbp\r\n    0x7fff8ddc7858 <+10>: retq\r\n```\r\n\r\nStack trace:\r\n```\r\n* thread #7: tid = 0x2d98, 0x00007fff8a53b852 libsystem_coretls.dylib`tls_handshake_set_peer_trust + 4, stop reason = EXC_BAD_ACCESS (code=1, address=0x48)\r\n  * frame #0: 0x00007fff8a53b852 libsystem_coretls.dylib`tls_handshake_set_peer_trust + 4\r\n    frame #1: 0x00007fff898c510b Security`tls_verify_peer_cert + 537\r\n    frame #2: 0x00007fff8a537676 libsystem_coretls.dylib`SSLProcessHandshakeRecordInner + 234\r\n    frame #3: 0x00007fff8a537eff libsystem_coretls.dylib`SSLProcessHandshakeRecord + 1119\r\n    frame #4: 0x00007fff8a53b4f1 libsystem_coretls.dylib`tls_handshake_process + 116\r\n    frame #5: 0x00007fff8988efb6 Security`SSLHandshakeProceed + 126\r\n    frame #6: 0x00007fff8988ef21 Security`SSLHandshake + 148\r\n    frame #7: 0x00007fff8b864b32 libcurl.4.dylib`darwinssl_connect_step2 + 74\r\n    frame #8: 0x00007fff8b864612 libcurl.4.dylib`darwinssl_connect_common + 4013\r\n    frame #9: 0x00007fff8b862cca libcurl.4.dylib`Curl_ssl_connect_nonblocking + 77\r\n    frame #10: 0x00007fff8b82b61b libcurl.4.dylib`https_connecting + 22\r\n    frame #11: 0x00007fff8b84c6e9 libcurl.4.dylib`multi_runsingle + 1016\r\n    frame #12: 0x00007fff8b84c24f libcurl.4.dylib`curl_multi_perform + 159\r\n    frame #13: 0x000000011db0eb32\r\n    frame #14: 0x000000011db0cd7a\r\n    frame #15: 0x000000011db0c9d3\r\n    frame #16: 0x000000011db4f879\r\n    frame #17: 0x000000011db4e16e\r\n    frame #18: 0x000000011db4f58c\r\n    frame #19: 0x000000011db4ea66\r\n    frame #20: 0x000000011db4e16e\r\n    frame #21: 0x0000000101373bca libcoreclr.dylib`FastCallFinalizeWorker_End + 124\r\n    frame #22: 0x000000010128f165 libcoreclr.dylib`MethodDescCallSite::CallTargetWorker(unsigned long const*) + 917\r\n    frame #23: 0x00000001012a210c libcoreclr.dylib`ThreadNative::KickOffThread_Worker(void*) + 348\r\n    frame #24: 0x0000000101255b05 libcoreclr.dylib`ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 277\r\n    frame #25: 0x00000001012560b9 libcoreclr.dylib`ManagedThreadBase::KickOff(ADID, void (*)(void*), void*) + 57\r\n    frame #26: 0x00000001012a2230 libcoreclr.dylib`ThreadNative::KickOffThread(void*) + 160\r\n    frame #27: 0x0000000101078c55 libcoreclr.dylib`CorUnix::CPalThread::ThreadEntry(void*) + 357\r\n    frame #28: 0x00007fff8e17305a libsystem_pthread.dylib`_pthread_body + 131\r\n    frame #29: 0x00007fff8e172fd7 libsystem_pthread.dylib`_pthread_start + 176\r\n    frame #30: 0x00007fff8e1703ed libsystem_pthread.dylib`thread_start + 13\r\n```"},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/163585459","html_url":"https://github.com/dotnet/corefx/issues/3790#issuecomment-163585459","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/3790","id":163585459,"user":{"login":"vijaykota","id":11638339,"avatar_url":"https://avatars.githubusercontent.com/u/11638339?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaykota","html_url":"https://github.com/vijaykota","followers_url":"https://api.github.com/users/vijaykota/followers","following_url":"https://api.github.com/users/vijaykota/following{/other_user}","gists_url":"https://api.github.com/users/vijaykota/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaykota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaykota/subscriptions","organizations_url":"https://api.github.com/users/vijaykota/orgs","repos_url":"https://api.github.com/users/vijaykota/repos","events_url":"https://api.github.com/users/vijaykota/events{/privacy}","received_events_url":"https://api.github.com/users/vijaykota/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T11:35:50Z","updated_at":"2015-12-10T11:35:50Z","body":"This is some issue with the DarwinSsl backend used by libcurl. The foll. C pgm which directly uses libcurl fails for 2000 requests. By relinking with a libcurl that uses OpenSsl backend instead, the program succeeds. So closing this as an external issue.\r\n\r\n````\r\n\tmulti = curl_multi_init();\r\n\tfor(i = 0; i < n; i++) easyinit(multi);\r\n\twhile(count)\r\n\t{\r\n\t\tint queue;\r\n\t\tcode = curl_multi_perform(multi, &count);\r\n\t\twhile((msg = curl_multi_info_read(multi, &queue)))\r\n\t\t{\r\n\t\t\tCURL* easy = msg->easy_handle;\r\n\t\t\tcode = curl_multi_remove_handle(multi, easy);\r\n\t\t\tcurl_easy_cleanup(easy);\r\n\t\t}\r\n\t\tcode = curl_multi_wait(multi, NULL, 0, 60 * 1000, NULL);\r\n\t}\r\n\r\nvoid easyinit(CURLM* multi)\r\n{\r\n\tCURL* easy;\r\n\teasy = curl_easy_init();\r\n\tcurl_easy_setopt(easy, CURLOPT_HEADER, 0L);\r\n\tcurl_easy_setopt(easy, CURLOPT_URL, \"https://httpbin.org/status/404\");\r\n\tcurl_easy_setopt(easy, CURLOPT_PRIVATE, easy);\r\n\tcurl_easy_setopt(easy, CURLOPT_VERBOSE, 0L);\r\n\tcurl_easy_setopt(easy, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);\r\n\tcurl_easy_setopt(easy, CURLOPT_NOSIGNAL, 1L);\r\n\tcurl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);\r\n\tcurl_multi_add_handle(multi, easy);\r\n}\r\n\r\n````\r\n\r\n"}}