Giter VIP home page Giter VIP logo

Comments (10)

myzhan avatar myzhan commented on July 21, 2024 2

多谢测试,这个特性目前没有文档化的,等大家用多了再加上去,如果有不合适的可以改。

from boomer.

myzhan avatar myzhan commented on July 21, 2024

懂了,不过目前 quit 有两种情况,一种是 boomer 自己关闭,一个是 master 要求关闭,我在考虑要不要区分这两种事件。

from boomer.

yuyongID avatar yuyongID commented on July 21, 2024

懂了,不过目前 quit 有两种情况,一种是 boomer 自己关闭,一个是 master 要求关闭,我在考虑要不要区分这两种事件。

我现在的使用场景 client 在这两种退出的情况需要的清理状态的工作是一样的,在不区分的情况下也基本够用。如果作区分的话,订阅事件的操作可以写得更加具体。不过我现在应该是暂时用不上。

from boomer.

myzhan avatar myzhan commented on July 21, 2024

加上了,试试

6f8fb6f

from boomer.

yuyongID avatar yuyongID commented on July 21, 2024

加上了,试试

6f8fb6f

试了一下 client 清理状态的操作不能被执行。感觉上是因为 os.Exit() 太快了,其他 goroutine 还没有来得及发现 quit channel 被关闭主进程就退出了。
ctrl + c 的时候也是通过订阅 boomer:quit 来触发清理状态的操作的,测试一下也是偶尔能正常清理 client 的状态,大多数情况都没有触发到清理操作。

from boomer.

myzhan avatar myzhan commented on July 21, 2024

Events.Publish() 是阻塞的,handler 没响应之前,不会调用 os.Exit()

所以你的 handler 要自己阻塞一下

from boomer.

yuyongID avatar yuyongID commented on July 21, 2024

自己堵塞了一下,ctrl + c 就可以正常清除状态。locust master 下发quit的时候还是不能正常清除。而且我直接 Sleep 3s 堵塞的时候,程序也并没有等待 3s 而是直接退出了。表现出来的效果并不像是Events.Publish() 是阻塞的。偶尔 boomer 在退出之后打印还会打印 panic。

16:05:43 client_gomq.go:59: ZMQ sockets connected
16:05:43 client_gomq.go:30: Boomer is built with gomq support.
16:05:43 client_gomq.go:54: Boomer is connected to master(172.16.16.72:5557|5558) press Ctrl+c to quit.
16:05:55 runner.go:196: Got quit message from master, shutting down...
16:05:55 client_gomq.go:72: runtime error: index out of range
goroutine 38 [running]:
runtime/debug.Stack(0xc0000c8000, 0x2, 0xc00013c210)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/myzhan/boomer.(*gomqSocketClient).recv.func1()
        /Users/dengyu/go/src/github.com/myzhan/boomer/client_gomq.go:73 +0x94
panic(0x455ad00, 0x4a557e0)
        /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/zeromq/gomq.(*Socket).Recv(...)
        /Users/dengyu/go/src/github.com/zeromq/gomq/socket.go:115
github.com/myzhan/boomer.(*gomqSocketClient).recv(0xc0000c83c0)
        /Users/dengyu/go/src/github.com/myzhan/boomer/client_gomq.go:79 +0x1b2
created by github.com/myzhan/boomer.(*gomqSocketClient).connect
        /Users/dengyu/go/src/github.com/myzhan/boomer/client_gomq.go:55 +0x6ad
16:05:55 client_gomq.go:74: The underlying socket connected to master(172.16.16.72:5558) may be broken, please restart both locust and boomer

from boomer.

myzhan avatar myzhan commented on July 21, 2024

表现出来的效果并不像是Events.Publish() 是阻塞的。

这个我还不清楚是啥情况,我这样测试,是可以阻塞的。

func TestOnQuitMessage(t *testing.T) {
	runner := newRunner(nil, nil, "asap")
	defer runner.close()

	Events.Subscribe("boomer:quit", func() {
		time.Sleep(3 * time.Second)
		log.Println("blocked by sleep")
	})

	runner.onMessage(newMessage("quit", nil, runner.nodeID))
}

偶尔 boomer 在退出之后打印还会打印 panic。

这个我改一下吧,是 runner 订阅了 boomer:quit,在 master 主动断开的时候,还向 master 发消息。

并不是 panic,是我把 gomq 的 panic 捕获了,打了日志而已。

from boomer.

myzhan avatar myzhan commented on July 21, 2024

偶尔 boomer 在退出之后打印还会打印 panic。

已修改到
43803d5

from boomer.

yuyongID avatar yuyongID commented on July 21, 2024

这个我还不清楚是啥情况,我这样测试,是可以阻塞的。

这个阻塞的是我使用订阅处理函数的问题,修改了一下之后确实可以堵塞的。谢谢大佬指点。

from boomer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.