From: Bill Kelly Date: 2003-06-19T22:17:41+09:00 Subject: Re: TCP/IP protocol and Net::HTTP Hi, From: "Nigel Gilbert" > I am beginning to wonder if this problem arises from the MacOS X > implementation of ruby. [...] > On the other hand, I get the timeout error on MacOS X both at home > (with a cable modem connection) and at my university (with a direct > connection to the internet). Hi, I get the same timeout on OS X (over a DSL business line) with: ruby 1.6.7 (2002-03-01) [powerpc-darwin6.3] I ran a tcpdump when executing the Net::HTTP.get_print 'ad.doubleclick.net', '/' line and was surprised to see NO tcp packets transmitted to ad.doubleclick.net at any time. I ran a ktrace - but it's my first time using it and I'm not sure how to interpret what I'm seeing.. :) Why is the SIGALRM happening before the socket calls? The call listed as taking all the time is the "51.224883 CALL socket(0x2,0x1,0x6)"... 23026 ruby 0.001869 PSIG SIGVTALRM caught handler=0x1a0334 mask=0x0 code=0x0 23026 ruby 0.000121 CALL sigreturn(0xbffcc660) 23026 ruby 0.000047 RET sigreturn JUSTRETURN 23026 ruby 0.003751 CALL gettimeofday(0xbffbc350,0) 23026 ruby 0.000130 RET gettimeofday 1056027683/0x3ef1b423 23026 ruby 0.000040 CALL gettimeofday(0xbffbc2b0,0) 23026 ruby 0.000030 RET gettimeofday 1056027683/0x3ef1b423 23026 ruby 0.000032 CALL gettimeofday(0xbffbbfe0,0) 23026 ruby 0.000030 RET gettimeofday 1056027683/0x3ef1b423 23026 ruby 0.000029 CALL select(0,0xbffbc050,0xbffbc0d0,0xbffbc150,0xbffbc1d0) 23026 ruby 0.000036 RET select 0 23026 ruby 51.224883 CALL socket(0x2,0x1,0x6) 23026 ruby 0.000232 RET socket 7 23026 ruby 0.000042 CALL fcntl(0x7,0x3,0) 23026 ruby 0.000031 RET fcntl 2 23026 ruby 0.000071 CALL fcntl(0x7,0x4,0x6) 23026 ruby 0.000044 RET fcntl 0 23026 ruby 0.000030 CALL connect(0x7,0x47eba0,0x10) 23026 ruby 0.000120 RET connect -1 errno 36 Operation now in progress 23026 ruby 0.000056 CALL gettimeofday(0xbffbe760,0) 23026 ruby 0.000033 RET gettimeofday 1056027734/0x3ef1b456 23026 ruby 0.000029 CALL select(0x9,0xbffbe7d0,0xbffbe850,0xbffbe8d0,0xbffbe950) 23026 ruby 0.000038 RET select 0 23026 ruby 0.000974 CALL gettimeofday(0xbffbc350,0) 23026 ruby 0.000223 RET gettimeofday 1056027734/0x3ef1b456 23026 ruby 0.001292 CALL sigprocmask(0x3,0x2178a4,0) 23026 ruby 0.000132 RET sigprocmask 0 23026 ruby 0.001001 CALL sigprocmask(0x3,0x2178a4,0) 23026 ruby 0.000097 RET sigprocmask 0 23026 ruby 0.000107 CALL write(0x1,0x342000,0xc) 23026 ruby 0.000081 GIO fd 1 wrote 12 bytes "TimeoutError" ...anyway... On a lark I became curious about DNS lookup time and tried from the shell: $ host ad.doubleclick.net ...and it took an awful long time to come back under OS X. So from ruby I tried the literal IP addr for ad.doubleclick.net: irb(main):007:0> Net::HTTP.get_print '216.73.86.70', '/' This is a DoubleClick advertising server.

Click here for the DoubleClick home page.

Click here for privacy information. nil The above is under OS X... So it *seems* maybe some DNS related thing under OS X and not Ruby specifically..... (?) Hope this helps, Bill