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
3
votes
0 answers

Kotlin websockets stuck in TIME_WAIT

While trying to create a large number of websockets I get a java.net.BindException. I think this is because the websockets are not being properly closed. How do I properly close a websocket in kotlin? Example code in a single file: import…
partkyle
  • 1,458
  • 1
  • 15
  • 25
3
votes
1 answer

No TIME_WAIT connections, why?

If I have sysctl tw_reuse=0 and tw_recycle=0, and netstat doesn't report any TIME_WAIT connections, that means...? It's local network connections between two servers, A -> B, A has TIME_WAIT connections to B in netstat, but B to A not.
ThomK
  • 637
  • 2
  • 8
  • 21
3
votes
1 answer

Why does SCTP not require a TIME_WAIT state?

I am reading "UNIX Network Programming: The Sockets API" and it mentions that SCTP does not require a TIME_WAIT state as TCP does due to its use of verification tags. Why is this the case? I understand why verification tags fix the issue with…
dippynark
  • 2,743
  • 20
  • 58
3
votes
5 answers

Need a better wait solution

Recently I have been writing a program in C++ that pings three different websites and then depending on pass or fail it will wait 5 minutes or 30 seconds before it tries again. Currently I have been using the ctime library and the following function…
Samuel
  • 574
  • 3
  • 7
  • 22
3
votes
1 answer

Specifying socket options in Gatling

When perf-testing a dummy RESTful service I have ran into the ConnectException: Cannot assign requested address problem, described here or here, and applied the tuning recommendations - increased the ephemeral port range to 10000-65000, my ulimit -n…
Radim Vansa
  • 5,686
  • 2
  • 25
  • 40
3
votes
1 answer

Perl Parallel::ForkManager wait_all_children() takes excessively long time

I have a script that uses Parallel::ForkManager. However, the wait_all_children() process takes incredibly long time even after all child-processes are completed. The way I know is by printing out some timestamps (see below). Does anyone have any…
Zhang18
  • 4,800
  • 10
  • 50
  • 67
3
votes
3 answers

How to use TimeUnit.timedWait() without losing nanosecond precision?

I'm trying to implement Future.get(long, TimeUnit) in terms of TimeUnit.timedWait(Object, long). It's not clear how to use TimeUnit.timedWait(Object, long) in a way that handles spurious wakeups without losing the nanosecond component of TimeUnit.…
Gili
  • 86,244
  • 97
  • 390
  • 689
3
votes
4 answers

How to show a splash screen to kill the time while data is loaded?

When starting my app I at first have to read in some data, have to init some forms and so on. For that time the user sees just grey getting-ready to show something forms. This lasts for a few seconds... I thought of a Splash Screen that loads the…
Kai
  • 5,850
  • 13
  • 43
  • 63
2
votes
0 answers

Memcache_connect Connection timed out

I get 10 to 20 of these errors all within 1 second of each other: Memcache_connect Connection timed out This happens several times a day, on a server with about 2500 daily active users, 1GB of ram. I don't think the server is swapping. Most of…
2
votes
3 answers

Too many TIME_WAIT connections

We have a fairly busy website (1 million page views/day) using Apache mod proxy that keeps getting overloaded with connections (>1,000) in the TIME_WAIT state. The connections are to port 3306 (mysql), but mysql only shows a few connections (show…
Brent Baisley
  • 962
  • 1
  • 6
  • 4
2
votes
3 answers

What's the difference between TIME-WAIT Assassination and SO_REUSEADDR

I was reading about using the SO_LINGER socket option to intentionally 'assassinate' the time-wait state by setting the linger time to zero. The author of the book then goes on to say we should never do this and in general that we should never…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
2
votes
2 answers

sleep without freezing gui vb6

I need to wait for some events in my application, or wait for somew time to elaps before doing some other stuff i tried this pseudo code in vb6 starttime=gettickcount do endtime=gettickcount if endtime-starttime=>waittime then exit…
Smith
  • 5,765
  • 17
  • 102
  • 161
2
votes
2 answers

How to setup time to wait for response in Rest-Assured?

Response takes a long time to come. How it is possible to wait for response time in rest-assured ?
IrinaG
  • 23
  • 1
  • 1
  • 4
2
votes
1 answer

Unable to reduce TIME_WAIT

I'm attempting to reduce the amount of time a connection is in the TIME_WAIT state by setting tcp_fin_timeout detailed here: root:~# sysctl -w net.ipv4.tcp_fin_timeout=30 net.ipv4.tcp_fin_timeout = 30 However, this setting does not appear to affect…
SMuz
  • 35
  • 1
  • 1
  • 5
2
votes
1 answer

PhpStorm FTP 425 Unable to build data connection: Cannot assign requested address

PhpStorm FTP upload failed. [17-1-16 下午5:17] Failed to transfer file '/a': cant open output connection for file "ftp://192.168.1.229:21/a". Reason: "425 Unable to build data connection: Cannot assign requested address". [17-1-16 下午5:17] Upload to…
Tom
  • 21
  • 2