Skip to content

fixing memory leak in reassembly#337

Merged
gconnell merged 1 commit intogoogle:masterfrom
jzaeske:fix-reassembly
Aug 17, 2017
Merged

fixing memory leak in reassembly#337
gconnell merged 1 commit intogoogle:masterfrom
jzaeske:fix-reassembly

Conversation

@jzaeske
Copy link
Copy Markdown

@jzaeske jzaeske commented Aug 17, 2017

Using reassmbly to reassemble tcp connections in large pcap files I noticed an increasing usage of memory. I'm not sure why, but it seems that (p *StreamPool) remove() is executed multiple times for the same connection, when ReassemblyComplete() returns true.

In this case deleting the connection from p.conns does nothing, but the connection is added multiple times to p.free.

This pull request provides functionality to avoid this duplicates in p.free by checking if the given connection is available in p.conns.

@googlebot
Copy link
Copy Markdown
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@jzaeske
Copy link
Copy Markdown
Author

jzaeske commented Aug 17, 2017

I signed it!

@googlebot
Copy link
Copy Markdown
Collaborator

CLAs look good, thanks!

@gconnell gconnell merged commit ead5261 into google:master Aug 17, 2017
@rfrancoise
Copy link
Copy Markdown

Note: the fix makes sense, but it would be interesting to know why remove() seems to be called multiple times for the same connection.

@jzaeske
Copy link
Copy Markdown
Author

jzaeske commented Aug 23, 2017

@rfrancoise I agree with you. Unfortunately I did not completely understand all the internal behaviour to name the source of that issue. This fix does at least reduce the impact of it.

@jzaeske jzaeske deleted the fix-reassembly branch August 23, 2017 10:03
@rfrancoise
Copy link
Copy Markdown

@jzaeske can you perhaps share more information about your use-case? Are you using reassemblydump, or your own code that uses the reassembly package?

traetox pushed a commit to traetox/gopacket that referenced this pull request Jan 2, 2019
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 this pull request may close these issues.

4 participants