D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20120 - libcurl.dll hangs when running std.net.curl unittests
Summary: libcurl.dll hangs when running std.net.curl unittests
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: installer (show other issues)
Version: D2
Hardware: All Windows
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-08-11 08:06 UTC by Rainer Schuetze
Modified: 2019-08-20 13:19 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Schuetze 2019-08-11 08:06:14 UTC
It seems the distribuuted libcurl.dll is broken since 2.072: executing

dmd -unittest -main -run <phobos-path>\std\net\curl.d

freezes until some timeout expires after a couple of minutes. The same happens with -m64.

The unittests pass with the DLL that comes with dmd 2.071 or the ones from the LDC distro.
Comment 1 Rainer Schuetze 2019-08-11 08:30:39 UTC
Might be related to the version of libcurl: LDC comes with version 7.48.0, and the regression happened when upgrading from 7.47.1 to 7.51.0
Comment 2 kinke 2019-08-11 08:40:43 UTC
(In reply to Rainer Schuetze from comment #1)
> Might be related to the version of libcurl: LDC comes with version 7.48.0,
> and the regression happened when upgrading from 7.47.1 to 7.51.0

Yes, exactly because we get CI failures with newer libcurl versions. I initially thought it may be specific to how it is built (compilation options, linked MSCRT etc.), so I tried to build the last libcurl versions myself [a while ago], but failed to produce a working one.
Comment 3 Rainer Schuetze 2019-08-11 08:47:09 UTC
Yeah, just tried to rebuild it, too. There are a lot of vulnerabilities fixed since curl 7.48, so an update would be recommended. Maybe there is just something wrong with the tests?
Comment 4 Rainer Schuetze 2019-08-12 06:21:59 UTC
bisecting curl shows this commit as the offender: https://github.com/curl/curl/commit/72d5e144fbc6a9db264ae425bb788af218f25d9e

defining DONT_USE_RECV_BEFORE_SEND_WORKAROUND when compiling curl lets the std.net.curl unittests pass. Not sure who's to blame, though.

From the discussions in the referenced issues, the curl developers were not too convinced about the patch. Maybe it is also Windows version specific.
Comment 5 Dlang Bot 2019-08-12 06:32:15 UTC
@rainers updated dlang/installer pull request #399 "fix issue 20210 - libcurl.dll hangs when running std.net.curl unittests" fixing this issue:

- fix issue 20120 - libcurl.dll hangs when running std.net.curl unittests
  
  disable the workaround introduced in https://github.com/curl/curl/commit/72d5e144fbc6a9db264ae425bb788af218f25d9e
  as it is causing the issue and the curl developers were not really convinced
  
  disabled by defining DONT_USE_RECV_BEFORE_SEND_WORKAROUND when compiling curl

https://github.com/dlang/installer/pull/399
Comment 6 Seb 2019-08-12 06:40:28 UTC
Maybe sth is wrong with the test server that is spawned to handle these test requests? It's a simple while loop after all.
BTW how does this pass on the Auto-Tester? Isn't 2.079 used there?
Comment 7 Rainer Schuetze 2019-08-12 07:27:43 UTC
(In reply to Seb from comment #6)
> Maybe sth is wrong with the test server that is spawned to handle these test
> requests? It's a simple while loop after all.

The problem is reproducible locally.

> BTW how does this pass on the Auto-Tester? Isn't 2.079 used there?

I suspect the DLLs have never been updated on the build machines. They sit in a folder outside the build directories, see for example

https://github.com/braddr/at-client/blob/8a2a2743716fcfde13d5ab0856bd4b5a0e403851/configs/WIN-F30QP0PU8L1#L23
Comment 8 Dlang Bot 2019-08-20 13:19:43 UTC
dlang/installer pull request #399 "fix issue 20120 - libcurl.dll hangs when running std.net.curl unittests" was merged into build-curl:

- 4c8aabf637e2677cd705dc94cf00815064690388 by Rainer Schuetze:
  fix issue 20120 - libcurl.dll hangs when running std.net.curl unittests
  
  disable the workaround introduced in https://github.com/curl/curl/commit/72d5e144fbc6a9db264ae425bb788af218f25d9e
  as it is causing the issue and the curl developers were not really convinced
  
  disabled by defining DONT_USE_RECV_BEFORE_SEND_WORKAROUND when compiling curl

https://github.com/dlang/installer/pull/399