Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo
Updates:
        Status: Started
        Labels: -Milestone-1.2 Milestone-1.2.2 Milestone-1.3

Comment #7 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

This change lead to problems with Magma (see discussion on the mailinglist)

needs to be analyzed for fix or rolback.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo

Comment #8 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

Just bench it:

Before change:

  [ NetNameResolver localHostAddress ] bench   " '34,000 per second.' "

After change:

  [ NetNameResolver localHostAddress ] bench   " '31 per second.' "

In just looking at the reason given for making the change, it says
this is to satisfy an _exceptional_ case; e.g., the case where "no
network connection is available."

Then I look at the new code called by #localHostAddress and becomes obvious  
why:

isConnected
        "Dirty, but avoids fixing the plugin bug"
        [NetNameResolver addressForName: 'www.esug.org'.] on:
NameLookupFailure do: [:ex| ^false].
        ^true

A hard-coded nslookup to 'www.esug.org' wrapped in an exception-handler?  
Wow!

If this isn't enough, you can run the Magma test-suite to see the
effect on a real-world networking application.

I recommend Pharo crew revert this change and consider a different approach.

- Chris



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo

Comment #9 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

It's much slower on Unix than what you'd see on Mac or Windows because....

/* Note: the Mac and Win32 implementations implement asynchronous lookups
  * in the DNS.  I can't think of an easy way to do this in Unix without
  * going totally ott with threads or somesuch.  If anyone knows differently,
  * please tell me about it. - Ian
  */


/*** irrelevancies ***/

void sqResolverAbort(void) {}

void sqResolverStartAddrLookup(sqInt address)
{
   const char *res;
   res= addrToName(address);
   strncpy(lastName, res, MAXHOSTNAMELEN);
   FPRINTF((stderr, "startAddrLookup %s\n", lastName));
}

Note how the ResolverSemaphore isn't signaled?
So it ALWAYS waits for the deadline when doing address lookup in:
NetNameResolver class >> #addressForName: timeout:
"snip"
        deadline := Time millisecondClockValue + (secs * 1000).
        "Protect the execution of this block, as the ResolverSemaphore is used for  
both parts of the transaction."
        self resolverMutex
                critical: [
                        (self waitForResolverReadyUntil: deadline)
                                ifTrue: [
                                        self primStartLookupOfName: hostName.
                                        (self waitForCompletionUntil: deadline)


Yay.




_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo

Comment #10 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

The above platform code is in sqUnixSocket.c, btw.


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo

Comment #11 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

Anyways, I agree the change itself is a horrible horrible hack and should  
be reverted until a better solution is found :)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo
Updates:
        Status: FixProposed

Comment #12 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

A fix proposed by Chris Muller on

Network-Kernel-cmm.55.mcz on PharoInbox.

Ready to integrate to both 1.2 and 1.3


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo

Comment #13 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

in 12349

TODO: 1.3


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 1853 in pharo: NetNameResolver localHostAddress returns public or private address instead of loopback address.

pharo
Updates:
        Status: Closed

Comment #14 on issue 1853 by [hidden email]: NetNameResolver  
localHostAddress returns public or private address instead of loopback  
address.
http://code.google.com/p/pharo/issues/detail?id=1853

in 13168


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker