Hi, I found following bug in nginx-1.8.0:
if aio is configured with threads support - sometime (one in thousands requests) $bytes_sent contains only length of the header. I'm attaching my nginx.conf, build params and simple python script I'm using the reproduce this issue. Here is the output of test script when the problem appears: . . . received: 101700000 from access_log : 101700000 on 26 iteration 127.0.0.1 - - [15/May/2015 17:27:45] "GET /test HTTP/1.0" 200 - 127.0.0.1 - - [15/May/2015 17:27:47] "GET /test HTTP/1.0" 200 - received: 101700000 from access_log : 101700000 on 27 iteration 127.0.0.1 - - [15/May/2015 17:27:58] "GET /test HTTP/1.0" 200 - 127.0.0.1 - - [15/May/2015 17:28:00] "GET /test HTTP/1.0" 200 - received: 101700000 from access_log : 101690000 on 28 iteration test failed!! also in access_log file" . . . 10170 GET /test HTTP/1.1 10170 GET /test HTTP/1.1 10170 GET /test HTTP/1.1 170 GET /test HTTP/1.1 10170 GET /test HTTP/1.1 10170 GET /test HTTP/1.1 . . Best regards, George
nginx.conf
Description: Binary data
my_configure
Description: Binary data
#!/usr/bin/env python
import os
import time
import urllib2
import threading
from BaseHTTPServer import BaseHTTPRequestHandler
ACCESS_LOG = './run_nginx-1.8.0/access_log'
class GetHandler(BaseHTTPRequestHandler):
def do_GET(self):
# print "do_GET"
resp = 'a' * 10000
self.send_response(200)
self.send_header('Cache-Control', 'max-age=1')
self.send_header('Content-Type', 'text/html')
self.send_header('Date', 'Thu, 24 Nov 2011 16:28:33 GMT')
self.send_header('Content-Length', len(resp))
self.end_headers()
self.wfile.write(resp)
def main():
from BaseHTTPServer import HTTPServer
server = HTTPServer(('localhost', 8081), GetHandler)
thread = threading.Thread(target = server.serve_forever)
thread.daemon = True
thread.start()
url = 'http://127.0.0.1:8080/test'
num_tests = 0
while True:
open(ACCESS_LOG, 'w').close() # empty access log file
received_total_bytes = 0
for i in xrange(10000):
try:
request = urllib2.Request(url)
request.add_header('Host', 'rp-test.com')
response = urllib2.urlopen(request)
data = response.read()
received_total_bytes += len(data) + len(str(response.headers)) + 19
except urllib2.HTTPError as e:
print "error", e
exit()
if len(data) + len(str(response.headers)) + 19 != 10170:
print len(data) + len(str(response.headers)) + 19, len(data), len(str(response.headers))
#print response.headers
#print "^^^^^^^^^^^^^^^^^^^^^^^^"
exit(1)
time.sleep(10) # wait some time to flush access_log
access_log_total_bytes = 0
f = open(ACCESS_LOG)
for line in f.xreadlines():
bytes_sent = int(line.split(' ')[0])
access_log_total_bytes += bytes_sent
f.close()
num_tests += 1
print 'received:', received_total_bytes, 'from access_log :', access_log_total_bytes, 'on', num_tests, 'iteration'
if received_total_bytes != access_log_total_bytes:
print 'test failed!!!'
exit(1)
# os.remove(ACCESS_LOG)
return True
if __name__ == '__main__':
main()
_______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
