Hello, thanks for your input - i tried it with both close(true) and close(false) - but i would expect that close(false) blocks till all sessions are really closed - however the doc states something about flushing pending writes - i dont think there are any pending writes when the connection is just idle.
The 30sec sleep is a workaround, but for me i would have to use 60sec maybe... or alternatively - when starting the server try for 60sec to open the used port again. Anyway, there should be a better solution =/ --- On Mon, 8/20/12, Mike van Goor <[email protected]> wrote: > From: Mike van Goor <[email protected]> > Subject: Re: Forcing the closure of any open session when mina server shuts > down > To: [email protected] > Date: Monday, August 20, 2012, 8:17 AM > Hi, > > I am (for now) ignoring this line as it exists before exit > and after: > tcp 0 0 > 127.0.0.1:56901 > 127.0.0.1:10027 > TIME_WAIT > > Apart from that the acceptor tcp ports have been closed (as > there is no > LISTEN in your second output. > > As for the remaining session (the 2 listings are the same > session): > If you use close(true) then the traditional close handshake > (FIN --> > FIN-ACK) does not take place in the correct way. > Thus this would leave the port in the CLOSE_WAIT and other > end FIN_WAIT2 > state. > > To solve this you normally use close(false) and wait for the > session to > shutdown gracefully. > You could built in a sleep of a few seconds to give the > system the time > to close the sessions. > > I haven't found a better way of doing this than doing a > close(false) on > all sessions, wait for example 30 seconds, and then a > close(true). > If anyone has a better way of handling this let me know as I > cannot find > a good way to handle these situations all over the > internet. > > Maybe Emnanuel has a good solution for this. > > Hope my comments help you.... > > Regards, > Mike > > Op 20-8-2012 13:56, Harakiri schreef: > > Hello, > > > > thanks for the suggestion - i tried it out but it does > not seem to work - the server listener port is closed (this > worked for me before) however the client who connects still > has the sessions opened. After doing a close(true) on all > sessions - and confirming with > acceptor.getManagedSessions().size() that there are indeed 0 > sessions left - im puzzled who is to blame - the mina server > or postfix ? > > > > Here is the netstat output after at least one session > has been created > > (there are 2 mina services running, at 10027 and > 10028) > > > > tcp 0 0 > 127.0.0.1:10027 > 0.0.0.0:* > LISTEN > > tcp 0 0 > 127.0.0.1:10028 > 0.0.0.0:* > LISTEN > > tcp 0 0 > 127.0.0.1:54751 > 127.0.0.1:10028 > ESTABLISHED > > tcp 0 0 > 127.0.0.1:56901 > 127.0.0.1:10027 > TIME_WAIT > > tcp 0 0 > 127.0.0.1:10028 > 127.0.0.1:54751 > ESTABLISHED > > > > after i shutdown the server and a debug output > confirmed that the address was unbind, and 0 sessions are > left - im left with this > > > > tcp 1 0 > 127.0.0.1:54751 > 127.0.0.1:10028 > CLOSE_WAIT > > tcp 0 0 > 127.0.0.1:56901 > 127.0.0.1:10027 > TIME_WAIT > > tcp 0 0 > 127.0.0.1:10028 > 127.0.0.1:54751 > FIN_WAIT2 > > > > the client is still connecting to 10027 and 28, and for > some reason the server port for 10028 is still open but on > fin_wait2. > > > > I also tried adding acceptor.dispose(); after > unbind - no dice. > > > > Any further ideas? > > > > Thanks > > > > >
