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

Experiment: Guard add_limit counter using lock #1277

Closed
wants to merge 1 commit into from

Conversation

sultaniman
Copy link
Contributor

No description provided.

@sultaniman sultaniman self-assigned this Apr 24, 2024
Copy link

netlify bot commented Apr 24, 2024

Deploy Preview for dlt-hub-docs ready!

Name Link
🔨 Latest commit 5a9748c
🔍 Latest deploy log https://app.netlify.com/sites/dlt-hub-docs/deploys/662a096c7f92bb000831cfd7
😎 Deploy Preview https://deploy-preview-1277--dlt-hub-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -343,7 +344,9 @@ def _gen_wrap(gen: TPipeStep) -> TPipeStep:
for i in gen: # type: ignore # TODO: help me fix this later
yield i
if i is not None:
count += 1
with counter_lock:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sultaniman I think all this code is run on the main pipeline thread anyway, so the lock will not help here, but I'm not 100% sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I also didn't dig deeper, my theory was that we submit the work to ThreadPoolExecutor which can potentially case data races.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operations on integers in CPython are atomic so we are not locking anything. IMO race condition goes deep here and we are better off by making our tests to accept 10th element 🤷

@rudolfix
Copy link
Collaborator

@sultaniman @sh-rp this kind of things should not go into PR, let's discuss them on Slack or f2f. we just waste CPU cycles on running CI

@sultaniman sultaniman closed this Apr 25, 2024
@sultaniman sultaniman deleted the fix/add-limit-lock branch April 25, 2024 10:30
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.

3 participants