robgonnella / ardi

Ardi is a command-line tool that helps you manage arduino projects!
GNU General Public License v3.0
12 stars 1 forks source link

WatchSketch is deadlock susceptible (uses fsnotify without separate goroutine) #68

Closed egnor closed 3 years ago

egnor commented 3 years ago

According to https://github.com/howeyc/fsnotify/issues/7, https://github.com/fsnotify/fsnotify/issues/55 and https://github.com/fsnotify/fsnotify#faq, callers need to start a separate goroutine to select on watcher events (vs where fsnotify.NewWatcher() is called). However, currently WatchSketch() is selecting events in the same thread where the watcher is created, which (apparently) may deadlock.

Disclaimer: I am not very go-literate, so, could easily be misunderstanding things somehow.

robgonnella commented 3 years ago

Nice find! Just pushed up changes to address this :)

robgonnella commented 3 years ago

Updated in new beta version, you can try it out via GO111MODULE=on go get github.com/robgonnella/ardi/v2@v2.3.0-beta.1

egnor commented 3 years ago

Hard to verify but the fix certainly looks good :slightly_smiling_face:

robgonnella commented 3 years ago

Closing: Addressed in v2.3.0