Skip to content

mgr: set program_name to the python path, not the macro name - #73050

Open
sunyuechi wants to merge 1 commit into
ceph:mainfrom
sunyuechi:mgr-python-program-name
Open

sunyuechi wants to merge 1 commit into
ceph:mainfrom
sunyuechi:mgr-python-program-name

Conversation

@sunyuechi

@sunyuechi sunyuechi commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

WCHAR() stringizes its argument without expanding it, so program_name has always been the literal "MGR_PYTHON_EXECUTABLE". Python then cannot find its executable: sys.executable is empty and sys.prefix is derived from the current directory.

Since Python 3.14 multiprocessing defaults to forkserver on Linux and spawns its helpers with sys.executable, so creating the ThreadPool in the cephadm module fails with BrokenPipeError and the module does not load.

Pass the byte string to PyConfig_SetBytesString() instead.

Fixes: https://tracker.ceph.com/issues/82073

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@sunyuechi
sunyuechi requested a review from a team as a code owner October 24, 2026 12:51
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. # stringizes the argument without expanding it, so program_name has been L"MGR_PYTHON_EXECUTABLE" since 4600307. I reproduced it with a small embedding program: sys.executable is '', and ThreadPool() under forkserver dies with BrokenPipeError from the resource tracker. with this change it works!

since this breaks the cephadm module on Python 3.14, it's a bug fix rather than a cleanup. could you file a tracker issue and reference it, plus Fixes: 46003075924? I'd like to get it into tentacle and umbrella too, as distros building those with 3.14 will hit this. The patch is small enough to backport cleanly.

nit: on 3.13 I still got sys.prefix == '/usr' (the build-time fallback), so I'd drop the "derived from the current directory" part from the commit message.

WCHAR() stringizes its argument without expanding it, so program_name
has always been the literal "MGR_PYTHON_EXECUTABLE". Python then cannot
find its executable and sys.executable is empty.

Since Python 3.14 multiprocessing defaults to forkserver on Linux and
spawns its helpers with sys.executable, so creating the ThreadPool in
the cephadm module fails with BrokenPipeError and the module does not
load.

Pass the byte string to PyConfig_SetBytesString() instead.

Fixes: 4600307
Fixes: https://tracker.ceph.com/issues/82073
Signed-off-by: Sun Yuechi <[email protected]>
@sunyuechi
sunyuechi force-pushed the mgr-python-program-name branch from fcf3bf9 to 491b36b Compare October 24, 2026 13:44
@sunyuechi

Copy link
Copy Markdown
Contributor Author

@tchaikov Thanks, updated.

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath9-testing-20261027.065249-main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants