---1714793096-547517730-992367038=:10007
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hi all,
I suppect that there is bug in both kernel 2.2.19 and 2.4.5.
The situation is as follow.
One server socket created and listening, blocking on select(),
once a client connect to that port, there is another thread in server
side issues a close() to the new connection.
After the client close the connection. The connection in server side will
stuck on CLOSE_WAIT forever until the program being killed.
I have attached a program to trigger the bug.
The program is written base on a bugtraq post on this link:
http://archives.indenial.com/hypermail/bugtraq/1999/January1999/0015.html
This is the output of "netstat -anop":
tcp 1 0 127.0.0.1:52882 127.0.0.1:1031 CLOSE_WAIT - off (0.00/0/0)
tcp 1 0 127.0.0.1:52882 127.0.0.1:1030 CLOSE_WAIT - off (0.00/0/0)
You can see that there is no owner and the timer is off.
I encounter this in my server program and the CLOSE_WAIT thread eat up
all the resource as it cannot be released.
I have tried this on kernel 2.2.16, 2.2.19, 2.4.5 and using
gcc version 2.96 20000731 (Red Hat Linux 7.0), all this have such problem.
I am new to kernel hacking. I don't know whether this is a bug or not.
Please correct me if I am doing something wrong and forgive my poor
description. :)
Thanks
Dicky
PS. Please CC: dicky@sinocdn.com when reply.
---1714793096-547517730-992367038=:10007
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="CLOSE_WAIT_test.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0106130130380.10007@sinocdn.com>
Content-Description:
Content-Disposition: attachment; filename="CLOSE_WAIT_test.c"
Ly8gVGhpcyBwcm9ncmFtIHdpbGwga2lsbCBhIHJhbmRvbSBwb3J0IG9uIGEg
bGludXggbWFjaGluZS4gVGhlIGtlcm5lbCB3aWxsDQovLyBmb3JldmVyIGxp
c3RlbiB0byB0aGF0IHBvcnQgYW5kIHNlbmQgdGhlIGNvbm5lY3Rpb25zIG5v
d2hlcmUuIFRlc3RlZCB3aXRoDQovLyBMaW51eCBrZXJuZWwgMi4wLjM1IGFu
ZCBsaWJjLTIuMC43LiBSZXF1aXJlcyBMaW51eFRocmVhZHMgdG8gY29tcGls
Z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
ICBmcHJpbnRmKHN0ZGVyciwgIkVycm9yIDogZmQgbm90IHNldFxuIik7DQog
ICAgZXhpdCgxKTsNCiAgfQ0KfQ0KDQp2b2lkICpUaHJlYWQyKHZvaWQgKmEp
DQp7DQogIGZwcmludGYoc3Rkb3V0LCJUaHJlYWQyIDogYmVmb3JlIGNsb3Nl
IHRoZSBjbGllbnQgc29ja2V0XG4iKTsNCiAgY2xvc2Uoc29jayk7DQogIGZw
cmludGYoc3Rkb3V0LCJUaHJlYWQyIDogYWZ0ZXIgY2xvc2UgdGhlIGNsaWVu
dCBzb2NrZXRcblxuXG4iKTsNCiAgZnByaW50ZihzdGRvdXQsIlBsZWFzZSBj
bG9zZSB0aGUgcmVtb3RlIHNlc3Npb24gYW5kIGNoZWNrIHRoZSByZXN1bHRc
biIpOw0KIGZmbHVzaChzdGRlcnIpOw0KLy8gYWJvcnQoKTsNCn0NCg0Kdm9p
ZCBtYWluKHZvaWQpDQp7DQogcHRocmVhZF90IGo7DQogcHRocmVhZF9jcmVh
dGUoJmosTlVMTCxUaHJlYWQxLE5VTEwpOw0KDQogd2hpbGUgKGNvbm5lY3Rl
ZCA9PSAwKQ0KICAgdXNsZWVwKDEwMDApOyAvKiBnaXZlIHRoZSBvdGhlciB0
aHJlYWQgdGltZSB0byBmaW5pc2ggKi8NCiBwdGhyZWFkX2NyZWF0ZSgmaixO
VUxMLFRocmVhZDIsTlVMTCk7DQoNCiB3aGlsZSgxKSBzbGVlcCgxKTsNCn0N
Cg0KDQoNCg==
---1714793096-547517730-992367038=:10007--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/