get-url in Windows, timeout always long

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

get-url in Windows, timeout always long

Post by Cyril »

On Windows XP, somewhere between 10.2.1 and 10.2.4, attempt to get-url from a closed port became always waiting for 10 seconds, with no regard to time-out argument.

Code: Select all

newLISP v.10.2.1 on Win32 IPv4, execute 'newlisp -h' for more info.

> (list (date) (get-url "http://localhost:8888") (date))
("Sat May 01 21:03:28 2010" "ERR: Connection failed" "Sat May 01 21:03:29 2010")
About 1 sec pause here. But:

Code: Select all

newLISP v.10.2.4 on Win32 IPv4, execute 'newlisp -h' for more info.

> (list (date) (get-url "http://localhost:8888") (date))
("Sat May 01 21:04:45 2010" "ERR: Connection failed" "Sat May 01 21:04:55 2010")

> (list (date) (get-url "http://localhost:8888" 2000) (date))
("Sat May 01 21:05:01 2010" "ERR: Connection failed" "Sat May 01 21:05:11 2010")

> (list (date) (get-url "http://localhost:8888" 20000) (date))
("Sat May 01 21:05:31 2010" "ERR: Connection failed" "Sat May 01 21:05:41 2010")
No one process has even listen 8888 port on each case. 10.2.5 works the same as 10.2.4. I believe this is related to the new net-connect functionality in some way. Is it possible to return the old behavior, or observe a timeout parameter, or something like that? Waiting for 10 seconds is inappropriate sometimes. :-(
With newLISP you can grow your lists from the right side!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: get-url in Windows, timeout always long

Post by Lutz »

Yes, this is a bug introduced with the new timeout behavior of 'net-connect' in development version 10.2.3. If a timeout parameter is given in 'get-url', it should use it and not default to 10 seconds.

The advantage of the new connection timeout (when working correctly) is, that calls like (get-url "http://newlisp.org:8888") would hang for a very long time even with a timeout specified. Only on localhost you would get the immediate connection failure. In newLISP v.10.2.1 and previous versions the timeout parameter only worked after the connection was established. This was problem when writing web-crawlers using 'get-url' and the target server was down.

Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

Re: get-url in Windows, timeout always long

Post by Cyril »

Oh, I see now, thanks! Yes, the old versions waits for 20+ seconds on closed port on any other host but local. But some my scripts have to work with localhost. ;-) So, I'll wait for a fix, and roll back to 10.2.1 meantime.
With newLISP you can grow your lists from the right side!

Locked