-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
EmbeddedEventLoop/Channel violates Sendable: Store the current thread in init()
and then assert that we're on that thread
#2949
Comments
Yes, there's no dispute about this. They have always historically broken the rules, and that remains true today. |
Right, I have no idea why we didn't put that into NIO 1.0... The real selectors (kqueue/epoll/uring) do actually have |
@Lukasa Do you think this needs to be staged with a |
Yeah, I think it does. Environment variable is an option, another option is to just have a static flag on |
cool, done |
### Motivation: `EmbeddedChannel` & `EmbeddedEventLoop` currently violate `Sendable`. They should store the current thread in `init` and then implement `inEventLoop` and other functions with a check that the current thread is correct. Since NIO 1.0 `Embedded*` were always documented to not be thread-safe but we should finally police this. ### Modifications: - Implement the thread check - For now, just warn (soon hopefully crash) - Delete EmbeddedScheduledCallbackTests (#2950) ### Result: - Less Embedded* abuse - fixes #2949
EmbeddedChannel
&EmbeddedEventLoop
currently violateSendable
. They should store the current thread ininit
and then implementinEventLoop
withprecondition(self.myThread == Thread.current); return true
.Otherwise, EmbeddedChannel/EventLoop are just trivially violating the rules.
The text was updated successfully, but these errors were encountered: