Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My http proxy server is listening at port 8888(IP changed for security reason):

[root@ ~]# netstat -ano|grep 8888
tcp        0      0*               LISTEN      off (0.00/0/0)
tcp        0    393    ESTABLISHED on (0.56/0/0)
tcp        0      0    ESTABLISHED off (0.00/0/0)

If I press ctrl-c to terminate the process,it still takes about 30 seconds to free the port,that is,netstat -ano|grep 8888 continues to output the above connections until 30 seconds later.

What's worse,if I refresh the pages fast,I'll get this kind of ridiculous response(I'm getting content of stack exchange when requesting for google.com):

enter image description here

What can be causing this kind of issue?

share|improve this question

migrated from stackoverflow.com May 20 '11 at 3:11

This question came from our site for professional and enthusiast programmers.

If you kill a server that is listening on a port without properly closing the socket, the port is indeed blocked until some timeout occurs. –  musiKk May 19 '11 at 14:09
You're not actually getting stackexchange, your DNS is resolving google.com to be the IP of StackExchange yet requesting the web page with a hostname of google.com, so you get the sad panda. I believe this to be a DNS issue. –  Fosco May 19 '11 at 14:10
@musiKk ,what's the timeout length? –  kern May 19 '11 at 14:12
@Fosco ,the DNS is OK,it's my proxy server that causes this...But I don't know where exactly is wrong.. –  kern May 19 '11 at 14:15
@kern if DNS was ok, you wouldn't get the sad panda. What proxy server? –  Fosco May 19 '11 at 14:16

1 Answer 1

Like musiKk said, you must follow proper shutdown procedures for your proxy. If it was designed to catch ctrl-c and shutdown gracefully, that would work. Otherwise, you leave locked resources until the system frees them. In some cases, the resource cannot be freed by the system without a restart.

Your proxy's documentation should list proper shutdown and restart commands, as well as what happens when the program receives a SIGINT or SIGHUP.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.