From 6f441c55dc477bd1867f57c7bb5c6f4cbcdf44ae Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 1 May 2020 23:38:52 +0200 Subject: [PATCH] fixup e0b5bd7: crash on endpoint.ListStale if replication-cursor-v1 bookmark present ``` cs@cstp:[~/zrepl/zrepl]: artifacts/zrepl-linux-amd64 zfs-abstraction release-stale --dry-run panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9de971] goroutine 1 [running]: github.com/zrepl/zrepl/endpoint.listStaleFiltering(0xc00012b700, 0x5, 0x8, 0x0, 0x13ccb58) /endpoint/endpoint_zfs_abstraction.go:736 +0x281 github.com/zrepl/zrepl/endpoint.ListStale(0xe3ae20, 0xc00026b740, 0x0, 0xe27c60, 0x13ccb58, 0xc0001d8690, 0x0, 0x0, 0x0, 0x1, ...) /endpoint/endpoint_zfs_abstraction.go:698 +0x3fd github.com/zrepl/zrepl/client.doZabsReleaseStale(0xe3ae20, 0xc00026b740, 0x13a28a0, 0xc000151be0, 0x0, 0x1, 0x5705b4, 0xc0002686e0) /client/zfsabstractions_release.go:83 +0x1a0 github.com/zrepl/zrepl/cli.(*Subcommand).run(0x13a28a0, 0xc000264c80, 0xc000151be0, 0x0, 0x1) /cli/cli.go:104 +0xf5 github.com/spf13/cobra.(*Command).execute(0xc000264c80, 0xc000151bd0, 0x1, 0x1, 0xc000264c80, 0xc000151bd0) GOROOT/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:760 +0x2aa github.com/spf13/cobra.(*Command).ExecuteC(0x13a43c0, 0x0, 0x0, 0x0) GOROOT/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:846 +0x2ea github.com/spf13/cobra.(*Command).Execute(...) GOROOT/pkg/mod/github.com/spf13/cobra@v0.0.2/command.go:794 github.com/zrepl/zrepl/cli.Run() /cli/cli.go:151 +0x2d main.main() /main.go:24 +0x20 ``` --- endpoint/endpoint_zfs_abstraction.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/endpoint/endpoint_zfs_abstraction.go b/endpoint/endpoint_zfs_abstraction.go index 6215694..f65800e 100644 --- a/endpoint/endpoint_zfs_abstraction.go +++ b/endpoint/endpoint_zfs_abstraction.go @@ -731,6 +731,9 @@ func listStaleFiltering(abs []Abstraction, sinceBound *CreateTXGRangeBound) *Sta } stepFirstNotStaleCandidates := make(map[fsAndJobId]stepFirstNotStaleCandidate) // empty map => will always return nil for _, a := range abs { + if a.GetJobID() == nil { + continue // already put those into always-live list noJobId in above loop + } key := fsAndJobId{a.GetFS(), *a.GetJobID()} c := stepFirstNotStaleCandidates[key]