Hello,

Some time ago, during a test we had SerialSessionImpl.WriteWorker threads left opened after closure of the session.

This came from a "too" quick close after the last write.

In the run method of the WriteWorker there is an unconditional wait after the flushWrites, so if the notification happens while the worker is flushing bytes, it will wait for the notification indefinitly.

I would suggest to add a security like :

while (isConnected() && !isClosing()) {
                 flushWrites();

                + if (isConnected() && !isClosing()) {
                    // wait for more data
                    synchronized (writeMonitor) {
                        try {
                            writeMonitor.wait();
                        } catch (InterruptedException e) {
                            log.error("InterruptedException", e);
                        }
                    }
                }
            }

This code solves the issue in most cases, but the notification may happen between the if and the synchronised. We haven't tested the solution to this for now.

Best regards,

*Mathieu Sacrispeyre*

Project Manager

Tel :+33 (0)5 61 33 1000

Web site :www.intesens.com

Reply via email to