nginx null bytes on static image
Maxim Dounin
mdounin at mdounin.ru
Wed Oct 4 14:47:18 UTC 2017
Hello!
On Wed, Oct 04, 2017 at 08:01:48AM -0400, soulseekah wrote:
> nginx/1.12.1
>
> Creating new files with PHP (image resizing) works fine, the new files are
> served well. Then suddenly after a couple of days the file is returned as a
> sequence of NULL bytes Content-Length long.
>
> HTTP/1.1 200 OK
> Server: nginx/1.12.1
> Date: Wed, 04 Oct 2017 11:33:57 GMT
> Content-Type: image/jpeg
> Content-Length: 8915
> Last-Modified: Sun, 01 Oct 2017 19:30:46 GMT
> Connection: keep-alive
> ETag: "59d14266-22d3"
> Expires: Thu, 31 Dec 2037 23:55:55 GMT
> Cache-Control: max-age=315360000
> Accept-Ranges: bytes
>
> 00000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> ** snip **
> 000022c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 000022d0: 0000 00
>
> Looking at the file via SSH under the nginx user the file is fine:
>
> sudo -u nginx cat path/to/file.jpg | xxd
>
> 00000000: ffd8 ffe0 0010 4a46 4946 0001 0100 0001 ......JFIF......
> 00000010: 0001 0000 fffe 003b 4352 4541 544f 523a .......;CREATOR:
> 00000020: 2067 642d 6a70 6567 2076 312e 3020 2875 gd-jpeg v1.0 (u
> 00000030: 7369 6e67 2049 4a47 204a 5045 4720 7636 sing IJG JPEG v6
> 00000040: 3229 2c20 7175 616c 6974 7920 3d20 3832 2), quality = 82
> 00000050: 0aff db00 4300 0604 0405 0404 0605 0505 ....C...........
>
> Any ideas what may be going wrong?
I would suggest that there is something wrong at the OS level. In
particular, you may want to take a look at the filesystem used
and/or check if switching off sendfile fixes things.
--
Maxim Dounin
http://nginx.org/
More information about the nginx
mailing list