[GH-ISSUE #745] Ineffectual error assignment in processor perform defer callback #365

Open
opened 2026-03-02 05:20:43 +03:00 by kerem · 3 comments
Owner

Originally created by @khun84 on GitHub (Sep 20, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/745

If I read the code correctly, I think the error assignment in line 427 as well as line 429 are ineffectual as the err is later reassigned at line 431.

github.com/hibiken/asynq@6a7bf2ceff/processor.go (L426-L433)

Am I missing anything here or its potentially a bug? 🤔

Originally created by @khun84 on GitHub (Sep 20, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/745 If I read the code correctly, I think the error assignment in line 427 as well as line 429 are ineffectual as the `err` is later reassigned at line 431. https://github.com/hibiken/asynq/blob/6a7bf2ceff1e920b3e8542635b273c4dcca192ac/processor.go#L426-L433 Am I missing anything here or its potentially a bug? 🤔
Author
Owner

@kamikazechaser commented on GitHub (Sep 20, 2023):

Thanks for reporting this. I think you are onto something here, It is definitely reassigned!

Pinging @linhbkhn95 on this.

potentially a bug?

I don't think so. The debug.Stack() message will still be more informative that the ones in the if else block. But good to fix such confusions. Though this change has not been released yet in any case.

<!-- gh-comment-id:1728180200 --> @kamikazechaser commented on GitHub (Sep 20, 2023): Thanks for reporting this. I think you are onto something here, It is definitely reassigned! Pinging @linhbkhn95 on this. > potentially a bug? I don't think so. The debug.Stack() message will still be more informative that the ones in the if else block. But good to fix such confusions. Though this change has not been released yet in any case.
Author
Owner

@linhbkhn95 commented on GitHub (Sep 22, 2023):

Thanks @khun84 for reporting this issue. good catch.
It will not make potential bugs. But it makes it confusing. So, I will make a PR to improve it.

<!-- gh-comment-id:1730788588 --> @linhbkhn95 commented on GitHub (Sep 22, 2023): Thanks @khun84 for reporting this issue. good catch. It will not make potential bugs. But it makes it confusing. So, I will make a PR to improve it.
Author
Owner

@linhbkhn95 commented on GitHub (Oct 8, 2023):

I just made PR to fix it
https://github.com/hibiken/asynq/pull/758
@kamikazechaser Please review it

<!-- gh-comment-id:1751901948 --> @linhbkhn95 commented on GitHub (Oct 8, 2023): I just made PR to fix it https://github.com/hibiken/asynq/pull/758 @kamikazechaser Please review it
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#365
No description provided.