-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
BUG retry #6137
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 retry #6137
Conversation
comment indent
result after the fix, to be comparated to the one in issure report
|
why someone removed this???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR. it needs to update the tests as well :)
celery/app/task.py
Outdated
@@ -714,6 +714,8 @@ def retry(self, args=None, kwargs=None, exc=None, throw=True, | |||
if is_eager: | |||
# if task was executed eagerly using apply(), | |||
# then the retry must also be executed eagerly in apply method | |||
# This is needed for eaged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this need tests as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one got removed from someone that didn't checked that eager wasn't working...i just re-introduced(Actually was bugged cause of .get() but the correct version is that without .get() )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for that reason, a unit test is needed to verify this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't wanna discuss, thanks for your work. But where is the unit test for that new introduced BUG? I updated the 4.4.3 and now i have a new BUG. (The one i fixed here re-adding the apply ).
However I'm not much familiar with Celery unit test, I'll try to get in touch with that but it's better wait someone more familiar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you share how you do retry your tasks?
for eager retries, you may either use:
raise self.retry(...)
or
return self.retry(..., throw=False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it works with both raise/return throw True/False.
#6138
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can find in issure report the whole code to test the BUG #6135
Even using raise/return you will get an Exception on "to be retried task" and an execution on "to be retried but changed" task.
This till max_retries hit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having the same issue (openwisp/openwisp-firmware-upgrader#78). A minor release shouldn't contain a change like this IMO. Or at least the release notes should have a section about the migration path
This pull request introduces 1 alert and fixes 1 when merging 67798f4 into 52aef4b - view on LGTM.com new alerts:
fixed alerts:
|
celery/app/task.py
Outdated
@@ -714,6 +714,8 @@ def retry(self, args=None, kwargs=None, exc=None, throw=True, | |||
if is_eager: | |||
# if task was executed eagerly using apply(), | |||
# then the retry must also be executed eagerly in apply method | |||
# This is needed for eaged | |||
S.apply() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@auvipy this is the fixed regression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also check the related unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My problem is that i dosn't test things directly on unit test/git solution, but debugging my "work code" entering in celery. I have to setup the env to test/make unit tests
do you think it's possibile to release an "urgent hotfix" version? Cause this totally broke the eager and patching retry behaviour could be good too :/ |
If you have urgent production issue I suggest you to pin celery version to 4.4.2 until this gets fixed. |
4.4.2 has that BUG too...I'll try to back 4.4.1, but there was a BUG i fixed in the past (result_extend) and i have to check when.
? |
Ok, we can revert the changes on task.py seems. |
Seems not needed with 4.4.3
@mchataigner sorry, I'm doing things rapidly and I'm doing wrong things.
This is what i get from eager with my test code, as you can see, there is not print("ended")
Full fix:
I'll wait your updates |
This pull request introduces 1 alert and fixes 4 when merging 45b0fb4 into 52aef4b - view on LGTM.com new alerts:
fixed alerts:
|
Could you share the skeleton of your task? it would help to understand your problem. |
run this in eager=true in 4.4.3 (can we talk on a faster platform?) |
Ok, I'm able to reproduce locally. I will update you asap with a patch. |
Did you even noticed the split of tasks? |
So, it seems that putting autoretry_for with Exception is too broad as Celery is managing some states with Exceptions. So, yes, there is a bug in autoretry_for, not related to my patch concerning eager retry.
|
Well no...this was an example code. I need to autoretry for all Exception(General) in my real code.
|
Yes, that's what I pushed here #6138
autoretry_for is made as syntactic suggar for simple code. |
Oh, ok. I got it now. Thanks. |
SEEMS to fix #6132 too |
thanks for raising this! should be fixed by another PR. |
Bug solve for retry?
Note: Before submitting this pull request, please review our contributing
guidelines.
Description