Skip to content

Conversation

@arp242
Copy link
Member

@arp242 arp242 commented Oct 28, 2024

It would do:

events := read_events_from_kernel()
for _, e := range events {
	watch := read_our_state(e)
	do_stuff_with(watch)
}

However, between read_events_from_kernel() and read_our_state() the internal state could have been removed with Watcher.Remove() in another goroutine, so it would return nil.

In many cases it already did "if watch != nil && [..]" to deal with this, but not everywhere. Do an "early continue" instead.

Fixes #616


Ideally what it should do is block any Remove() for all of the above code, so it always operates on a consistent state. But that's not so easy to do in a quick fix, and I don't really have the time to spend on this at the moment (and it seems no one else has either).

It would do:

	events := read_events_from_kernel()
	for _, e := range events {
		watch := read_our_state(e)
		do_stuff_with(watch)
	}

However, between read_events_from_kernel() and read_our_state() the
internal state could have been removed with Watcher.Remove() in another
goroutine, so it would return nil.

In many cases it already did "if watch != nil && [..]" to deal with
this, but not everywhere. Do an "early continue" instead.

Fixes #616

---

Ideally what it should do is block any Remove() for all of the above
code, so it always operates on a consistent state. But that's not so
easy to do in a quick fix, and I don't really have the time to spend on
this at the moment (and it seems no one else has either).
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.

panic in v1.7.0

2 participants