gunicorn icon indicating copy to clipboard operation
gunicorn copied to clipboard

Python 3.4+: use os.set_inheritable + os.set_blocking in place of unreadable fcntl calls

Open pajod opened this issue 9 months ago • 2 comments

We should cleanup those rather unreadable low-level fcntl calls. The stdlib provides single-call functions for these now.

(Replacement is not 100% equivalent, as they might call ioctl(.., FIO.., NULL) instead, but I see no reason we should care.)

  • Fixes: #2742
  • Related: #1170

Suggested order:

  • Merge #3211 before this one
  • Merge before #3127 - alternatively verify .fileno() suffixes that might to be dropped

pajod avatar May 12 '24 22:05 pajod

Not disagreeing about this change but this must be validated on BSD. I think we need to add FreeBSD to our test platform to ensure it works there. (an dmaybe other OpenBSD).

benoitc avatar Aug 08 '24 13:08 benoitc

@benoitc Happy with pulling Neil Pang's vm images?

Those work with very little setup required for FreeBSD, OpenBSD and illumos (no prebuilt gevent though). Though the Github file still needs review by someone more proficient with that:

  • I did not know how to express "whatever python3 version you usually do" on those images
  • I did not know if/how mixing GitHub CI secrets with running arbitrary untrusted code in another CI workflow can be done safely.
  • The actual test I meant to run did not run on those systems yet (thats what the s in tests/test_nginx.py s indicates) - my current nginx test does not produce very nice messages when failing
  • afaict, OmniOS does not ship gevent, so setup including compilation is rather slow / does not work because libev believes it is on linux and tries to prepare for the existing inotify.h with two-argument statfs() needs some autoconf override in the CI workflow

pajod avatar Aug 23 '24 20:08 pajod