Satel INT-RS bug: increasing number of threads

Recently I added satel binding for handling INT-RS module. I can observe that with time number of java threads constantly grows (from 56 up to over 300) affecting the system performance. The increasing number of thread is most probably caused by accidental serial port disconections (from time to time serial port is closed)

Probably the bug is in,

In connection routine a serialPortListener is created and thread is put to sleep:
serialPort.addEventListener(new SerialPortEventListener() {
_ @Override_
_ public void serialEvent(SerialPortEvent ev) {_
_ try {_
_ logger.trace(“RXTX library CPU load workaround, sleep forever”);_
_ Thread.sleep(Long.MAX_VALUE);_
_ } catch (InterruptedException e) {_
_ }_
_ }_

but on port disconnect only port is closed (this.serialPort.close():wink:
I’m not java expert but shouldn’t you remove listener?: this.serialPort.removeEventListener(); or release thread on different way?

I cannot build a snapshot of satel package so I’m not able to check whether removing event listener solves the problem
Could you please verify this bug?

Hello Piotr and sorry for late answer.
Did you try the most recent version of the binding? If this happens on the latest one, I will try to look into this issue.
Regarding the code you have mentioned, everything there should be OK. It does not create any new thread in the place you pointed out, so this is not the problem here.

Yesterday I did a quick test with many reconnects and numer of thread was just stable. I was using the most recent version of the binding. You can download it from Cloudbees: