www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4951] New: InternetAddress fails to resolve host when multithreading.

reply d-bugmail puremagic.com writes:
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



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: -------
Sep 27 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951




---
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: -------
Oct 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951


Stephan Dilly <spam extrawurst.org> changed:

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



---
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: -------
Oct 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951




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: -------
Oct 17 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951




---

 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: -------
Oct 18 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951




---
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: -------
Oct 18 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4951




---
according to 

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



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: -------
Oct 19 2010
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 19 2010