Questions tagged [time-wait]

The TIME_WAIT TCP port state

Indicates that both endpoints of a connection have closed it, and that the local end is keeping the local port in TIME_WAIT state. The system is waiting for any remaining packets to expire before closing the port. This state only lasts 2*MSL seconds where MSL is the maximum segment lifetime, typically 60 or 120 seconds.

The TIME_WAIT state is often erroneously regarded as a performance problem. It isn't, except for the length of netstat displays. However it can be avoided altogether by being the end which receives the first FIN. In practice this means the client should close the connection before the server, so that the ports in TIME_WAIT state accumulate at the client, where they are few, rather than at the server, where they are very many.

108 questions
1
vote
1 answer

In JAVA how to connection and wait for port to finish TIME_WAIT

I have a part in code that checks port availability (opens connection and immediately close it) : try{ new ServerSocket(currentConnector.getPort()).close(); } The porblem here is that the port enters a state of TIME_WAIT which differs from…
orshachar
  • 4,837
  • 14
  • 45
  • 68
1
vote
0 answers

Apache - how to test tcp_tw_reuse effect?

I'm struggling with an Apache server which runs out of ports. I believe my problem are connections in the TIME_WAIT state. I've tried net.ipv4.tcp_fin_timeout=40 and net.ipv4.tcp_tw_reuse=1. How can I test the effect of net.ipv4.tcp_tw_reuse before…
Pegrbal
  • 11
  • 1
1
vote
1 answer

what state will the active closer go when FIN-WAIT-2 time runs out?

when FIN_WAIT2 time runs out and the last FIN doesn't come from the other side,what's the next state will the active closer be? TIME-WAIT or CLOSED ? we know in linux system, FIN-WAIT-2 can be set in the file /proc/sys/net/ipv4/tcp_fin_timeout: man…
dmmc
  • 13
  • 3
1
vote
1 answer

HTTP socket connection remains in TIME_WAIT well after page is served

I am seeing a lot of long lasting TIME_WAIT connections to port 80 on my Apache 2.2.3 server on Red Hat Linux 6. I confirmed that even after pages have loaded, the connection remains in this state for more than 10 seconds, sometimes a lot longer…
GL2014
  • 6,016
  • 4
  • 15
  • 22
1
vote
3 answers

Milliseconds (!) wait in Batch using no externals?

I have searched intensively but have only found wait-tips in batch files in seconds units (the ping approach i.e.). Since I have a need to wait in between two commands only for something like 10-100 milliseconds, that does not work for me…
jwka
  • 115
  • 7
1
vote
1 answer

Hibernate causing too many time_wait connections

I am using Hibernate 3 and I am facing a problem related to connections being closed. I am using c3p0-0.9.1.2.jar and I checked onto the connections to database server opened by Hibernate, I found that there are established connections which are 5…
Ashish Jain
  • 4,667
  • 6
  • 30
  • 35
1
vote
0 answers

apache httpd and mysql gives lots of TIME_WAIT

We are running a traditional LAMP platform with lots of visitors (don't have the numbres). On our webserver we are no getting lots of TIME_WAIT. I have googled around a lot, and think I understand how the TIME_WAIT works. But I haven't figured out…
Arlukin
  • 319
  • 1
  • 3
  • 12
1
vote
1 answer

Imacros: Random wait time?

I'm trying to make a random wait between 30 minutes to one hour. The code I'm using is supposed to do this, but after the last line of code the script simply stops. Here's the script TAG POS=1 TYPE=INPUT:TEXT…
Gabriel Meono
  • 990
  • 3
  • 18
  • 48
1
vote
3 answers

jQuery Set wait time before a function executes

How can i set wait time for this function. function UpdateMedicaitonHistory(data) { MedicaitonHistoryGrid(); //set a wait time to finish MedicaitonHistoryGrid() like for 3 seconds // then execute the below code. if…
HaBo
  • 13,999
  • 36
  • 114
  • 206
0
votes
0 answers

A port on the server can still be bound when it is in the TIME_WAIT state

I use TCP in C language under Windows to connect locally to the server and client. The server uses port 8888, and the client connects to the server using a fixed port of 50000. The server then actively disconnects. I found that the 8888 port on the…
0
votes
3 answers

Correct way to use SO_REUSEADDR?

Below is abstract code of something like a daemon. I need to check if my daemon is already here (if yes, I exit). Then I close the bound socket, do some forks (they will live after the daemon is restarted, so I don't want them having my bound…
Rainbow
  • 29
  • 6
0
votes
0 answers

On the optimization of docker image time-wait

I started a docker image service. I want to modify the kernel parameter of this image (sysctl. CONF) to optimize time-wait, but I encountered the following problems.The code and version: (custom_env) root@64d755e74e61:/etc# /sbin/sysctl -p sysctl:…
thewholeworld
  • 25
  • 1
  • 7
0
votes
0 answers

Does the websocket RFC do suggest that the server should enter time wait state?

in section 5.5.1 in the rfc6455 https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.1, it says: The server MUST close the underlying TCP connection immediately; the client SHOULD wait for the server to close the connection Dose this mean the…
Todd Wong
  • 234
  • 1
  • 4
0
votes
2 answers

Android - Leave A Time Between ImageButton Animations?

I have 6 ImageButton. I applied the same animation to all of them as below: Animation anim1 = AnimationUtils.loadAnimation(this,…
iTurki
  • 16,292
  • 20
  • 87
  • 132
0
votes
1 answer

How to stop java code execution util a link in webView is loaded completely in android studio

I am trying to make a web scraping application in android studio, in which on extracted data I want to perform some action using java code. Problem is that webview works asynchronously that is, it will go on executing remaining line of same method…