Bug 13573 – std.net.curl doesn't handle exceptions in callbacks

Status
REOPENED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-10-04T08:05:45Z
Last change time
2024-12-01T16:22:38Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: phobos#9643 →

Comments

Comment #0 by code — 2014-10-04T08:05:45Z
cat > bug.d << CODE import std.net.curl; void main() { auto http = HTTP("dlang.org/non-existing-url"); http.onReceiveStatusLine = (HTTP.StatusLine s) { if (s.code != 200) throw new Exception("Request failed."); }; http.method = HTTP.Method.head; http.perform(); } CODE dmd -L-lcurl -run bug ---- This program segfaults because the D exception handling cannot unwind through the C stack of libcurl. What's needed here is either a nothrow requirement on the callbacks or an exception catch/rethrow mechanism.
Comment #1 by bugzilla — 2019-12-17T08:48:25Z
I'm getting "[email protected](8): Request failed." Feel free to reopen, when the bug still exists on your computer.
Comment #2 by moonlightsentinel — 2019-12-17T11:50:14Z
Can reproduce it locally but only for 64-bit builds. dmd -g -m64 -run bug.d segfaults but dmd -g -m32 -run bug.d prints the expected stack trace
Comment #3 by bugzilla — 2019-12-17T12:27:59Z
For me -m64 works and with -m32 I get a linker error: Scrt1.o cannot be found...
Comment #4 by moonlightsentinel — 2019-12-17T12:30:09Z
Wow. SHould've mentioned that this was tested on Win 10, 64 Bit with v2.089.0
Comment #5 by robert.schadek — 2024-12-01T16:22:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9643 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB