jdog456 / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

Serial port over USB on Windows: Sysload increases when pulling the USB connection. #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a connection on a serial port over USB.
2. Use the jsse callback option ( 
serialPort.setEventsMask(SerialPort.MASK_RXCHAR )
3. Connect to a serial port offered over USB.
4. Check sysload using Taskmanager: ~0
5. Pull the USB plug.
6. Check sysload using Taskmanager: The number here depends on the system, 
behaviour is that system load goes up significantly.

What is the expected output? What do you see instead?
Expected is that the system load does not change if the serial port is not 
longer available.

What version of the product are you using? On what operating system?
0.9 on Windows XP

Please provide any additional information below.

I tracked this with a debugger on Java level.  The Java threads seem to be 
cleanly waiting.  When I suspend the thread with the native serial port code, 
system load goes down to zero.  Thus it seems as if there happens some kind of 
busy waiting if the connection gets lost.

Original issue reported on code.google.com by micha...@gmail.com on 18 Jun 2012 at 11:58

GoogleCodeExporter commented 8 years ago
now the latest version is 2.8.0, this problem seems still exist.

What steps will reproduce the problem?
1. connect the device over usb
2. openPort() and addSerialPortEventListener()
3. disconnect the device

What is the expected output? What do you see instead?
I want to get a disconnect event, or catch a exception.
But I find that the serialPortEventListener is still working, although it is no 
longer valid. And, at the same time, I find that the CPU load on my system 
approaching 100%, almost crash.

What version of the product are you using? On what operating system?
jssc-2.8.0 on win7sp2x64.

Please provide any additional information below.
I dont know if there is a callback function about disconnecting the serial port 
in the native code. If there is, we can easily get a event or catch an 
exception. If there isnt, maybe a solution with heartbeat and timeout is 
helpful.

Original comment by crazyboyfeng on 17 May 2014 at 8:43