openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

[PLCBus] Fix addon crash when two commands are sent in quick succession #5707

Closed pit3k closed 5 years ago

pit3k commented 5 years ago

This caused two different openhab threads to concurrently receive bytes from the serial port. In turn, each thread received every other byte, and so both threads saw corrupted frames. Even worse - threads would get stuck waiting for response, and entire openhab was unresponsive until restarted.

Adding synchronized helped. I've also improved logging of error (which is now not being thrown in this scenario).

9037568 commented 5 years ago

Thanks, @pit3k !