9

Occasionally, nginx doesn't send any data back to the browser (ERR_EMPTY_RESPONSE in Chrome).

Upon checking the server error.log, I find these weird messages:

2013/10/20 23:57:40 [alert] 29146#0: *35 pread() read only 4653 of 4656 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:57:45 [alert] 29146#0: *36 pread() read only 4653 of 4656 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:18 [alert] 29146#0: *38 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:18 [alert] 29146#0: *39 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/20 23:58:19 [alert] 29146#0: *40 pread() read only 4650 of 4653 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:21 [alert] 29146#0: *41 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:21 [alert] 29146#0: *42 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:23 [alert] 29146#0: *43 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:31 [alert] 29146#0: *44 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"
2013/10/21 00:02:46 [alert] 29146#0: *45 pread() read only 4629 of 4641 from "~/htdocs/index.html" while sending response to client, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

Does anyone have any idea why this happens? After a while everything is served correctly again.

Alix Axel
  • 2,653
  • 6
  • 28
  • 28

2 Answers2

4

I found this russian forum thread that says it's related to open_file_cache directives.

Makes sense, as I am using Sublime Text and it doesn't do atomic file saves.

Alix Axel
  • 2,653
  • 6
  • 28
  • 28
1

I have been the same issue, after many searches, its resolved by open_log_file_cache

open_log_file_cache      max=20000 inactive=30s min_uses=2;

It's not related to your question but for other visitors who searching for best practice of nginx file caching, this is my full file cache config after many searches and take many benchmarks.

# cache information about FDs, frequently accessed files
aio                      threads; # linux kernel > 2.6.22
open_file_cache          max=10000 inactive=120s; # removed from the cache if it has not been accessed during `inactive` time
open_file_cache_valid    120s; # Sets a time after which open_file_cache elements should be validated.
open_file_cache_min_uses 2; # Sets the minimum number of file accesses during the period configured by the inactive parameter
open_file_cache_errors   off; # Enables or disables caching of file lookup errors by open_file_cache.
open_log_file_cache      max=20000 inactive=30s min_uses=2;
Eddie C.
  • 487
  • 1
  • 3
  • 12
Ali.MD
  • 111
  • 3