mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-18 21:26:56 +00:00
fix(admin): skip task state files with no task data on load
An empty or truncated tasks/*.pb file unmarshals into a TaskStateFile with a nil Task, and protobufToMaintenanceTask dereferenced it immediately, panicking the whole admin process on startup. Guard the nil case so the loader logs a warning and skips the bad file.
This commit is contained in:
@@ -1088,6 +1088,10 @@ func (cp *ConfigPersistence) loadTaskStateLocked(taskID string) (*maintenance.Ma
|
||||
return nil, fmt.Errorf("failed to unmarshal task state protobuf: %w", err)
|
||||
}
|
||||
|
||||
if taskStateFile.Task == nil {
|
||||
return nil, fmt.Errorf("task state file %s contains no task data", taskID)
|
||||
}
|
||||
|
||||
// Convert protobuf to maintenance task
|
||||
task := cp.protobufToMaintenanceTask(taskStateFile.Task)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user