Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Direct Runner sometimes rises RuntimeError: dictionary changed size during iteration #27501

Open
1 of 15 tasks
rafalpotempa opened this issue Jul 14, 2023 · 13 comments
Open
1 of 15 tasks

Comments

@rafalpotempa
Copy link

What happened?

Apache Beam: 2.46.0
Direct Runner

We are running some parts of our pipelines using Direct Runners, since we are processing small batches of data there. The rest is using Dataflow runner, which has some auto-recovery. For direct runners it fails the run and triggers alerts for SRE team.

I couldn't reproduce the issue myself, the issue is non-deterministic.
The part of our company's proprietary system sometimes (not very often ~100 runs) fails with:

apache_beam/runners/worker/sdk_worker.py in shutdown_inactive_bundle_processors at line 585

Exception in thread Thread-37:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/threading.py", line 72, in run
    reraise(*_capture_exception())
  File "/usr/local/lib/python3.9/site-packages/sentry_sdk/_compat.py", line 60, in reraise
    raise value
  File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/threading.py", line 70, in run
    return old_run_func(self, *a, **kw)
  File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/data_plane.py", line 228, in run
    self._function(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py", line 585, in shutdown_inactive_bundle_processors
    for descriptor_id, last_access_time in self.last_access_times.items():
RuntimeError: dictionary changed size during iteration

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@tvalentyn
Copy link
Contributor

tvalentyn commented Jul 14, 2023

we should be able to fix this by using a lock in shutdown_inactive_bundle_processors, same as

.

@anneyshas
Copy link

Hi! It's my first time contributing and I would love to give this a shot!

@anneyshas
Copy link

anneyshas commented Jul 22, 2023

.take-issue

@tvalentyn
Copy link
Contributor

great, thanks a lot, @Anneysha7

@tvalentyn
Copy link
Contributor

Hey @Anneysha7 , just wondering if you are still interested or need help. Thanks!

@anneyshas
Copy link

anneyshas commented Aug 9, 2023 via email

@tvalentyn
Copy link
Contributor

Hi @Anneysha7 i'd like to have this issue fixed in next version of Beam esp since it should be a simple fix. I suggest we unassign it for now in case someone else has time to take a look - no worries you can always pick this or any other issue when you have time to work on Beam.

@Mr-Magnificent
Copy link

Hey, would like to give this a go. Might take some time since it would be my first time contributing to apache beam. I'll assign it to myself, feel free to reassign if the criticality requires faster fix @tvalentyn. Thanks

@Mr-Magnificent
Copy link

.take-issue

@Mr-Magnificent
Copy link

Realised I am having bandwidth issues, incase issue still open post couple of week, I'd like to give it a try.

@Mr-Magnificent Mr-Magnificent removed their assignment Oct 16, 2023
@lrakla
Copy link
Contributor

lrakla commented Oct 23, 2023

.take-issue

@lrakla
Copy link
Contributor

lrakla commented Oct 23, 2023

Hi, I have set up my dev environment and will give it a try. It is my first time contributing too, so I am grateful for any guidance. For now, I'll add a lock in the required section

@tvalentyn
Copy link
Contributor

@lrakla Sounds like a plan, thanks for your help. We also have a dev wiki at https://s.apache.org/beam-python-dev-wiki, which you might find helpful.

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

No branches or pull requests

5 participants