小编Ran*_*alt的帖子

如何在重新获得连接时避免双重连接?

在这些情况下:

  1. 客户端失去了与zk的网络连接.
  2. 一分钟过去了.
  3. 客户端重新获得与zk的网络连接.

我有以下恐慌:

panic: close of closed channel

goroutine 2849 [running]:
github.com/samuel/go-zookeeper/zk.(*Conn).Close(0xc420795180)
  github.com/samuel/go-zookeeper/zk/conn.go:253 47
github.com/curator-go/curator.(*handleHolder).internalClose(0xc4203058f0, 0xc420302470, 0x0)
  github.com/curator-go/curator/state.go:136 +0x8d
github.com/curator-go/curator.(*handleHolder).closeAndReset(0xc4203058f0, 0xc42587cd00, 0x1e)
  github.com/curator-go/curator/state.go:122 +0x2f
github.com/curator-go/curator.(*connectionState).reset(0xc420302420, 0x1b71d87, 0xf)
  github.com/curator-go/curator/state.go:234 +0x55
github.com/curator-go/curator.(*connectionState).handleExpiredSession(0xc420302420)
  github.com/curator-go/curator/state.go:351 +0xd9
github.com/curator-go/curator.(*connectionState).checkState(0xc420302420, 0xffffff90, 0x0, 0x0, 0xc425ed2600, 0xed0e5250a)
  github.com/curator-go/curator/state.go:318 +0x9c
github.com/curator-go/curator.(*connectionState).process(0xc420302420, 0xc425ed2680)
  github.com/curator-go/curator/state.go:299 +0x16d
created by github.com/curator-go/curator.(*Watchers).Fire
  github.com/curator-go/curator/watcher.go:64 +0x96
Run Code Online (Sandbox Code Playgroud)

这是详细的事件序列:

  1. 客户端失去了与zk的网络连接.
  2. 一分钟过去了.
  3. 客户端重新获得与zk的网络连接.
  4. goroutine A调用s.ReregisterAll()- > Conn()- > checkTimeout()- > reset(bc已过去1分钟) - > closeAndReset()- > conn.Close() 可以阻止一秒钟
  5. goroutine B句柄zk.StateExpired(zk集群发送此bc它认为这个客户端已经死了,因为它在2期间没有ping.) - …

go apache-zookeeper apache-curator

12
推荐指数
1
解决办法
562
查看次数

最新 Mac OS 上的 Java 11 似乎一次锁定文件系统几分钟

由于在我的 Macbook Pro(最新操作系统等)上升级到 java 11,编译项目似乎经常长时间锁定整个文件系统。还有其他人有这个问题吗?任何想法如何调试它?

更新:我dtruss在这个过程中做了一个,我看到了像这样无休止的输出。我不知道这是否重要。

gettimeofday(0x700001D00D98, 0x0, 0x0)       = 0 0
gettimeofday(0x7000011DCE18, 0x0, 0x0)       = 0 0
psynch_cvwait(0x7F8EF6417C10, 0x89A0100089B00, 0x0)      = -1 316
gettimeofday(0x700001D00D98, 0x0, 0x0)       = 0 0
psynch_cvwait(0x7F8EF6417C10, 0x89B0100089C00, 0x0)      = -1 316
gettimeofday(0x700001D00D98, 0x0, 0x0)       = 0 0
psynch_cvwait(0x7F8EF6417C10, 0x89C0100089D00, 0x0)      = -1 316
gettimeofday(0x700001D00D98, 0x0, 0x0)       = 0 0
psynch_cvwait(0x7F8EF6417C10, 0x89D0100089E00, 0x0)      = -1 316
gettimeofday(0x700001D00D98, 0x0, 0x0)       = 0 0
psynch_cvwait(0x7F8EF6417C10, 0x89E0100089F00, 0x0)      = -1 316
Run Code Online (Sandbox Code Playgroud)

只是无休止地调用它,然后每隔一段时间:

stat64("<xxxx>.class\0", 0x700000CCBF30, 0x0)        = 0 …
Run Code Online (Sandbox Code Playgroud)

java macos java-11

7
推荐指数
0
解决办法
204
查看次数

标签 统计

apache-curator ×1

apache-zookeeper ×1

go ×1

java ×1

java-11 ×1

macos ×1