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

Prevent taskq cash due to msg.Ctx nil and ack message before delete it #153

Merged

Conversation

lilien1010
Copy link
Collaborator

@lilien1010 lilien1010 commented Nov 15, 2021

close #150

@lilien1010 lilien1010 force-pushed the recover-panic-scheduler-goroutine branch from d31b378 to 858a0e4 Compare November 15, 2021 07:25
@lilien1010 lilien1010 changed the title Recover panic scheduler goroutine and ack message before delete it Draft: Recover panic scheduler goroutine and ack message before delete it Nov 15, 2021
redisq/queue.go Outdated
stack := string(debug.Stack())
internal.Logger.Printf("%v,panic recovered: %v,stack=%s", name, err, stack)
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

Let's not do this. It hides the problem, not fixes it.

Panics are exceptional situations that can leave you app in a broken state. It may be better to let the app crash and restart it then to recover.

// When Release a msg, ack it before we delete msg.
if err := pipe.XAck(msg.Ctx, q.stream, q.streamGroup, msg.ID).Err(); err != nil {
return err
}
Copy link
Owner

Choose a reason for hiding this comment

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

👍

@lilien1010 lilien1010 force-pushed the recover-panic-scheduler-goroutine branch 2 times, most recently from 97120fe to c1e5c06 Compare November 18, 2021 08:22
@lilien1010 lilien1010 changed the title Draft: Recover panic scheduler goroutine and ack message before delete it Prevent taskq cash due to msg.Ctx nil and ack message before delete it Nov 18, 2021
@lilien1010 lilien1010 force-pushed the recover-panic-scheduler-goroutine branch from c1e5c06 to 819b42b Compare November 18, 2021 08:24
@vmihailenco vmihailenco merged commit cab2bdf into vmihailenco:v3 Nov 18, 2021
@vmihailenco
Copy link
Owner

Thanks

kd7lxl added a commit to kd7lxl/taskq that referenced this pull request Oct 12, 2022
kd7lxl added a commit to kd7lxl/taskq that referenced this pull request Oct 12, 2022
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.

Encountering Crash when upgrade to v.3.2.7
2 participants