kataras / neffos

A modern, fast and scalable websocket framework with elegant API written in Go

Home Page:http://bit.ly/neffos-wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] the neffos server hang up whole goroutines

LeeEirc opened this issue · comments

Describe the bug
After upgrade lastest version, it still happened on productions. Debugging by dlv tool, I found the neffos block whole process.

Screenshots
4011585729190_ pic_hd
4021585729215_ pic_hd

Desktop (please complete the following information):

  • OS: Centos
  • Version 7.7

Could you have time to handle this questions?

this is our project. koko

@LeeEirc will take a look of it soon, please stay tuned. Until then please use one of the stackexchange redis or nats (that are much preferable on production use because of scaling-out capabilities too) and your issue should be disappear.

@kataras I do not think it is the root cause at current, as we do not use Room in our project. I think the process hang up by using atomic package. Is there any tools or ways to help me solve it?

It is because of Broadcast, if you enable redis or nats stackexhange you will see huge difference and that hanging will be disappear especially running multiple neffos servers as one

I'm not convinced that the stackexhange could solve the problem. I think every single neffos server should work well. I am not sure whether I misuse the neffos package.

sshWs.OnConnect = func(c *neffos.Conn) error {
		if c.WasReconnected() {
			namespace := c.Socket().Request().Header.Get("X-Namespace")
			if namespace != "" {
				_, _ = c.Connect(context.TODO(), "ssh")
			}
		} else {
			logger.Debug("A new ws connection arrive")
		}
		return nil
	}

This is our code snippet about handling reconnected connection. I think the Connect cause the hang problem. Now I remove these codes.

Hello @LeeEirc, if it was a problem caused by latest version and it has to do with the Connect then it should be fixed now. Could you please fetch the latest neffos from master and confirm that the patch actually fixed the issue so we can tag a new release? Thanks in advance!

go get github.com/kataras/neffos@master from inside your go.mod project.