[luci] httpclient - missing sock:close() ?

Helen Fornazier helen at wizzilab.com
Thu Feb 6 13:25:53 CET 2014


Sorry, I just see that the sock is returned in request_raw, and
request_to_source
use it, so I understand why the sock is not being closed in request_raw,
but I still don't see where the socket is being closed in
request_to_source, is there a hidden close in lines 99 or 101 ?

To be clear: request_to_buffer calls request_to_source that calls
request_raw



Thanks


Helen Fornazier


On Thu, Feb 6, 2014 at 1:09 PM, Helen Fornazier <helen at wizzilab.com> wrote:

> Hi all,
>
> I was reading the code of httpclient (here it its code
> http://luci.subsignal.org/trac/browser/luci/trunk/libs/httpclient/luasrc/httpclient.lua)
> and in the line 336 (before the last return of the function request_raw)
> it shouldn't have a sock:close() ?
>
>
> I am asking this because I am using httpclient to perform GETs
> periodically (each 30 seconds), but after a while the function request_to_buffer
> blocks and does not return.
> I check with netstat -np and I saw lots of CLOSE_WAIT state like:
>
> tcp        1      0 127.0.0.1:38842         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:38937         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:37841         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:38625         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:38172         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:37761         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:37706         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> tcp        1      0 127.0.0.1:37997         127.0.0.1:80
> CLOSE_WAIT  18603/lua
> ....
> (there is more, I won't recopy all of them here)
>
> Where 18603 is the PID of the process executing the request_to_buffer
> from time to time.
>
> So I was wondering if the missing sock:close() wouldn't be the reason.
> I didn't test adding the sock:close() because it takes a long time to
> reproduce the blockage.
>
> Maybe it is a dummy question, sorry if it is so, but I would be glad if
> someone could at least explain me why it is not missing the sock:close()
>
> Thanks
>
>
> Helen Fornazier
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20140206/e00047dc/attachment.html>


More information about the luci mailing list