You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have not fully identified what the cause it but it would appear that if a curl easy handle is put to TLS on windows, it can cause hangs on shutdown on certain versions. I'm entirely unsure what causes this and the exact conditions of the hang are very mysterious.
What we know so far is that if the handle is made and put to TLS everything is fine. If the handle however did an HTTP request first, is kept in TLS the program will hang on shutdown the first time after the HTTP request is made but if the program is run a second time it succeeds and only will start blocking again after some time has passed (6 hours?). Even a computer restart does not bring the program back to hanging. We saw this with Windows 7, Windows Server 2012.
This sounds very much like something in curl itself but it's mysterious nontheless. We currently work around by resetting the handles before shutdown on all threads that have one.
The text was updated successfully, but these errors were encountered:
Oh dear, this definitely sounds bad! I agree that this is probably a curl issue, but I can at least chime in and say that I've definitely seen my fair share of weirdness of TLS destructors and windows. At least in the standard library we have to update tests to avoid that in the past because it causes various hangs and crashes.
I've also never managed to bottom out the issues here, I've sort of just prayed all along that it's not a bug in libstd (or in this case libcurl) and it's instead just a weird Windows issue.
In any case I definitely agree that manually resetting TLS vars is the best way to go here, that'll make sure that hopefully no code executes on a TLS destructor
@alexcrichton any pointers to those hangs? I have not had much success in finding similar cases and the fact that tls on windows can cause hangs is concerning.
I think what I was remembering were cases like rust-lang/rust#20704 where if a thread is panicking while the main thread exits on windows "weird stuff happens" including either segfaults or deadlock. These were all really long ago though and we may have just fixed bugs in libstd, I certainly haven't seen anything recently
We have not fully identified what the cause it but it would appear that if a curl easy handle is put to TLS on windows, it can cause hangs on shutdown on certain versions. I'm entirely unsure what causes this and the exact conditions of the hang are very mysterious.
What we know so far is that if the handle is made and put to TLS everything is fine. If the handle however did an HTTP request first, is kept in TLS the program will hang on shutdown the first time after the HTTP request is made but if the program is run a second time it succeeds and only will start blocking again after some time has passed (6 hours?). Even a computer restart does not bring the program back to hanging. We saw this with Windows 7, Windows Server 2012.
This sounds very much like something in curl itself but it's mysterious nontheless. We currently work around by resetting the handles before shutdown on all threads that have one.
The text was updated successfully, but these errors were encountered: