Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.34k stars 287 forks source link

both 2.10.1 and 2.10.2 break rusEFI auto-detect device functionality on Windows #510

Closed rusefillc closed 1 year ago

rusefillc commented 1 year ago

We at rusefi love jSerialComm and use it for years!

On both Windows 10 and Windows 11 the following auto-detect scenario is broken:

happy 2.9

I 230722 145532.049 [AWT-EventQueue-0] PortDetector - Trying [COM1, COM135, COM136, COM150, COM153, COM166, COM167, COM168, COM169, COM170, COM171, COM3, COM97, COM98]
I 230722 145532.054 [ECU AutoDetectPort14] SerialIoStream - Using com.fazecast.jSerialComm 2.9.3
I 230722 145532.054 [ECU AutoDetectPort14] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM98
I 230722 145532.054 [ECU AutoDetectPort8] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM168
I 230722 145532.054 [ECU AutoDetectPort2] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM135
I 230722 145532.054 [ECU AutoDetectPort9] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM169
I 230722 145532.054 [ECU AutoDetectPort13] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM97
I 230722 145532.054 [ECU AutoDetectPort6] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM166
I 230722 145532.054 [ECU AutoDetectPort3] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM136
I 230722 145532.055 [ECU AutoDetectPort4] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM150
I 230722 145532.055 [ECU AutoDetectPort7] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM167
E 230722 145532.055 [ECU AutoDetectPort4] SerialIoStream - Error opening COM150 maybe no permissions?
I 230722 145532.055 [ECU AutoDetectPort1] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM1
I 230722 145532.055 [ECU AutoDetectPort5] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM153
I 230722 145532.054 [ECU AutoDetectPort10] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM170
I 230722 145532.054 [ECU AutoDetectPort12] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM3
I 230722 145532.054 [ECU AutoDetectPort11] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM171
I 230722 145532.073 [ECU AutoDetectPort5] SerialAutoChecker - Got signature=rusEFI master.2023.07.22.proteus_f7.604989810  from COM153
I 230722 145532.073 [ECU AutoDetectPort5] SerialIoStream - COM153: Closing port...
I 230722 145532.074 [ECU AutoDetectPort5] SerialIoStream - COM153: Closed port.
I 230722 145532.075 [ECU AutoDetectPort5] SerialAutoChecker - Propagating AutoDetectResult{serialPort='COM153', signature='rusEFI master.2023.07.22.proteus_f7.604989810 '}
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Now interrupting [Thread[ECU AutoDetectPort1,5,main], Thread[ECU AutoDetectPort2,5,main], Thread[ECU AutoDetectPort3,5,main], Thread[ECU AutoDetectPort4,5,], Thread[ECU AutoDetectPort5,5,], Thread[ECU AutoDetectPort6,5,main], Thread[ECU AutoDetectPort7,5,main], Thread[ECU AutoDetectPort8,5,main], Thread[ECU AutoDetectPort9,5,main], Thread[ECU AutoDetectPort10,5,main], Thread[ECU AutoDetectPort11,5,main], Thread[ECU AutoDetectPort12,5,main], Thread[ECU AutoDetectPort13,5,main], Thread[ECU AutoDetectPort14,5,main]]
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort1,5,main]
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort2,5,main]
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort3,5,main]
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort4,5,]
I 230722 145532.075 [ECU AutoDetectPort1] SerialIoStream - COM1: Closing port...
I 230722 145532.075 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort5,5,]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort6,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort7,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort8,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort9,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort10,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort11,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort12,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort13,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort14,5,main]
I 230722 145532.076 [AWT-EventQueue-0] PortDetector - Done interrupting!
I 230722 145532.082 [ECU AutoDetectPort1] SerialIoStream - COM1: Closed port.
I 230722 145532.097 [ECU AutoDetectPort12] SerialIoStream - COM3: Closing port...
I 230722 145532.134 [AWT-EventQueue-0] ConsoleUI - init...
I 230722 145532.143 [ECU AutoDetectPort12] SerialIoStream - COM3: Closed port.
I 230722 145532.149 [AWT-EventQueue-0] ConsoleUI - Console 20230701
I 230722 145532.150 [AWT-EventQueue-0] ConsoleUI - Hardware: F4
I 230722 145532.150 [AWT-EventQueue-0] LinkManager - LinkManager: Starting COM153

Note that I have a bunch of (inactive) bluetooth SPP serial ports not sure if that contributes

image

rusefillc commented 1 year ago

Broken 2.10.2 (edited - originally I was using 2.10.1 but same issue with 2.10.2)

