Skip to content
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

panic: close of closed channel #34

Open
manishiitg opened this issue May 22, 2021 · 3 comments
Open

panic: close of closed channel #34

manishiitg opened this issue May 22, 2021 · 3 comments

Comments

@manishiitg
Copy link

Your environment.

  • Version: master
  • Browser: include version
  • Other Information - stacktraces, related issues, suggestions how to fix, links for us to have context

What did you do?

https://github.com/pion/ion-sdk-go/blob/master/client.go#L241

if c.Close() is called before publish, it gives a panic

What did you expect?

What happened?

@manishiitg
Copy link
Author

i think the issue is that when we do Close(), it interally calls delete and which again calls Close so it panics always

https://github.com/pion/ion-sdk-go/blob/master/client.go#L270

https://github.com/pion/ion-sdk-go/blob/1e8126477a4c28444a8b873d63aa6faf37078108/engine.go#L58

@manishiitg
Copy link
Author

also client Close should internally Stop the webm producer as well, if its being used

@brucekim
Copy link
Contributor

I suffer from the same issue.

Client.Close() calls Engine.DelClient() which calls Client.Close() again. This makes panic since it tries to close the closed channel, c.notify here.

Is there any reason that Engine.DelClient() does c.Close() again?

// DelClient delete a client
func (e *Engine) DelClient(c *Client) error {
	e.Lock()
	if e.clients[c.sid] == nil {
		e.Unlock()
		return errInvalidSessID
	}
/*
	if c, ok := e.clients[c.sid][c.uid]; ok && (c != nil) {
		c.Close()
	}
*/
	delete(e.clients[c.sid], c.uid)
	e.Unlock()
	return nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants