On Fri, 11 Mar 2016 14:53:09 +0000, "James A. Robinson" <j...@highwire.org> wrote:
>The TIME_WAIT state indicates both sides of the connection have shut down >the socket cleanly and now the OS is waiting for some period of time before >it will allow that socket to be reused. This is to prevent the >possibility of a delayed packet on a previous session corrupting a >subsequent session. > >When I asked earlier about how frequently "it performs this action" what I >was intending to ask was "how frequently does your client send a message"? I'd guess 2-4 per second (it's called by a script) >If it sends many messages per second, you may be running out of sockets in >the ephemeral port range. Are there tens of thousands of sockets showing >up in netstat -nt (sockets of any state, not just TIME_WAIT)? I think >Solaris typically allocates a range of 32k sockets for the client side of >connections. Only about 300-400 sockets in use. >I think you can get the port range by using ndd to query the current values: > >/usr/sbin/ndd /dev/tcp tcp_smallest_anon_port tcp_largest_anon_port 32768 65535 >If you have at, or close to, <largest> - <smallest> sockets listed by >netstat, you're probably running out of sockets in that range. > >If that's the case, I can think of a few possible solutions: > >1. increase the size of the range >2. decrease the TIME_WAIT time >3. redesign your client to use fewer sockets (e.g, batching messages) > >This might be helpful to read: http://www.sean.de/Solaris/soltune.html Thanks - I'll read this. >Anyway, this is just a theory based on the error message, it may very well >be some other problem. > >On Fri, Mar 11, 2016 at 3:55 AM spamtrap < >nospam.1.friedbad...@spamgourmet.com> wrote: > >> On Thu, 10 Mar 2016 16:13:32 +0000, "James A. Robinson" >> <j...@highwire.org> wrote: >> >> It happens infrequently and unpredictibly. For example sometimes it >> fails after 25 times and sometimes it works for several 100 before >> going wrong. >> >> Another thing is that program works OK on Linux. It's only on Solaris >> that this problem arrises. >> >> netstat does show a lot of connections in TIME_WAIT state. I don't >> know what control I have over the closedown -- I assume this is done >> internally by ActiveMQ-CPP? >>