Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proactor event loop warning opt-out message is, weird? #1830

Open
davetapley opened this issue Jan 20, 2023 · 3 comments
Open

Proactor event loop warning opt-out message is, weird? #1830

davetapley opened this issue Jan 20, 2023 · 3 comments
Labels

Comments

@davetapley
Copy link
Contributor

this is more suited to 'Discussion', but they're not enabled on this repo 馃

I got this message:

pyzmq/zmq/asyncio.py

Lines 52 to 55 in 206411c

"Proactor event loop does not implement add_reader family of methods required for zmq."
" zmq will work with proactor if tornado >= 6.1 can be found."
" Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())`"
" or install 'tornado>=6.1' to avoid this error."

And dutifully installed tornado, but then I'm told:

pyzmq/zmq/asyncio.py

Lines 59 to 62 in 206411c

"Proactor event loop does not implement add_reader family of methods required for zmq."
" Registering an additional selector thread for add_reader support via tornado."
" Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())`"
" to avoid this warning.",

I understand, but if I set WindowsSelectorEventLoopPolicy() to avoid the warning,
then doesn't that defeat the purpose of installing tornado?

... and it also causes this issue:

@minrk minrk added the question label Jan 23, 2023
@minrk
Copy link
Member

minrk commented Jan 23, 2023

Yeah, it's still a warning because the event loop doesn't actually support what's required for zmq sockets, but pyzmq is instantiating an additional selector loop the user didn't ask for to work around that. You can suppress the warning if you are happy with this behavior. It should work, but I think it's worth the user being notified that it's happening.

I think it's worth a warning because this should be considered a bug in asyncio to fail to implement basic asyncio functionality by default. There are lots of good reasons why proactor is better, but it's lacking essential basic functionality (FD reader/writer) that libzmq sockets are impossible to poll without.

@davetapley
Copy link
Contributor Author

@minrk I think I understand, but when you say:

You can suppress the warning if you are happy with this behavior

Do you mean by setting WindowsSelectorEventLoopPolicy (as the warning suggests)?

@minrk
Copy link
Member

minrk commented Jan 25, 2023

Sorry, no. I mean with a warnings filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants