Compare commits

..

3 Commits

Author SHA1 Message Date
Christian Schwarz 84eefa57bc rpc/grpcclientidentity: remove hard-coded deadline in listener adatper causing crash
Verified once again that grpc.DialContext is indeed non-blocking.
However, it checks in a defer stmt that the passed dial is not ctx.Done().
That is highly unusual if the dial is non-blocking.
But it might still happen, maybe because of machine suspend during the function call and before the defer stmt is executed.

panic:
context deadline exceeded
goroutine 49 [running]:
github.com/zrepl/zrepl/rpc/grpcclientidentity/grpchelper.ClientConn(0x1906ea0, 0xc0003ea1e0, 0x1921620, 0xc0002da660, 0x0)
        /gopath/src/github.com/zrepl/zrepl/rpc/grpcclientidentity/grpchelper/authlistener_grpc_adaptor_wrapper.go:49 +0x38c
github.com/zrepl/zrepl/rpc.NewClient(0x1906f00, 0xc0002d60f0, 0x1921620, 0xc0002da640, 0x1921620, 0xc0002da660, 0x1921620, 0xc0002da6a0, 0x1921620)
        /gopath/src/github.com/zrepl/zrepl/rpc/rpc_client.go:53 +0x199
github.com/zrepl/zrepl/daemon/job.(*modePush).ConnectEndpoints(0xc0000d1e90, 0x1921620, 0xc0002da640, 0x1921620, 0xc0002da660, 0x1921620, 0xc0002da6a0, 0x1906f00, 0xc0002d60f0)
        /gopath/src/github.com/zrepl/zrepl/daemon/job/active.go:105 +0x15d
github.com/zrepl/zrepl/daemon/job.(*ActiveSide).do(0xc0000d6120, 0x1918720, 0xc00020f170)
        /gopath/src/github.com/zrepl/zrepl/daemon/job/active.go:356 +0x236
github.com/zrepl/zrepl/daemon/job.(*ActiveSide).Run(0xc0000d6120, 0x1918720, 0xc00009c660)
        /gopath/src/github.com/zrepl/zrepl/daemon/job/active.go:347 +0x289
github.com/zrepl/zrepl/daemon.(*jobs).start.func1(0xc0000fc880, 0x1921620, 0xc0002da120, 0x191a320, 0xc0000d6120, 0x1918720, 0xc0002d6a80)
2019-10-10 14:02:12 +02:00
Juergen Hoetzel ad77371e38 docs: include Arch Linux installation 2019-10-06 20:38:00 +02:00
Juergen Hoetzel c524acb2df Fix invalid comment syntax 2019-10-06 16:23:20 +02:00
8 changed files with 8 additions and 68 deletions
-1
View File
@@ -26,7 +26,6 @@ jobs:
- type: last_n
count: 10
keep_receiver:
- type: most_recent_common_snapshot
- type: grid
grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d
regex: "zrepl_.*"
+4 -2
View File
@@ -21,8 +21,10 @@ RestrictRealtime=yes
SystemCallArchitectures=native
# BEGIN ProtectHome
ProtectHome=read-only # DEBIAN STRETCH
# ProtectHome=tmpfs # FEDORA 28 / 29
# DEBIAN STRETCH
ProtectHome=read-only
# FEDORA 28 / 29
# ProtectHome=tmpfs
# END ProtectHome
# BEGIN SystemCallFilter
+3
View File
@@ -37,6 +37,9 @@ The following list may be incomplete, feel free to submit a PR with an update:
* - MacOS
- ``brew install zrepl``
- Available on `homebrew <https://brew.sh>`_
* - Arch Linux
- ``yay install zrepl-bin``
- Available on `AUR <https://aur.archlinux.org/packages/zrepl-bin>`_
* - Others
-
- Use `binary releases`_ or build from source.
@@ -1,29 +0,0 @@
package pruning
import "sort"
type KeepMostRecentCommonAncestor struct {
_opaque struct{}
}
func NewKeepMostRecentCommonAncestor() *KeepMostRecentCommonAncestor {
return &KeepMostRecentCommonAncestor{}
}
func (k *KeepMostRecentCommonAncestor) KeepRule(snaps []Snapshot) (destroyList []Snapshot) {
var bothSides []Snapshot
for _, s := range snaps {
if s.PresentOnBothSides() {
bothSides = append(bothSides, s)
}
}
if len(bothSides) == 0 {
return []Snapshot{}
}
sort.Slice(bothSides, func(i, j int) bool {
return bothSides[i].Date().After(bothSides[j].Date())
})
return []Snapshot{bothSides[0]}
}
@@ -1,31 +0,0 @@
package pruning
import "testing"
func TestKeppMostRecentCommonAncestor(t *testing.T) {
o := func(minutes int) time.Time {
return time.Unix(123, 0).Add(time.Duration(minutes) * time.Minute)
}
tcs := map[string]testCase{
"empty": {
inputs: []Snapshot{},
rules: []KeepRule{NewKeepMostRecentCommonAncestor()},
expDestroy: map[string]bool{},
},
"nil": {
inputs: nil,
rules: []KeepRule{NewKeepMostRecentCommonAncestor()},
expDestroy: map[string]bool{},
},
"": {
inputs: []Snapshot{
stubSnap{name: "s1", date: o(5), bothSides: }
},
}
}
testTable(tcs, t)
}
-1
View File
@@ -17,7 +17,6 @@ type Snapshot interface {
Name() string
Replicated() bool
Date() time.Time
PresentOnBothSides() bool
}
// The returned snapshot list is guaranteed to only contains elements of input parameter snaps
-1
View File
@@ -9,7 +9,6 @@ type stubSnap struct {
name string
replicated bool
date time.Time
bothSides bool
}
func (s stubSnap) Name() string { return s.name }
@@ -36,9 +36,7 @@ func ClientConn(cn transport.Connecter, log Logger) *grpc.ClientConn {
})
dialerOption := grpc.WithDialer(grpcclientidentity.NewDialer(log, cn))
cred := grpc.WithTransportCredentials(grpcclientidentity.NewTransportCredentials(log))
ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second) // FIXME constant
defer cancel()
cc, err := grpc.DialContext(ctx, "doesn't matter done by dialer", dialerOption, cred, ka)
cc, err := grpc.DialContext(context.Background(), "doesn't matter done by dialer", dialerOption, cred, ka)
if err != nil {
log.WithError(err).Error("cannot create gRPC client conn (non-blocking)")
// It's ok to panic here: the we call grpc.DialContext without the