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

Upgrade Celery and friends to latest versions #7786

Merged
merged 2 commits into from Feb 22, 2021
Merged

Conversation

humitos
Copy link
Member

@humitos humitos commented Dec 28, 2020

We are receiving "Acquire on closed pool" error randomly after running instances
for more than ~1 day and calling self.app.control.cancel_consumer from our
task that kills VM instances.

This seems to be a known problem in 3.x Celery verions but some users reported
that it's still present in <4.4.

Celery released 5.x on September, so I'm upgrading to it directly as a test. If
everything keep working together, we can leave it. Otherwise, we can go back to
latest 4.4.x series: 4.4.7.

Sentry issue on production: https://sentry.io/organizations/read-the-docs/issues/2101960715/?project=148442&query=is%3Aunresolved+builds&statsPeriod=14d

Requires: https://github.com/readthedocs/readthedocs-ops/pull/837
Requires: readthedocs/common#79

# Celery 4.2 is incompatible with our code
# when ALWAYS_EAGER = True
Copy link
Member Author

Choose a reason for hiding this comment

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

This was solved in 4.3 and 4.4. Tests are not failing anymore because of this.

# Redis 3.x has an incompatible change and fails
# https://stackoverflow.com/questions/53331405/django-compress-error-invalid-input-of-type-cachekey
# https://github.com/sebleier/django-redis-cache/pull/162
Copy link
Member Author

Choose a reason for hiding this comment

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

I was able to run collectstatic without problem and I haven't seen any obvious error for now.

@humitos humitos requested a review from a team December 28, 2020 13:25
@humitos humitos added the Needed: design decision A core team decision is required label Jan 5, 2021
@humitos
Copy link
Member Author

humitos commented Feb 17, 2021

We are receiving "Acquire on closed pool" error randomly after running instances
for more than ~1 day and calling self.app.control.cancel_consumer from our
task that kills VM instances.

We are getting the same error on celery-active-tasks metrics. They stopped reporting because of this error. Yesterday after the deploy they worked OK. Today in the morning they started failing with this error.

Sentry issue: https://sentry.io/organizations/read-the-docs/issues/2222409449/events/oldest/?project=161479&query=is%3Aunresolved

We are receiving "Acquire on closed pool" error randomly after running instances
for more than ~1 day and calling `self.app.control.cancel_consumer` from our
task that kills VM instances.

This seems to be a known problem in 3.x Celery verions but some users reported
that it's still present in <4.4.

- celery/celery#4410 (comment)
- https://stackoverflow.com/questions/36789805/celery-kombu-fails-after-self-connections-acquire
- celery/celery#1839

Celery released 5.x on September, so I'm upgrading to it directly as a test. If
everything keep working together, we can leave it. Otherwise, we can go back to
latest 4.4.x series: 4.4.7.
@humitos humitos removed the Needed: design decision A core team decision is required label Feb 18, 2021
@humitos
Copy link
Member Author

humitos commented Feb 18, 2021

I'm testing this in web-extra running listening on autoscaling and web queues and everything looks good for now. I will leave it running some more time and take a look at Sentry/logs to see its progress. It seems we will be able to deploy it without too much troubles.

@humitos
Copy link
Member Author

humitos commented Feb 22, 2021

I spun up an instance of web and build-default to test Celery 5.0.5 a little more before going to production tomorrow. Everything looks good so far.

stsewd
stsewd approved these changes Feb 22, 2021
@humitos humitos merged commit 36778e9 into master Feb 22, 2021
3 checks passed
@humitos humitos deleted the humitos/upgrade-celery branch February 22, 2021 17:41
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.

None yet

2 participants