http.TIMEOUT & actually timing out

I’ve noticed that a plugin I’m working on occasionally will hang (not - ever? - return) during a https.request() call.

I’ve tried having http.TIMEOUT set to 5 & 10 seconds, but I’m not getting any error or status returned from the https.request().

Is this expected behavior or, more to the point, what am I missing about catching failed http.request calls?

If only there was a Luasocket forum where we could ask these questions.

I understand that you can set up your own socket with low level socket.* calls, and set a timeout on it explicitly. You can then pass that socket to the http.request() function (long form).

This may not make any difference. Only one way to find out …

[quote=“futzle, post:2, topic:174552”]If only there was a Luasocket forum where we could ask these questions.

I understand that you can set up your own socket with low level socket.* calls, and set a timeout on it explicitly. You can then pass that socket to the http.request() function (long form).

This may not make any difference. Only one way to find out …[/quote]

I did something different and used pcall() & debug.sethook(). The pcall()/debug.sethook() combination, in theory, should have “killed” the active function - https.request() AFICT - after 1e8 Lua instructions completed.

That hasn’t happened…

Instead, slowly, but surely, all 3 of my devices that use https.request() in the same plugin context (it’s 3 different Google Latitude devices) eventually get stuck in the same spot. It’s now >10 hours later and they’re all still stuck.

The only thing that will “fix” the hung devices is a Luup/lua engine restart.

This seems like a bug?

Or is the device running its very own Lua interpreter and as a result, when the device gets stuck no new Latitude instructions are executed? I don’t think so, since variables defined in the startup routine are available in the device. To me that implies the run context for the device is a thread spawned from the startup routine/interpreter instance…?

I encounter the same problem, trying a HEAD HTTP request to a URL that does not respond. The http.request call does not respond and is blocking … apparently until lua reloads !

No difference whether setting http.TIMEOUT or setting the timeout on the socket level.

Any solution found ?

Apparently, a solution was found, consisting in using tcp layer than http layer !

http://forum.micasaverde.com/index.php/topic,11182.msg79566.html#msg79566