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

Memory leak from fragmented payload #3605

Closed
zephyrbot opened this issue May 18, 2017 · 13 comments
Closed

Memory leak from fragmented payload #3605

zephyrbot opened this issue May 18, 2017 · 13 comments
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented May 18, 2017

Reported by Ruslan Mstoi:

Defensics test case #6 ICMPv6.Echo.Echo-Request.IPv6-Packet.payload.protocol.icmpv6-message.icmpv6-echo-request.element

After running this test case echo server has a memory leak:

Fragment length 128 bytes
Network buffer pools:
Name Size Count Avail Address
RX 8000 100 98 0x0011ee4c
TX 8000 100 100 0x0011ee68
RX DATA (rx_bufs) 14800 100 76 0x0011e620
TX DATA (tx_bufs) 14800 100 100 0x0011e5e0

To reproduce, use attached testcase6-replay.pcap , and replay it by:

  1. Enable fragmentation in echo_server
  2. Set MAC address of echo_server to 10:00:00:00:00:10
  3. sudo tcpreplay -i tap0 testcase6-replay.pcap

(Imported from Jira ZEP-2166)

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 18, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 18, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 18, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

by Mark Linkmeyer:

Jukka Rissanen , can you review the priority and make sure we've set it appropriately?

@zephyrbot
Copy link
Collaborator Author

by Ruslan Mstoi:

I've applied patches from pull request 289: #289

With patches applied after series of large fragmented packets echo_server still suffers from memory leak.

I've attached files from test case ICMPv6.Echo.Echo-Request.IPv6-Packet.payload.protocol.icmpv6-message.icmpv6-echo-request.element - 20, named with prefix icmpv6-echo-20

If you replay icmpv6-echo-20-replay.pcap serveral times echo_server will run out of memory and print error messages:

[net/net_pkt] [DBG] net_pkt_print: (0x001[net/buf] [ERR] net_buf_alloc_debug: net_pkt_get_reserve_data_debug():352: Failed to get free buffer
[slip] [ERR] slip_input_byte: [0x00120100] cannot allocate data fragment

and "net mem" will show:

shell> net mem
Fragment length 128 bytes
Network buffer pools:
Name Size Count Avail Address
RX 8000 100 94 0x0011fc0c
TX 8000 100 100 0x0011fc28
RX DATA (rx_bufs) 14800 100 36 0x0011f3e0
TX DATA (tx_bufs) 14800 100 100 0x0011f3a0

Note that the same error messages appear in attached log file, when running this test case once

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 24, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 24, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented May 24, 2017

by Ruslan Mstoi:

@zephyrbot
Copy link
Collaborator Author

by Jukka Rissanen:

By default the IPv6 fragmentation is disabled so the medium priority is ok in this respect. This issue will be fixed of course.

@zephyrbot
Copy link
Collaborator Author

by Jukka Rissanen:

Found the culprit, the static initialization of reassembly timer did not work as expected which was then seen as a memory leak.
A new version of PR #289 is sent for review #289

@zephyrbot
Copy link
Collaborator Author

by Ruslan Mstoi:

It seems there is still a memory leak with the new version of PR#289

Test case replayed several times by:
for((i=1; i<=20; i++)); do tcpreplay -i tap0 icmpv6-echo-20-replay.pcap ; done

shell> net mem
Fragment length 128 bytes
Network buffer pools:
Name Size Count Avail Address
RX 8000 100 92 0x0011fc4c
TX 8000 100 100 0x0011fc68
RX DATA (rx_bufs) 14800 100 12 0x0011f4a0
TX DATA (tx_bufs) 14800 100 100 0x0011f460

@zephyrbot
Copy link
Collaborator Author

by Jukka Rissanen:

Indeed there was still an issue with memory handling. This is now fixed in the latest PR#289 version.

@zephyrbot
Copy link
Collaborator Author

by Ruslan Mstoi:

Fixes in pull request solve this issue

@zephyrbot zephyrbot added priority: medium Medium impact/importance bug area: Networking bug The issue is a bug, or the PR is fixing a bug labels Sep 23, 2017
@zephyrbot zephyrbot added this to the v1.8.0 milestone Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants