ValueError: generator already executing when multithreading

Open Beginner friendly
#221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

Start in fluent/runtime/fallback.py, especially format_value and _bundles, and reproduce the reported failure with concurrent calls. Inspect how _bundle_it and _bundle_cache are accessed, then add a regression test for multithreaded formatting; done means concurrent calls no longer raise ValueError: generator already executing.

Written by the indexing model from the issue text.

Description

I run multiple threads and I get the following traceback:

      File "...", line ..., in ...:
        msg = l10n.format_value('...', {...})
      File "/usr/lib/python3.14/site-packages/fluent/runtime/fallback.py", line 41, in format_value
        for bundle in self._bundles():
      File "/usr/lib/python3.14/site-packages/fluent/runtime/fallback.py", line 61, in _bundles
        self._bundle_cache.append(next(self._bundle_it))
    ValueError: generator already executing

It seems that the iterator needs to be protected by a lock.

The version I use might be a bit old (see #219), but I checked the latest code on GitHub and the iterator is still unprotected.

Dominant language
Python
Stars
245
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from projectfluent/python-fluent

All issues in projectfluent/python-fluent

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.