{"action":"created","issue":{"url":"https://api.github.com/repos/curl/curl/issues/997","repository_url":"https://api.github.com/repos/curl/curl","labels_url":"https://api.github.com/repos/curl/curl/issues/997/labels{/name}","comments_url":"https://api.github.com/repos/curl/curl/issues/997/comments","events_url":"https://api.github.com/repos/curl/curl/issues/997/events","html_url":"https://github.com/curl/curl/issues/997","id":175429131,"number":997,"title":"windows libcurl, crash in getaddrinfo_thread.","user":{"login":"zcg19","id":22045466,"avatar_url":"https://avatars.githubusercontent.com/u/22045466?v=3","gravatar_id":"","url":"https://api.github.com/users/zcg19","html_url":"https://github.com/zcg19","followers_url":"https://api.github.com/users/zcg19/followers","following_url":"https://api.github.com/users/zcg19/following{/other_user}","gists_url":"https://api.github.com/users/zcg19/gists{/gist_id}","starred_url":"https://api.github.com/users/zcg19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcg19/subscriptions","organizations_url":"https://api.github.com/users/zcg19/orgs","repos_url":"https://api.github.com/users/zcg19/repos","events_url":"https://api.github.com/users/zcg19/events{/privacy}","received_events_url":"https://api.github.com/users/zcg19/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/curl/curl/labels/crash","name":"crash","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-09-07T07:11:49Z","updated_at":"2016-09-11T08:44:40Z","closed_at":null,"body":"### I did this\r\nI use libcurl in a dll, and export a fuction. dll code sample:\r\nint  send_http_msg(const char * msg, int timeout_second)\r\n{\r\n\tcurl_easy_init();\r\n\r\n\t// ...\r\n\tcurl_easy_setopt();\r\n\r\n\tcurl_easy_perform();\r\n\tcurl_easy_cleanup();\r\n}\r\n\r\nThe program load this DLL and call send_http_msg(msg, 3). \r\nThen free this DLL when send_http_msg() is returned. \r\n\r\nHere is a question. \r\nThe thread of getaddrinfo_thread() will can not be executed completely, when getaddrinfo() takes more than 3s.  But DLL has been released. Then program will be crash.\r\n\r\nI trace the code and find it will do Curl_thread_destroy() when timeout. \r\n\r\ncurl_threads.c\r\nvoid Curl_thread_destroy(curl_thread_t hnd)\r\n{\r\n  CloseHandle(hnd);\r\n}\r\n\r\n\r\n### curl/libcurl version\r\nlibcurl1.46.0\r\n\r\n\r\n### operating system\r\nwindows(xp, win7)\r\n"},"comment":{"url":"https://api.github.com/repos/curl/curl/issues/comments/246169195","html_url":"https://github.com/curl/curl/issues/997#issuecomment-246169195","issue_url":"https://api.github.com/repos/curl/curl/issues/997","id":246169195,"user":{"login":"bagder","id":177011,"avatar_url":"https://avatars.githubusercontent.com/u/177011?v=3","gravatar_id":"","url":"https://api.github.com/users/bagder","html_url":"https://github.com/bagder","followers_url":"https://api.github.com/users/bagder/followers","following_url":"https://api.github.com/users/bagder/following{/other_user}","gists_url":"https://api.github.com/users/bagder/gists{/gist_id}","starred_url":"https://api.github.com/users/bagder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagder/subscriptions","organizations_url":"https://api.github.com/users/bagder/orgs","repos_url":"https://api.github.com/users/bagder/repos","events_url":"https://api.github.com/users/bagder/events{/privacy}","received_events_url":"https://api.github.com/users/bagder/received_events","type":"User","site_admin":false},"created_at":"2016-09-11T08:44:40Z","updated_at":"2016-09-11T08:44:40Z","body":"Okay, so this problem happens because you rip out the carpet from underneath the thread so there's nothing to come back to. It would be a bit unfortunate to add that wait -for-the-last thread now since it'll introduce blocking behaviors. I could agree to us adding another flag to `curl_global_init()` for this purpose, but that would be a new feature and isn't strictly a bug fix.\r\n\r\nI propose that we document this \"limitation\" somehow, although I'm not sure exactly where we would write this. Where would someone in this situation look for clues? The `curl_global_cleanup` man page? The docs talking about multi-threading?"}}
{"actor":{"display_login":"bagder"}}