Skip to content

Add multi-threaded compilation and evaluation tests and resolve compilation deadlock in CEL Python. - #103

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_968187521
Open

Add multi-threaded compilation and evaluation tests and resolve compilation deadlock in CEL Python.#103
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_968187521

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 21, 2026

Copy link
Copy Markdown

Add multi-threaded compilation and evaluation tests and resolve compilation deadlock in CEL Python.

This change adds cel_parallel_test.py to benchmark and validate compiling and
evaluating a diverse set of CEL expressions concurrently across multiple worker
threads using concurrent.futures.ThreadPoolExecutor as well as sequentially.

In addition, this resolves an AB-BA deadlock between the Python GIL and Protobuf
DescriptorPool C++ mutex during concurrent compilation by releasing the GIL
in PyCelEnv::Compile and acquiring the GIL via py::gil_scoped_acquire on-demand
in PyDescriptorDatabase callbacks, while protecting PyCelEnvInternal with a mutex.

Test duration metrics:

  • Multi-threaded compilation (1,000 iterations): ~248 ms
  • Sequential compilation (1,000 iterations): ~394 ms
  • Multi-threaded evaluation (10,000 iterations): ~782 ms
  • Sequential evaluation (10,000 iterations): ~434 ms

…lation deadlock in CEL Python.

This change adds cel_parallel_test.py to benchmark and validate compiling and
evaluating a diverse set of CEL expressions concurrently across multiple worker
threads using concurrent.futures.ThreadPoolExecutor as well as sequentially.

In addition, this resolves an AB-BA deadlock between the Python GIL and Protobuf
DescriptorPool C++ mutex during concurrent compilation by releasing the GIL
in PyCelEnv::Compile and acquiring the GIL via py::gil_scoped_acquire on-demand
in PyDescriptorDatabase callbacks, while protecting PyCelEnvInternal with a mutex.

Test duration metrics:
- Multi-threaded compilation (1,000 iterations): ~248 ms
- Sequential compilation (1,000 iterations): ~394 ms
- Multi-threaded evaluation (10,000 iterations): ~782 ms
- Sequential evaluation (10,000 iterations): ~434 ms

PiperOrigin-RevId: 968187521
@copybara-service copybara-service Bot changed the title Add multi-threaded evaluation and compilation tests for CEL Python. Add multi-threaded compilation and evaluation tests and resolve compilation deadlock in CEL Python. Aug 21, 2026
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.

1 participant