mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 19:35:41 +03:00
Check if driver handle is nil before execing
Defend against tr.getDriverHandle being nil. Exec handler checks if task is running, but it may be stopped between check and driver handler fetching.
This commit is contained in:
@@ -1347,7 +1347,12 @@ func appendTaskEvent(state *structs.TaskState, event *structs.TaskEvent, capacit
|
||||
}
|
||||
|
||||
func (tr *TaskRunner) TaskExecHandler() drivermanager.TaskExecHandler {
|
||||
return tr.getDriverHandle().ExecStreaming
|
||||
// Check it is running
|
||||
handle := tr.getDriverHandle()
|
||||
if handle == nil {
|
||||
return nil
|
||||
}
|
||||
return handle.ExecStreaming
|
||||
}
|
||||
|
||||
func (tr *TaskRunner) DriverCapabilities() (*drivers.Capabilities, error) {
|
||||
|
||||
Reference in New Issue
Block a user