TCPSocket#initialize slow on Windows

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32_71]

TCPSocket.new(‘localhost’, 80) takes something like 1.5-2 sec each call.
(Test program only consists of profiling of this line with ruby-prof).

Can this be a bug or result of my misunderstanding of something
fundamental?

Thanks.

V.

Victor ‘Zverok’ Shepelev wrote:

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32_71]

TCPSocket.new(‘localhost’, 80) takes something like 1.5-2 sec each call.
(Test program only consists of profiling of this line with ruby-prof).

Can this be a bug or result of my misunderstanding of something
fundamental?

Thanks.

V.

Could try
require ‘resolv-replace’ before hand, or using 127.0.0.1 instead of
localhost.
-=R

From: [email protected] [mailto:[email protected]]
Sent: Thursday, September 04, 2008 9:01 PM

Thanks.

V.

Could try
require ‘resolv-replace’ before hand, or using 127.0.0.1 instead of
localhost.
-=R

Seems to work… today :slight_smile:

I’ve kinda tried 127.0.0.1 and it was the same slow… and after I’ve
tried
your advice and required ‘resolv-replace’, all things became fast. But
then,
when I commented out “require ‘resolv-replace’”, they are still fast.
I’m
slightly shocked for now. Are there any explanations, or just it some
kind
of network magic I’ll never debug about?

Anyway, thank you for advice.

V.

I’ve kinda tried 127.0.0.1 and it was the same slow… and after I’ve
tried
your advice and required ‘resolv-replace’, all things became fast. But
then,
when I commented out “require ‘resolv-replace’”, they are still fast.
I’m
slightly shocked for now. Are there any explanations, or just it some
kind
of network magic I’ll never debug about?

Anyway, thank you for advice.

Kind of reminds me of OS X 10.5’s DNS problems–the first lookup
sometimes takes 15s, then after that it’s cached so it’s fast. Maybe?
The fix for that on OS X was to switch to opendns name servers. Not
sure about XP tho.
-=R

Thanks for your help. It seems now the problem somewhere deeper in my
test-cases :-\

BTW, while experimenting I’ve found resolv not able to resolve LAN
names.

BTW2, I’ve also found ruby1.9’s Resolv fails with unicode errors
(reading
etc/hosts) on Russian Windows XP :slight_smile:

Hmm. Maybe a bug report?

If you’re worried the problem is XP then I suppose there’s
virtualbox+linux or andLinux or what not.
Take care!

-=R

From: [email protected] [mailto:[email protected]]
Sent: Friday, September 05, 2008 6:53 PM

Anyway, thank you for advice.

Kind of reminds me of OS X 10.5’s DNS problems–the first lookup
sometimes takes 15s, then after that it’s cached so it’s fast. Maybe?
The fix for that on OS X was to switch to opendns name servers. Not
sure about XP tho.
-=R

Thanks for your help. It seems now the problem somewhere deeper in my
test-cases :-\

BTW, while experimenting I’ve found resolv not able to resolve LAN
names.

BTW2, I’ve also found ruby1.9’s Resolv fails with unicode errors
(reading
etc/hosts) on Russian Windows XP :slight_smile:

V.