Comment #0 by farukerdemoncel — 2016-11-25T17:16:27Z
I try to compile this program from std.net.curl
import std.net.curl, std.stdio;
void main()
{
auto range1 = byLineAsync("www.google.com");
auto range2 = byLineAsync("www.wikipedia.org");
foreach (line; byLineAsync("dlang.org"))
writeln(line);
foreach (line; range1) writeln(line);
foreach (line; range2) writeln(line);
}
I compile this program like this.
$ dmd internet.d -ofinternet
or
dmd -I/usr/include/dmd/phobos -L-l:libcurl.so.4.2.0 internet.d -ofinternet
The program compiles fine but it throws an exception.
std.concurrency.PriorityMessageException@std/concurrency.d(273): Priority message
----------------
??:? _D3std11concurrency10MessageBox160__T3getTDFS3std11concurrency3TidS3std3net4curl21__T11CurlMessageTAyaZ11CurlMessageZbTDFS3std11concurrency3TidS3std3net4curl19__T11CurlMessageTbZ11CurlMessageZbZ3getMFDFS3std11concurrency3TidS3std3net4curl21__T11CurlMessageTAyaZ11CurlMessageZbDFS3std11concurrency3TidS3std3net4curl19__T11CurlMessageTbZ11CurlMessageZbZ3ptyMFKS3std11concurrency36__T4ListTS3std11concurrency7MessageZ4ListZb [0x81d03f4]
??:? bool std.concurrency.MessageBox.get!(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)).get(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)) [0x81cfeed]
??:? void std.concurrency.receive!(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)).receive(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)) [0x81cfd08]
??:? void std.net.curl.AsyncLineInputRange!(char).AsyncLineInputRange.__mixin5.tryEnsureUnits() [0x81ccb87]
??:? @property bool std.net.curl.AsyncLineInputRange!(char).AsyncLineInputRange.__mixin5.empty() [0x81cc7db]
??:? _Dmain [0x81b47b8]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x81d9292]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x81d91dc]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x81d924e]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x81d91dc]
??:? _d_run_main [0x81d916e]
??:? main [0x81d3393]
??:? __libc_start_main [0x129532]
Sometimes it prints the web page's html content as expected but again it throws this exception.
Steps to Reproduce:
1) Run Ubuntu 12.04 from memory stick.
2) Fresh install dmd
3) Try to compile and run program.
$ dmd -v
DMD32 D Compiler v2.072.0
Ubuntu 12.04 LTS
Comment #1 by razvan.nitu1305 — 2016-12-20T09:42:57Z
Cannot reproduce on Ubuntu 16.04 LTS 64-bit, latest version of the compiler :
DMD64 D Compiler v2.073.0-devel-878b882.
Comment #2 by farukerdemoncel — 2016-12-26T18:19:41Z
I ran your program 15x on my machine with 2.074.0 and 2.075.0-b4 and couldn't reproduce this. Closing this as WORKSFORME then - please reopen if this is still an issue for you with the latest release.
Comment #4 by farukerdemoncel — 2017-07-23T11:19:08Z
Comment #5 by farukerdemoncel — 2017-07-23T11:21:21Z
$ dmd -v
DMD64 D Compiler v2.074.1
Comment #6 by hallimanearavind — 2018-01-23T11:52:24Z
Easy to reproduce if URL is invalid or the server is down
import std.net.curl, std.stdio;
void main()
{
foreach (line; byLineAsync("dlang.org1"))
writeln(line);
}
I think patch required to raise proper exception.
Comment #7 by bugzilla — 2021-04-27T16:28:28Z
Some analysis: Function pty
https://github.com/dlang/phobos/blob/master/std/concurrency.d#L2239
receives a VariantN containing a
"std.net.curl.CurlException@/home/D/Repo/dmd/generated/linux/release/64/../../../../../phobos/std/net/curl.d(5279):
Couldn't resolve host name on handle 5654F7BC4F50"
but cannot convert this to Throwable and hence throws a PriorityMessageException.
I think that the "convertsTo" check doesn't work correctly and thus does not throw this exception as expected. (I know too little about std.variant to continue here.)
Further, I think, the PriorityMessageException could be improved to tell more details about its parameter "vals" in its message. Maybe
super("Priority message: " ~ vals.stringof);
would be better.
Comment #8 by robert.schadek — 2024-12-01T16:28:18Z