[luci] "mod_cgi.c write() failed due to: Broken pipe"when uploading using luci over slow connection with lighttpd

Kiran kiran at gadgeon.com
Thu Sep 3 20:04:44 CEST 2015


Hi ,

We have a device with web-interface implemented using Luci and served by 
lighttpd.

This is the LuCi handler function which handles the uploaded data given 
to it by lighttpd in chunks:

|====================
function(meta, chunk, eof)
         io.stderr:write("firmware setfilehandler\n")
         if not fp then
                 io.stderr:write("if not fp\n")
                 if meta then
                         io.stderr:write("if meta\n")
                         if rfu_file_name ~= nil then
                                 io.stderr:write("if rfu_file_name ~= nil\n")
                                 fp = io.open(rfu_path .. rfu_file_name, "w")
                         else
                                 io.stderr:write("if rfu_file_name ~= nil   ELSE\n")
                                 fp = io.open(rfu_path .. meta.file, "w")
                         end
                 end
         end
         if chunk then
                 io.stderr:write("chunk\n")
                 fp:write(chunk)
         end
         if eof then
                 io.stderr:write("eof\n")
                 fp:close()
         end
end
|

|====================

|
When the connection speed is high (160 KB/sec) the upload completes 
successfully. But when the connection speed is slow ( 32 KB/sec), the 
upload fails with http code 500 ( Internal server error). I could see 
that the chunk files are getting created. But the log file show :

    *mod_cgi.c write()  failed due to:  Broken pipe**
    *


My guess is that the CGI process is already timed  out or killed when 
lighttpd start writing the chunk data to the pipe. Is that correct? How 
can I stop the CGI process from timing out? Is there a timeout parameter 
I can set?

ThanksRegards,
Kiran G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20150903/0a07d413/attachment.html>


More information about the luci mailing list