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

Add on_ready_counter to Worker.__reduce__. #400

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

Androidown
Copy link

We need to add on_ready_counter to Worker.__reduce__, otherwise a spawned worker will have on_ready_counter == None

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

looks OK but would be better if you can share bit more context here?

@Androidown
Copy link
Author

looks OK but would be better if you can share bit more context here?

I'm trying to use SpawnWorker in celery, it works fine unless occasionally a WorkerLostError exit code 155 is raised.
After some investigation, I found the error was already fixed in this PR.
But because on_ready_counter is not present in Worker.__reduce__, it could not be correctly seriliazed and deserialized into a subprocess using spawn (It works for a forked subprocess though). The test added will raise AttributeError: 'NoneType' object has no attribute 'value' if on_ready_counter is not included.

@auvipy auvipy merged commit 8bffa2c into celery:main Jan 30, 2024
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.

2 participants