Skip to content

cc, python: Clean up BPF module and tables#808

Merged
drzaeus77 merged 1 commit intoiovisor:masterfrom
goldshtn:close-table-fd-fix
Nov 9, 2016
Merged

cc, python: Clean up BPF module and tables#808
drzaeus77 merged 1 commit intoiovisor:masterfrom
goldshtn:close-table-fd-fix

Conversation

@goldshtn
Copy link
Copy Markdown
Contributor

@goldshtn goldshtn commented Nov 9, 2016

When the BPFModule object is destroyed, shared tables
were closed, but non-shared tables were not. Add close
call to close non-shared tables in ~BPFModule.

Make sure the BPF.cleanup function in the Python module
calls bpf_module_destroy to clean up the module. Otherwise,
we have hanging table fds that aren't destroyed.

Fixes #806. This would have been an issue for any tool
that repeatedly runs a BPF program with new maps. It's just
that most tools we have haven't exhibited this behavior.

@dark
Copy link
Copy Markdown
Member

dark commented Nov 9, 2016

Thanks for the quick turnaround, this indeed fixes the problem I saw while trying out #774

@drzaeus77 drzaeus77 merged commit 7a68964 into iovisor:master Nov 9, 2016
When the `BPFModule` object is destroyed, shared tables
were closed, but non-shared tables were not. Add `close`
call to close non-shared tables in `~BPFModule`.

Make sure the `BPF.cleanup` function in the Python module
calls `bpf_module_destroy` to clean up the module. Otherwise,
we have hanging table fds that aren't destroyed.

Fixes iovisor#806. This would have been an issue for any tool
that repeatedly runs a BPF program with new maps. It's just
that most tools we have haven't exhibited this behavior.
@palmtenor
Copy link
Copy Markdown
Member

palmtenor commented Dec 8, 2016

@goldshtn Do we also need to close the loaded program FDs?

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.

bpf-map fd leak

4 participants