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

when Store.MountVolume(), the volume server will be core #1198

Merged
merged 1 commit into from Feb 13, 2020
Merged

when Store.MountVolume(), the volume server will be core #1198

merged 1 commit into from Feb 13, 2020

Conversation

ghost
Copy link

@ghost ghost commented Feb 13, 2020

in the function of Store.MountVolume(), when loadExistingVolume() failed, the return value of funtion location.LoadVolume() will also be true,
the next funtion of s.findVolume() will return nil volume, the next opertion based on nill volume will make segment fault.

func (s *Store) MountVolume(i needle.VolumeId) error {
	for _, location := range s.Locations {
		if found := location.LoadVolume(i, s.NeedleMapType); found == true {
			glog.V(0).Infof("mount volume %d", i)
			v := s.findVolume(i)
			s.NewVolumesChan <- master_pb.VolumeShortInformationMessage{
				Id:               uint32(v.Id),
				Collection:       v.Collection,
				ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()),
				Version:          uint32(v.Version()),
				Ttl:              v.Ttl.ToUint32(),
			}
			return nil
		}
	}

	return fmt.Errorf("volume %d not found on disk", i)
}

so we make loadExistingVolume() return bool, the problem will be resolved.

@chrislusf chrislusf merged commit 2cddc23 into seaweedfs:master Feb 13, 2020
@chrislusf
Copy link
Collaborator

Thanks for the explanation and fix!

@ghost ghost deleted the resolve_core_when_loadVolume_failed branch February 14, 2020 01:11
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.

None yet

1 participant