fix: require python-daemon>=2.2.4 so luigid --background works on Python 3.13 - #3431
Open
DRACULA1729 wants to merge 2 commits into
Open
fix: require python-daemon>=2.2.4 so luigid --background works on Python 3.13#3431DRACULA1729 wants to merge 2 commits into
DRACULA1729 wants to merge 2 commits into
Conversation
…hon 3.13 Running `luigid --background` on Python 3.13 crashes with "OSError: [Errno 88] Socket operation on non-socket". The error comes from python-daemon, not luigi: while building the DaemonContext it auto-detects whether to detach by checking if stdin is a socket, which calls socket.fromfd on fd 0. On 3.13 socket.fromfd validates the fd in the socket() constructor and raises ENOTSOCK for a non-socket, and in old python-daemon that call sits outside the try/except so the error escapes. python-daemon fixed this in 2.2.4 by moving the fromfd call inside the try/except that catches ENOTSOCK. luigi declared no minimum version on non-Windows, so a pre-2.2.4 release could satisfy the install and still crash. Add a >=2.2.4 lower bound, which is the exact release that fixed it. Fixes spotify#3407
CI runs `uv sync --locked`, which requires uv.lock to match pyproject.toml. Regenerating the lock resolves python-daemon to 3.1.2 on non-Windows (the fixed line) while win32 stays on 2.1.2 under its <2.2.0 cap. Notably the lock previously pinned python-daemon 2.1.2 for all platforms: the win32 <2.2.0 cap dragged the universal resolution down because non-Windows had no floor. That 2.1.2 is exactly the pre-2.2.4 version that crashes under spotify#3407, so this also fixes the resolution the project itself ships.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
luigid --backgroundcrashes on Python 3.13 withOSError: [Errno 88] Socket operation on non-socket. The crash is in thepython-daemondependency, not in luigi.When luigi builds the
DaemonContextinluigi/process.pyit doesn't passdetach_process, so python-daemon decides whether to detach by checking if stdin is a socket (i.e. whether it was started by inetd / a superserver). That check callssocket.fromfd(fd, AF_INET, SOCK_RAW)on fd 0. Python 3.13 validates the fd inside thesocket()constructor and raisesENOTSOCKfor a non-socket, and old python-daemon left thatfromfdcall outside itstry/except, so the error escapes. That's why foregroundluigidand Python 3.12 are both fine: neither hits this path.python-daemon fixed this in 2.2.4 ("Create the socket and catch 'non-socket' errors") by moving
fromfdinside thetry/exceptthat handlesENOTSOCK. luigi declared no minimum python-daemon version on non-Windows, so a pre-2.2.4 release could satisfy the install and still crash.uv.lockwas even resolving python-daemon to 2.1.2 on every platform, because the win32<2.2.0cap pulled the universal resolution down while non-Windows had no floor.This adds the lower bound and regenerates the lockfile:
After the change the lock resolves python-daemon 3.1.2 on non-Windows (the patched line) and keeps 2.1.2 on win32 under its existing
<2.2.0cap. 2.2.4 is the exact release that fixed the bug, so it's the minimal bound.Motivation and Context
Fixes #3407.
luigid --backgroundis broken on Python 3.13, which luigi supports (requires-python = ">=3.10, <3.14"). Foregroundluigidstill works, so this only affects daemon mode.Have you tested this? If so, how?
I reproduced the crash and verified the fix on a clean Python 3.13.13 environment.
Before, with python-daemon 2.1.2 (the version the old lock pinned),
luigid --background --logdir ./logsexits 1 with the same traceback as #3407:After, with python-daemon 3.1.2 (what
>=2.2.4resolves to), the same command exits 0. The daemon forks into the background, writes its pidfile, the scheduler logs "Scheduler starting up", and the HTTP API answers 200 on :8082.CI is green and
uv sync --lockedpasses with the regenerated lockfile.