-
Notifications
You must be signed in to change notification settings - Fork 162
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
is it thread safe in the use of play? #19
Comments
and I find it will run into the state of deadlock , then I send the quit signal and it dump the text below: goroutine 0 [idle]: goroutine 1 [IO wait]: goroutine 17 [syscall, 73 minutes, locked to thread]: goroutine 19 [semacquire, 25 minutes]: goroutine 1944 [IO wait, 8 minutes]: goroutine 2051 [IO wait, 8 minutes]: goroutine 2863 [IO wait]: goroutine 2001 [IO wait, 8 minutes]: goroutine 2046 [IO wait, 8 minutes]: goroutine 2006 [IO wait, 8 minutes]: goroutine 2063 [IO wait, 8 minutes]: rax 0xca |
Can you try to fix it? I will happy to merge your codes into master branch. |
@zhangpeihao thanks for merging my code into master, Now I just want to use your client code to generate a rtmp check server, it is useful for me. I will keep deep looking for the code and fix some bugs for you. If I have some questions, I will communicate with you . |
@zhangpeihao https://github.com/zhangpeihao/gortmp/blob/master/handshake.go#L207 因为我发现造成死锁的原因在于 handshake 读 s0 的时候一直在等待,这可能包括两个原因,一个是你这里的超时时间为0, 是否意味着一直需要等到读到 s0, 是否可以考虑设置一个超时时间;两一个原因是不是有可能 client 发送了 c0 + c1, 但是服务端没有收到,于是按照协议在没有收到 c1 前,服务端不会发送 s0 |
是的,这块是有问题。初始化时设置超时时间不对。我记得好像改过。 |
@zhangpeihao 会不会存在发送 c0 + c1 后对方没有收到,超时时间为0,就一直等待的情况? |
我周六看下 |
@zhangpeihao 谢谢,你应该是流媒体专家吧,我是初学者,请多指教 |
HandShake之后,我把deadline关掉了。 |
@zhangpeihao 好的,你的意思是即使设置了 timeout, 也需要加这段话,那你之前的代码里 timeout 设置的是0 那肯定是不行了。 |
HandShake的timeout参数只是握手的超时,之后如果不去掉,会导致后面处理超时 |
@zhangpeihao 比如我用 go routine 来检测某个 ip 的rtmp 是否有数据,如果有数据我就 close 了,但是我发现因为 内部有 read loop 和 write loop 导致 NewConn 分配的内存一直都释放不了,我的内存一直在涨,这个是存在这个问题吧。 |
timeout设置为0,握手就不会设置deadline,应该没有问题。 |
@zhangpeihao 那我前面设置 timeout > 0 , 后面加上你之前加的 set deadline 语句,和你之前 timeout 设置为0 的效果一样吗? |
I use rtmp client to check the edge ip whether can be fetch data?
func DetectRtmp(vip string) bool {
rtmpName := "rtmp://" + vip + "/uplive.b0.upaiyun.com/live"
streamName := "jiqiang"
}
func Check() {
res := make(map[string]bool)
var wg sync.WaitGroup
var mutex = &sync.Mutex{}
}
WARNING: DATA RACE
Write by goroutine 420:
github.com/zhangpeihao/gortmp.(_conn).Close()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/conn.go:444 +0x3a
github.com/zhangpeihao/gortmp.(_outboundConn).Close.func1()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/outboundconn.go:249 +0x70
Previous read by goroutine 73:
github.com/zhangpeihao/gortmp.(*conn).sendLoop()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/conn.go:241 +0x79
Goroutine 420 (running) created at:
github.com/zhangpeihao/gortmp.(*outboundConn).Close()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/outboundconn.go:250 +0x15c
main.DetectRtmp()
/root/yang/upsrs/upsrs_api/check/server/check_srs_edge_server.go:101 +0x4c3
main.Check.func1()
/root/yang/upsrs/upsrs_api/check/server/check_srs_edge_server.go:117 +0xca
Goroutine 73 (running) created at:
github.com/zhangpeihao/gortmp.NewConn()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/conn.go:148 +0x71c
github.com/zhangpeihao/gortmp.Dial()
/root/yang/gopath/src/github.com/zhangpeihao/gortmp/outboundconn.go:109 +0xabd
main.DetectRtmp()
/root/yang/upsrs/upsrs_api/check/server/check_srs_edge_server.go:59 +0x25a
main.Check.func1()
/root/yang/upsrs/upsrs_api/check/server/check_srs_edge_server.go:117 +0xca
The text was updated successfully, but these errors were encountered: