You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IIUC, the fix here is as simple as moving the defer close(f.filesCh) to the very top of the walkFilesystem goroutine, so there's no chance for it to return without closing f.filesCh. This is a very simple change, so I'll send in a PR with the change.
The text was updated successfully, but these errors were encountered:
The contract seems to be that the `walkFilesystem` goroutine is
responsible for closing `f.filesCh`, but before this change, there were
codepaths that could result in the gorouting exiting without closing
`f.filesCh`. That shouldn't be possible anymore, so long as we keep this
statement at the top of the function =)
This fixesnumtide#406
The contract seems to be that the `walkFilesystem` goroutine is
responsible for closing `f.filesCh`, but before this change, there were
codepaths that could result in the gorouting exiting without closing
`f.filesCh`. That shouldn't be possible anymore, so long as we keep this
statement at the top of the function =)
This fixesnumtide#406
This command hangs indefinitely:
SIGTERM doesn't stop it, I have to send a SIGKILL.
Expected behavior
treefmt should never hang indefinitely. In the specific case above, I'd expect to see this error message:
System information
I'm using the latest version of treefmt (at time of writing):
Additional context
applyFormatters
goroutine is stuck forever in this for loop reading fromf.filesCh
walkFilesystem
goroutine is responsible for closingf.filesCh
, but it exited here before it sets up adefer
to close the channel at exit.defer close(f.filesCh)
to the very top of thewalkFilesystem
goroutine, so there's no chance for it to return without closingf.filesCh
. This is a very simple change, so I'll send in a PR with the change.The text was updated successfully, but these errors were encountered: