Can't close port after switch to bootloade mode
SmartHaven opened this issue · 10 comments
Can't close port after switch ezsp zigbee stick (efr32) into bootloader mode (with a special command).
java.lang.Thread.State: RUNNABLE
at com.fazecast.jSerialComm.SerialPort.closePortNative(Native Method)
at com.fazecast.jSerialComm.SerialPort.closePort(SerialPort.java:693)
- locked <0xa398c678> (a java.lang.Class for com.fazecast.jSerialComm.SerialPort)
- locked <0xa7a9b4b8> (a com.fazecast.jSerialComm.SerialPort)
Reproduced only on Raspberry Pi, and only for versions > 2.7.0.
Only reboot or reconnect the stick helps.
I think we are affected by this issue as well see rusefi/rusefi#3931
in case of rusEFI just connect to an stm32 device, request name and attempt to close connection once name is received. this has started to hang up after I've migrated from version 2.5.3 to version 2.9.0 a couple of days ago.
works good with 2.7.0
I 220212 173332.973 [AutoDetectPort1] SerialIoStream - Using com.fazecast.jSerialComm 2.7.0
I 220212 173332.974 [AutoDetectPort1] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM3
I 220212 173332.974 [AutoDetectPort2] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM31
I 220212 173332.975 [AutoDetectPort4] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM33
I 220212 173332.976 [AutoDetectPort3] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM32
I 220212 173333.032 [AutoDetectPort4] SerialAutoChecker - Got signature=rusEFI 2022.02.12.mre_f4.1768592053 from COM33
I 220212 173333.033 [AutoDetectPort4] SerialIoStream - COM33: Closing port...
I 220212 173333.034 [AutoDetectPort4] SerialIoStream - COM33: Closed port.
I 220212 173333.034 [AutoDetectPort4] SerialAutoChecker - Propagating AutoDetectResult{serialPort='COM33', signature='rusEFI 2022.02.12.mre_f4.1768592053 '}
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Now interrupting [Thread[AutoDetectPort1,5,main], Thread[AutoDetectPort2,5,main], Thread[AutoDetectPort3,5,main], Thread[AutoDetectPort4,5,]]
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort1,5,main]
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort2,5,main]
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort3,5,main]
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort4,5,]
I 220212 173333.035 [AWT-EventQueue-0] PortDetector - Done interrupting!
Does not work with 2.8.0
Note the 5 second gap between "closing COM33" and "closed COM33" which is the thread interrupt join timeout in our code
I 220212 173640.023 [AutoDetectPort1] SerialIoStream - Using com.fazecast.jSerialComm 2.8.0
I 220212 173640.024 [AutoDetectPort1] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM3
I 220212 173640.024 [AutoDetectPort3] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM32
I 220212 173640.024 [AutoDetectPort2] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM31
I 220212 173640.024 [AutoDetectPort5] BufferedSerialIoStream - [BufferedSerialIoStream] openPort LPT1
I 220212 173640.024 [AutoDetectPort4] BufferedSerialIoStream - [BufferedSerialIoStream] openPort COM33
I 220212 173640.061 [AutoDetectPort4] SerialAutoChecker - Got signature=rusEFI 2022.02.12.mre_f4.1768592053 from COM33
I 220212 173640.061 [AutoDetectPort4] SerialIoStream - COM33: Closing port...
I 220212 173640.576 [version checker] ConsoleUI - Reading from https://rusefi.com/console/versions.txt
I 220212 173640.580 [version checker] ConsoleUI - Server recommends java_console version 20171217 or newer
I 220212 173640.580 [version checker] ConsoleUI - Server recommends firmware 14892 or newer
I 220212 173645.025 [AWT-EventQueue-0] PortDetector - Now interrupting [Thread[AutoDetectPort1,5,main], Thread[AutoDetectPort2,5,main], Thread[AutoDetectPort3,5,main], Thread[AutoDetectPort4,5,main], Thread[AutoDetectPort5,5,main]]
I 220212 173645.025 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort1,5,main]
I 220212 173645.025 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort2,5,main]
I 220212 173645.025 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort3,5,main]
I 220212 173645.025 [AutoDetectPort1] SerialIoStream - COM3: Closing port...
I 220212 173645.026 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort4,5,main]
I 220212 173645.026 [AWT-EventQueue-0] PortDetector - Interrupting Thread[AutoDetectPort5,5,main]
I 220212 173645.026 [AWT-EventQueue-0] PortDetector - Done interrupting!
D 220212 173645.027 [AWT-EventQueue-0] PortDetector - Found AutoDetectResult{serialPort='null', signature='null'} now stopping threads
I 220212 173645.184 [AutoDetectPort5] SerialIoStream - LPT1: Closing port...
I 220212 173645.184 [AutoDetectPort2] SerialIoStream - COM31: Closing port...
I 220212 173645.195 [AWT-EventQueue-0] MessagesCentral - postMessage Launcher: Available port: COM3
I 220212 173645.196 [AWT-EventQueue-0] MessagesCentral - postMessage Launcher: Available port: COM31
I 220212 173645.196 [AWT-EventQueue-0] MessagesCentral - postMessage Launcher: Available port: COM32
I 220212 173645.196 [AWT-EventQueue-0] MessagesCentral - postMessage Launcher: Available port: COM33
I 220212 173645.196 [AWT-EventQueue-0] MessagesCentral - postMessage Launcher: Available port: LPT1
I 220212 173645.221 [AutoDetectPort4] SerialIoStream - COM33: Closed port.
I 220212 173645.221 [AutoDetectPort1] SerialIoStream - COM3: Closed port.
@MakeSimpleOrg, I'm going to address your issue on this thread and address @rusefillc's on a different thread they opened since I think your issue is Linux-based and theirs is Windows-based. I believe both issues are due to the same underlying problem of trying to flush data before closing the port, but how this is handled is different based on the operating system.
Would you be able to test a local beta JAR file if I send it to you with the expected offending calls removed?
@MakeSimpleOrg, if possible, could you test again using this library version:
https://www.dropbox.com/t/0IwtlT6LT7uz0MS2
This has all data flushing calls removed which is the only thing I can see that might be causing the port to block on close().
@MakeSimpleOrg, if possible, could you test again using this library version:
https://www.dropbox.com/t/0IwtlT6LT7uz0MS2
This has all data flushing calls removed which is the only thing I can see that might be causing the port to block on close().
Everything is working
@MakeSimpleOrg, if possible, could you test again using this library version:
https://www.dropbox.com/t/0IwtlT6LT7uz0MS2
This has all data flushing calls removed which is the only thing I can see that might be causing the port to block on close().Everything is working
Yes.
Great! I will release this fix as soon as we get the related Windows issue resolved.
Closing this as resolved with today's release v2.9.1.