Skip to content

gh-161098: Unlink the new ShareableList block if packing a value fails - #161099

Merged
gpshead merged 1 commit into
python:mainfrom
gpshead:shareablelist-unlink-on-error
Nov 1, 2026
Merged

gpshead merged 1 commit into
python:mainfrom
gpshead:shareablelist-unlink-on-error

Conversation

@gpshead

@gpshead gpshead commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

If packing the values fails in ShareableList.__init__, close and unlink the shared memory block it just created before re-raising. This branch is only reached when a sequence is given, so the block was always created by this call and nothing else holds a reference to it; unlink() also unregisters it from the resource tracker. This also covers SharedMemoryManager.ShareableList(), which goes through the same constructor.

Fixes #161098

ANT-2026-740NDRCA

…e fails

ShareableList(sequence) created its shared memory block before packing the
values, so an unpackable value (an int outside int64, a lone surrogate)
left the block behind with no way for the caller to release it.
@gpshead gpshead added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 1, 2026
@gpshead gpshead self-assigned this Nov 1, 2026
@gpshead
gpshead marked this pull request as ready for review November 1, 2026 18:03
@gpshead
gpshead enabled auto-merge (squash) November 1, 2026 18:04
@gpshead
gpshead merged commit 82d3439 into python:main Nov 1, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 1, 2026

Copy link
Copy Markdown

GH-161131 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 1, 2026
@bedevere-app

bedevere-app Bot commented Nov 1, 2026

Copy link
Copy Markdown

GH-161132 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 1, 2026
gpshead added a commit that referenced this pull request Nov 1, 2026
…ue fails (GH-161099) (#161131)

ShareableList(sequence) created its shared memory block before packing the
values, so an unpackable value (an int outside int64, a lone surrogate)
left the block behind with no way for the caller to release it.

(cherry picked from commit 82d3439)
gpshead added a commit that referenced this pull request Nov 1, 2026
…ue fails (GH-161099) (#161132)

ShareableList(sequence) created its shared memory block before packing the
values, so an unpackable value (an int outside int64, a lone surrogate)
left the block behind with no way for the caller to release it.

(cherry picked from commit 82d3439)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShareableList leaves its shared memory block behind when packing fails

1 participant