glyustb / mogilefs

Automatically exported from code.google.com/p/mogilefs
0 stars 0 forks source link

Error storing 0 byte files when using lighttpd for storage nodes #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use lighttpd as the DAV server for the MogileFS storage node
2. attempt to store a 0 byte file (see attached script for example)

What is the expected output? What do you see instead?
I expect the file to be successfully stored, but it returns an error when 
attempting to close the handle.

What version of the product are you using? On what operating system?
MogileFS::Server 2.53
lighttpd 1.4.26

Please provide any additional information below.
this bug was introduced with this commit: 
https://github.com/mogilefs/MogileFS-Server/commit/18a40d29236a8a00593f914191c9f
d16cda082db

inserting some debugging code to dump the LWP request and response gives this 
request & response:

HEAD http://172.21.1.234:7500/dev1/0/000/000/0000000056.fid
User-Agent: libwww-perl/6.02

HTTP/1.1 200 OK
Date: Wed, 14 Sep 2011 17:42:12 GMT
Accept-Ranges: bytes
Server: lighttpd/1.4.26
Content-Type: application/octet-stream
Client-Date: Wed, 14 Sep 2011 17:42:12 GMT
Client-Peer: 172.21.1.234:7500
Client-Response-Num: 1

lighttpd isn't returning a Content-Length header for 0 byte files, which is 
causing the size method to return undef which is the same response as an 
unreachable host

Original issue reported on code.google.com by daniel.frett on 14 Sep 2011 at 5:54

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the report!

Will try to get this fixed for the next release, but it may be a week or two.

Original comment by dorma...@rydia.net on 14 Sep 2011 at 6:00

GoogleCodeExporter commented 8 years ago
I filed a patch to return the Content-Length header in lighttpd 1.4.x here:

http://redmine.lighttpd.net/issues/2344

This will address the issue in new versions of lighttpd, but it doesn't solve 
the issue for existing installs without requiring an upgrade of lighttpd.

Original comment by daniel.frett on 16 Sep 2011 at 7:17

GoogleCodeExporter commented 8 years ago
Can you try the attached patch? I don't have lighttpd handy and it'd save me 
some time :)

It sounds like this is good enough; if request is a success (not a 404), but 
the content length isn't defined and the server is lighttpd, return 0. Else 
return size.

Original comment by dorma...@rydia.net on 19 Sep 2011 at 2:51

Attachments:

GoogleCodeExporter commented 8 years ago
the patch works

Original comment by daniel.frett on 21 Sep 2011 at 3:35

GoogleCodeExporter commented 8 years ago
Thanks! Pushed to master. It'll go out with the next release in a week or two.

Original comment by dorma...@rydia.net on 21 Sep 2011 at 7:12