On 29.09.2012 22:17, Matthias Bolte wrote:
libcurl uses a SIGALRM in combination with sigsetjmp/siglongjmp to
be
able to abort a DNS lookup when it takes too long. The problem with this
in a multi-threaded application is that the signal handler for SIGALRM
and the call to siglongjmp can be executed on a thread that is different
from the one that initially did the SIGALRM setup and the call to
sigsetjmp. In the reported case this triggered a segfault.
Disable libcurl's use of signals to avoid this situation. This has the
disadvantage of losing the ability to abort DNS lookups which might result
in libcurl getting stuck in a DNS lookup in the worst case.
Reported by Benjamin Wang.
---
src/esx/esx_vi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 275b858..125eaee 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -330,6 +330,7 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
}
curl_easy_setopt(curl->handle, CURLOPT_USERAGENT, "libvirt-esx");
+ curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0);
curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0);
curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYPEER,
I think this is safe; From the version 7.10 curl can still timeout on
DNS lookup even with CURLOPT_NOSIGNAL set:
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTNOSIGNAL
So ACK.
Michal