Skip to content

NSAPI/lwIP: Free held netbuf on close #3975

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

Merged
merged 1 commit into from
Mar 23, 2017

Conversation

kjbracey
Copy link
Contributor

mbed_lwip_socket_recv() takes one netbuf at a time from the netconn API,
and it holds a partially-read netbuf if necessary in order to present as
a stream for TCP.

This held netbuf was not being freed when the socket was closed.

Fixes issue #3974.

mbed_lwip_socket_recv() takes one netbuf at a time from the netconn API,
and it holds a partially-read netbuf if necessary in order to present as
a stream for TCP.

This held netbuf was not being freed when the socket was closed.
@kjbracey
Copy link
Contributor Author

One note on this netbuf thing for future consideration - the netbuf API isn't ideal for TCP, as TCP doesn't internally hold netbufs, so netconn_recv() itself allocates a temporary netbuf just to make TCP match UDP and raw.

As we know this path is TCP-only, you could use netconn_recv_tcp_pbuf to skip that step, and just work on the pbufs.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 21, 2017

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1709

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 22, 2017

Restarted jenkins CI, please look at the result once done

The current failures are 3 identified, one of them for instance ./mbed-client/source/m2mbase.cpp:60:23: error: 'M2MBase::lwm2m_parameters_s' has no member named 'dynamic_resource_params' , is this valid? As this patch does not touch that code

@kjbracey
Copy link
Contributor Author

The branch was deliberately created based on an old revision, partly to test whether your CI was correctly testing the merge result with master, or just testing the tip of the branch.

It seems it might just be testing the tip. I could rebase the branch, but maybe you want to check your CI configuration?

@tommikas
Copy link
Contributor

@kjbracey-arm The mbed-client part of the jenkins/pr-head build doesn't currently do the merge. There's a task to add it, but I'm not sure what the status of it is at the moment.

@tommikas
Copy link
Contributor

@kjbracey-arm We'll fix it soon (TM). If you're in a hurry with this PR I'd suggest rebasing.

@kjbracey
Copy link
Contributor Author

I'm not personally in a hurry - it's just to address the GitHub issue referenced - a slightly hard-to-cause memory leak.

So I'm happy to leave it for the moment as a testcase.

Copy link
Contributor

@geky geky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@kjbracey
Copy link
Contributor Author

@0xc0170 I believe Jenkins has been fiddled with successfully. Could you retrigger?

@tommikas
Copy link
Contributor

@kjbracey-arm @0xc0170 I just restarted the job.

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

Successfully merging this pull request may close these issues.

6 participants