Thread overview
[Issue 4951] New: InternetAddress fails to resolve host when multithreading.
Sep 28, 2010
jcao219@gmail.com
Oct 18, 2010
Stephan Dilly
Oct 18, 2010
Stephan Dilly
Oct 18, 2010
Jimmy Cao
Oct 18, 2010
Stephan Dilly
Oct 18, 2010
Stephan Dilly
Oct 19, 2010
Stephan Dilly
September 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951

           Summary: InternetAddress fails to resolve host when
                    multithreading.
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jcao219@gmail.com


--- Comment #0 from jcao219@gmail.com 2010-09-27 20:30:58 PDT ---
When multiple instances of std.socket's InternetAddress are created,
"std.socket.AddressException: Unable to resolve host 'www.google.com'"
On Linux, it works.
If you take out the threading, this works fine.

import core.thread;
import std.socket;
import std.stdio;

void test() {
  auto a = new InternetAddress("www.google.com", 80);
  a = new InternetAddress("www.google.com", 80);
  writeln("Connected successfuly.");
}

void main() {
  auto thr = new Thread(&test);
  thr.start();
}

Build 9/27/2010 on both Windows XP and 7.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951



--- Comment #1 from Stephan Dilly <spam@extrawurst.org> 2010-10-17 17:54:49 PDT ---
I get the feeling this is somehow related to 1126 because it does not just happen for InternetAddresses created in multiple threads. Say you create those instances in the main thread and then try to create a Socket in another thread it crashes again saying unable to create socket.

This seems to be an very ancient beast in phobos or whereever and since D trys to be especially concurrency friendly i advice to address this issue in the near future.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951


Stephan Dilly <spam@extrawurst.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


--- Comment #2 from Stephan Dilly <spam@extrawurst.org> 2010-10-17 17:56:36 PDT ---
I raised this one cause it pretty much makes using multithreading in connection with phobos Sockets impossible. Which sucks a lot and blocks my current project (yet again)...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951



--- Comment #3 from Jimmy Cao <jcao219@gmail.com> 2010-10-17 18:21:04 PDT ---
Also blocks mine so I advocate the raise

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951



--- Comment #4 from Stephan Dilly <spam@extrawurst.org> 2010-10-18 13:56:04 PDT ---
(In reply to comment #3)
> Also blocks mine so I advocate the raise

Did you workaround it anyhow ? I cannot think of anything even remotly possible without heavily changing the whole design ;(

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951



--- Comment #5 from Stephan Dilly <spam@extrawurst.org> 2010-10-18 14:54:06 PDT ---
i rechecked this issue and the reproduction code.
the following code reproduces the crash for sure ( the original code did not,
at least under dmd2045 )

[CODE]
import core.thread;
import std.socket;
import std.stdio;

void test() {
    auto a = new InternetAddress("www.google.com", 80);
    writeln("Connected successfuly.");
}

void main() {
    auto thr = new Thread(&test);
    thr.start();

    scope(failure) writefln("crash");

    foreach(i; 0..10)
        auto a = new InternetAddress("www.google.com", 80);
}
[/CODE]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951



--- Comment #6 from Stephan Dilly <spam@extrawurst.org> 2010-10-19 05:32:35 PDT ---
according to

http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=119946

bug #4344 seems also have a relation to this one.

for the lazy: http://d.puremagic.com/issues/show_bug.cgi?id=4344

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4951


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy@yahoo.com
         Resolution|                            |FIXED


--- Comment #7 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-10-19 06:17:29 PDT ---
Fixed in changeset http://www.dsource.org/projects/phobos/changeset/2107

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------