I 230722 155519.859 [AWT-EventQueue-0] PortDetector - Trying [COM1, COM135, COM136, COM150, COM153, COM166, COM167, COM168, COM169, COM170, COM171, COM3, COM97, COM98]
I 230722 155519.863 [ECU AutoDetectPort5] SerialIoStream - Using com.fazecast.jSerialComm 2.10.2
I 230722 155519.864 [ECU AutoDetectPort5] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM153
I 230722 155519.864 [ECU AutoDetectPort8] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM168
I 230722 155519.864 [ECU AutoDetectPort13] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM97
I 230722 155519.864 [ECU AutoDetectPort1] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM1
I 230722 155519.864 [ECU AutoDetectPort10] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM170
I 230722 155519.864 [ECU AutoDetectPort9] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM169
I 230722 155519.864 [ECU AutoDetectPort11] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM171
I 230722 155519.864 [ECU AutoDetectPort2] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM135
I 230722 155519.864 [ECU AutoDetectPort12] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM3
I 230722 155519.864 [ECU AutoDetectPort4] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM150
I 230722 155519.864 [ECU AutoDetectPort6] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM166
I 230722 155519.864 [ECU AutoDetectPort14] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM98
I 230722 155519.864 [ECU AutoDetectPort7] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM167
I 230722 155519.864 [ECU AutoDetectPort3] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM136
I 230722 155524.877 [AWT-EventQueue-0] PortDetector - Now interrupting [Thread[ECU AutoDetectPort1,5,main], Thread[ECU AutoDetectPort2,5,main], Thread[ECU AutoDetectPort3,5,main], Thread[ECU AutoDetectPort4,5,main], Thread[ECU AutoDetectPort5,5,main], Thread[ECU AutoDetectPort6,5,main], Thread[ECU AutoDetectPort7,5,main], Thread[ECU AutoDetectPort8,5,main], Thread[ECU AutoDetectPort9,5,main], Thread[ECU AutoDetectPort10,5,main], Thread[ECU AutoDetectPort11,5,main], Thread[ECU AutoDetectPort12,5,main], Thread[ECU AutoDetectPort13,5,main], Thread[ECU AutoDetectPort14,5,main]]
I 230722 155524.877 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort1,5,main]
I 230722 155524.877 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort2,5,main]
I 230722 155524.878 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort3,5,main]
I 230722 155524.878 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort4,5,main]
I 230722 155524.878 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort5,5,main]
I 230722 155524.878 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort6,5,main]
I 230722 155524.878 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort7,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort8,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort9,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort10,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort11,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort12,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort13,5,main]
I 230722 155524.879 [AWT-EventQueue-0] PortDetector - Interrupting Thread[ECU AutoDetectPort14,5,main]
I 230722 155524.880 [AWT-EventQueue-0] PortDetector - Done interrupting!
E 230722 155525.053 [ECU AutoDetectPort8] SerialIoStream - Error opening COM168 maybe no permissions?

Our ticket https://github.com/rusefi/rusefi/issues/5430

hedgecrw commented 1 year ago

In your ticket, you say that the problematic results are from v2.10.2 but your log output indicates that you are using v2.10.1 (which has a known bug). Please try your test again using 2.10.2 and let me know if the issue persists. Thanks!

rusefillc commented 1 year ago

@hedgecrw my bad.

2.10.2 is still broken :( just edited the comment above

hedgecrw commented 1 year ago

Hey @rusefillc, sorry for the delay. I've been beating my head against a wall because literally nothing has changed about event-based listening since 2.9.3. I had a (maybe) epiphany last night that perhaps the issue isn't due to native library functionality, but rather threading on the Java side. I switched things over in the 2.10.X series to use ReentrantLocks instead of synchronize blocks, and I realize that in doing so, I was exclusively using class-based locks instead of instance-based locks, so perhaps that is the root of the problem. I just checked in a patch that separates class-based enumeration locks from instance-based configuration locks...if you wouldn't mind testing the most recent SNAPSHOT version, I'd appreciate it:

SNAPSHOT Version: 2.10.3-SNAPSHOT SNAPSHOT Direct Download Link SNAPSHOT Instructions

rusefillc commented 1 year ago

Snapshot works great!

I 230728 134137.239 [AWT-EventQueue-0] PortDetector - Trying [COM17, COM22, COM23, COM24, COM25, COM35, COM36, COM37, COM38]
I 230728 134137.245 [ECU AutoDetectPort5] SerialIoStream - Using com.fazecast.jSerialComm 2.10.3-cd3d52b-SNAPSHOT
I 230728 134137.245 [ECU AutoDetectPort5] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM25
I 230728 134137.245 [ECU AutoDetectPort4] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM24
I 230728 134137.245 [ECU AutoDetectPort6] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM35
I 230728 134137.245 [ECU AutoDetectPort1] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM17
I 230728 134137.245 [ECU AutoDetectPort9] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM38
I 230728 134137.245 [ECU AutoDetectPort8] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM37
I 230728 134137.245 [ECU AutoDetectPort2] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM22
I 230728 134137.245 [ECU AutoDetectPort7] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM36
I 230728 134137.245 [ECU AutoDetectPort3] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM23
I 230728 134137.262 [ECU AutoDetectPort1] SerialAutoChecker - Got signature=rusEFI master.2023.07.20.proteus_f7.825107342  from COM17
I 230728 134137.262 [ECU AutoDetectPort1] SerialIoStream - COM17: Closing port...
I 230728 134137.266 [ECU AutoDetectPort1] SerialIoStream - COM17: Closed port.
hedgecrw commented 1 year ago

Oh thank goodness! I was worried this was going to be one of those impossible to track-down bugs.

hedgecrw commented 1 year ago

Resolved as of today's release v2.10.3. Thanks for your patience!