Skip to content

The Limit of 32 Pending Calls is Too Small #110693

@ericsnowcurrently

Description

@ericsnowcurrently

We currently have a limit of 32 pending calls for each interpreter. This has been the limit pretty much since pending calls were added (originally for signal handling). Now that we use pending calls between interpreters (e.g. to decref an object under the correct interpreter), a maximum of 32 is too low. This will become a bigger problem as subinterpreters are used more.

The current workaround looks something like this:

    while (_PyEval_AddPendingCall(interp, func, arg, flags) < 0) {
        // Keep trying until the pending calls is added.
    };

...perhaps also involving a separate queue or an extra thread.

Possible improvements:

  • substantially increase the limit, e.g. to 500 (and keep using the statically allocated array)
  • use a linked list with no limit
  • use a linked list with some large limit (to prevent accidental out-of-control growth)
  • use a linked list but "allocate" from a static array for the first 32 pending calls

(This issue is a continuation of gh-79647.)

Linked PRs

Metadata

Metadata

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions