python-trio / trio

Trio – a friendly Python library for async concurrency and I/O
https://trio.readthedocs.io
Other
6k stars 325 forks source link

Solaris support #1437

Open jcea opened 4 years ago

jcea commented 4 years ago

I am interested in using Trio under Solaris, but it doesn't support "select.devpoll" neither "selectors" module.

Beside hypothetical performance issues, I wonder why is "selectors" not used by Trio to be more portable.

Depending of the answer, I might volunteer to write a pull request to support "selectors" and/or "select.devpoll", if any of them is welcomed.

Thanks!

jcea commented 4 years ago

Under Solaris:

[jcea@TestZone /tmp]$ ./trio_proxy.py
Traceback (most recent call last):
  File "./trio_proxy.py", line 3, in <module>
    import trio
  File "/opt/local/lib/python3.8/site-packages/trio/__init__.py", line 18, in <module>
    from ._core import (
  File "/opt/local/lib/python3.8/site-packages/trio/_core/__init__.py", line 19, in <module>
    from ._run import (
  File "/opt/local/lib/python3.8/site-packages/trio/_core/_run.py", line 2085, in <module>
    raise NotImplementedError("unsupported platform")
NotImplementedError: unsupported platform
njsmith commented 4 years ago

It's mostly a matter of controlling our own destiny. I/O is the core thing Trio does, and the selectors module's API is awkward for us to use, doesn't expose all the features we need, and when it has bugs then there's no way to fix them without waiting years for Python releases. So we made the call to write our own core I/O loops instead of relying on the selectors abstraction.

No objections to supporting Solaris, via /dev/poll or whatever other mechanism makes sense. The trickiest part will be figuring out how to test it. We do have some hodge-podge machinery to spin up custom VM's on Travis and run tests in them. Currently it's used to test exotic Linux kernel versions, but it could potentially work for Solaris too. (Does Solaris support cloud-init?)

jcea commented 4 years ago

No idea about "cloud-init", but Solaris is not a free OS anyway. There are quite a few free derivatives (Illumos) platforms, anyway. I have provided buildbots for some projects in the past, and I would be happy to provide something similar for Trio. No idea how to integrate with your CI machinery, though.

For now, I will try to develop a "devpoll" implementation.

njsmith commented 4 years ago

Oh, right, I forgot that it's proprietary now. That makes it pretty awkward to support, because if someone's PR is failing on Solaris or requires general changes to the IO backends, then what do we tell them to do? "Go buy a license from Oracle before you can contribute" just isn't workable...

I have provided buildbots for some projects in the past, and I would be happy to provide something similar for Trio.

I appreciate the generosity, but tbh the idea of running buildbots makes me nervous. IME these kinds of self-managed infrastructure end up adding a lot of friction to the development process, between needing specific people to fix things when they break, inaccessibility to regular contributors, environment configuration drifting or getting out of date, concerns about running untrusted code from external contributors in a shared system, etc. If it's possible to run tests inside an existing service like Travis then I'd strongly prefer that.

Using illumos for testing is an interesting idea. It's a bit weird b/c illumos supports epoll, so it doesn't actually need a /dev/poll-based backend. But we could have some kind of force-/dev/poll-usage flag we set for testing, and it's hopefully close enough to solaris that testing on illumos would be "good enough"?

I did a little bit of searching, and unfortunately I'm not seeing any existing illumos VM images that would be easy for us to use in CI... in the Linux world, every distro you've ever heard of has standard "cloud ready" image, where you just download a disk image, point your VM runner at it, and use a standard interface to pass in a shell script that you want it to run (that's the cloud-init part). But from a quick look at OpenIndiana, SmartOS, and OmniOS CE, it looks like they only provide interactive installers, where some human needs to sit there and babysit the OS bootstrap. Which is unfortunate.

mtelka commented 1 year ago

I'd like to package trio for OpenIndiana but since it lacks Solaris/illumos support I can't (illumos' epoll support seems to be incompatible with Python - I tested with Python 3.9.15). @jcea, what is the status of your attempt to develop support for devpoll? Thank you.

mtelka commented 5 months ago

FYI, OpenIndiana started to provide cloud image about a year ago. You can find it on their download page.

Kojoley commented 1 month ago

FYI, there are Github Actions helpers https://github.com/vmactions/solaris-vm and https://github.com/vmactions/omnios-vm.