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

mpool.ByteSlicePool leak #33

Closed
xux1217 opened this issue Nov 4, 2018 · 1 comment · Fixed by #34
Closed

mpool.ByteSlicePool leak #33

xux1217 opened this issue Nov 4, 2018 · 1 comment · Fixed by #34
Assignees

Comments

@xux1217
Copy link

xux1217 commented Nov 4, 2018

		b, err := mp.readNext()
		if err != nil {
			mp.shutdownErr = err
			return
		}
		
		mp.chLock.Lock()
		msch, ok := mp.channels[ch]
		mp.chLock.Unlock()

		switch tag {
		case newStreamTag:
			if ok {
				log.Debugf("received NewStream message for existing stream: %d", ch)
				mp.shutdownErr = ErrInvalidState
				return
			}

			name := string(b)
			msch = mp.newStream(ch, name)
			mp.chLock.Lock()
			mp.channels[ch] = msch
			mp.chLock.Unlock()
			select {
			case mp.nstreams <- msch:
			case <-mp.shutdown:
				return
			}

b, err := mp.readNext() get a byte buffer, but in case newStreamTag: branch, the b doesn't put to mpool.ByteSlicePool.

@xux1217
Copy link
Author

xux1217 commented Nov 4, 2018

in multiplex.go:259

Stebalien added a commit that referenced this issue Nov 4, 2018
* When used as a stream name in handleIncoming.
* When failing to process a message.

fixes #33
@ghost ghost assigned Stebalien Nov 4, 2018
@ghost ghost added the status/in-progress In progress label Nov 4, 2018
@ghost ghost removed the status/in-progress In progress label Nov 5, 2018
Ichbinjoe pushed a commit to Ichbinjoe/go-mplex that referenced this issue Dec 14, 2018
* When used as a stream name in handleIncoming.
* When failing to process a message.

fixes libp2p#33
Ichbinjoe pushed a commit to Ichbinjoe/go-mplex that referenced this issue Dec 14, 2018
* When used as a stream name in handleIncoming.
* When failing to process a message.

fixes libp2p#33
Ichbinjoe pushed a commit to Ichbinjoe/go-mplex that referenced this issue Dec 14, 2018
* When used as a stream name in handleIncoming.
* When failing to process a message.

fixes libp2p#33
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

Successfully merging a pull request may close this issue.

2 participants