Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

inotify: fix race in Close()#465

Merged
arp242 merged 1 commit into
mainfsnotify/fsnotify:mainfrom
close-racefsnotify/fsnotify:close-raceCopy head branch name to clipboard
Jul 22, 2022
Merged

inotify: fix race in Close()#465
arp242 merged 1 commit into
mainfsnotify/fsnotify:mainfrom
close-racefsnotify/fsnotify:close-raceCopy head branch name to clipboard

Conversation

@arp242

@arp242 arp242 commented Jul 22, 2022

Copy link
Copy Markdown
Member

Would sometimes fail with:

panic: close of closed channel

goroutine 204 [running]:
github.com/fsnotify/fsnotify.(*Watcher).Close(0xc0003e6410)
    	/home/martin/code/Golib/fsnotify/inotify.go:82 +0x66
created by github.com/fsnotify/fsnotify.TestCloseRace
    	/home/martin/code/Golib/fsnotify/integration_test.go:1256 +0x1a5
exit status 2

Because isClosed() might return "false" for two goroutines, and then
they will both try to close it, resulting in the panic.

Fixes #367

Would sometimes fail with:

	panic: close of closed channel

	goroutine 204 [running]:
	github.com/fsnotify/fsnotify.(*Watcher).Close(0xc0003e6410)
        	/home/martin/code/Golib/fsnotify/inotify.go:82 +0x66
	created by github.com/fsnotify/fsnotify.TestCloseRace
        	/home/martin/code/Golib/fsnotify/integration_test.go:1256 +0x1a5
	exit status 2

Because isClosed() might return "false" for two goroutines, and then
they will both try to close it, resulting in the panic.

Fixes #367

@shogo82148 shogo82148 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arp242
arp242 merged commit 7fe2936 into main Jul 22, 2022
@arp242
arp242 deleted the close-race branch July 22, 2022 05:22
@shogo82148 shogo82148 mentioned this pull request Mar 6, 2024
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is a race in inotify.go:watcher.Close()

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.