-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Nil pointer when an allocation's task group is no longer found on the job #4560
Comments
@jippi Digging through the code, looks like this happens when an allocation's task group is no longer found on the job - https://github.com/hashicorp/nomad/blob/v0.8.4/nomad/structs/structs.go#L5987. Would be curious to see the alloc/job details if you have them. Nomad should not have panicked though, will fix this in the upcoming release. |
My current fix is this diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go
index 969f11338..e8d36df06 100644
--- a/nomad/structs/structs.go
+++ b/nomad/structs/structs.go
@@ -5984,8 +5984,11 @@ func (a *Allocation) LastEventTime() time.Time {
// ReschedulePolicy returns the reschedule policy based on the task group
func (a *Allocation) ReschedulePolicy() *ReschedulePolicy {
tg := a.Job.LookupTaskGroup(a.TaskGroup)
- if tg == nil {
- return nil
+ if tg == nil || tg.ReschedulePolicy == nil {
+ if a.Job.Type == JobTypeService {
+ return &DefaultServiceJobReschedulePolicy
+ }
+ return &DefaultBatchJobReschedulePolicy
}
return tg.ReschedulePolicy
} |
@preetapan based on the stack trace and the logs just before it, i can't find any reference to what job exactly that is causing it to crash - guidance is welcome if you got some pro-tips :) |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
Nomad v0.8.4 (dbee1d7)
Issue
Nil pointer on all servers when they get raft leadership
I'm not sure what was done to get into this state, but a nil pointer should never happen :)
The text was updated successfully, but these errors were encountered: