curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Found infinite looping in libCurl version 7.55.1

From: Uma Shunmugan via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 20 Jan 2020 14:54:19 -0500

Hi,

I'm using libcurl version 7.55.1 on Windows 64-bit. I've found an infinite
loop in Curl_splay(), which was called from Curl_splayinsert() <=
add_next_timeout() <= curl_multi_perform(). My program employs a single
thread for libcurl use, so it could not be a multi-threading issue. This
issue has only happened a couple of times, and I haven't yet found a way to
reproduce it.

It might not be a coincidence, but when this occurred, I noticed that a
time value (timeval) returned by GetTickCount() and set in the "key" for
some node in the Curl_tree passed into Curl_splay() had just wrapped around
(due to the 49.7 days limitation). Is this a known issue, or is it
possible that this could have caused Curl_splay() to get stuck in a loop?
If so, is there a fix for it? And is there any test program that I could
run against libcurl to reproduce this infinite loop issue?

BTW, I see in the libCurl changlog that high resolution timestamps are used
on Windows starting from version libcurl 7.64.0. Was this change done to
avoid similar issues as the one I have seen? Would you recommend me to
upgrade to this version? Note that my software that uses Curl is in
production.

Now, I've checked timeval.c in 7.55.1, and realized that GetTickcount64()
would have been used instead, if _WIN32_WINNT and _WIN32_WINNT_VISTA had
been defined to the correct values. It's not clear to me where/how these
macros are to be defined, though. Is there a configuration option for these
in the build? If not, could I simply define these in config-win32.h? FYI,
I had compiled libcurl on Window 2008 using Visual Studio 2005, and
obviously these macros were not defined at all.

If this issue could not be due to time value rolling over problem, is there
any other known issues that would explain this infinite looping? What else
could I do to debug this further?

Thanks,
 Uma

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-01-20