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

fix(pdk) prevent memory leaks in 'kong.service.response' & 'kong.ctx' #4172

Merged
merged 2 commits into from Jan 10, 2019

Conversation

Projects
None yet
2 participants
@thibaultcha
Copy link
Member

commented Jan 9, 2019

Leak 1

This index metamethod attachment for response headers tables maintains a reference
to itself as an upvalue. This was verified by increasing upvalues, functions, and
table object counts when using this API over time.

The newer implementation is also more efficient and avoids creating
closures at runtime.

Leak 2

See kong.global module's set_named_ctx API. The third argument
(key) will be a plugin's configuration table. It is important not to
hold references to those configuration tables, as already observed
across many parts of the codebase.

@thibaultcha thibaultcha force-pushed the fix/gc-leak-in-pdk branch from 0cff7d7 to 2ff5446 Jan 9, 2019

thibaultcha added some commits Jan 9, 2019

fix(pdk) prevent a memory leak with in 'service.response' module
Introduced in eb20498, this index
metamethod attachment for response headers tables maintains a references
to itself. This was verified by increasing upvalues, functions, and
table object counts increasing when using this API over time.

The newer implementation is also more efficient and avoids creating
closures at runtime.

Fix #4143
fix(pdk) proper __mode for 'kong.ctx' named contexts
See `kong.global` module's `set_named_ctx` API. The third argument
(`key`) will be a plugin's configuration table. It is important not to
hold references to those configuration tables, as already observed
across many parts of the codebase.

@thibaultcha thibaultcha force-pushed the fix/gc-leak-in-pdk branch from 2ff5446 to 5270c80 Jan 9, 2019

@thibaultcha thibaultcha merged commit 0293f91 into master Jan 10, 2019

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla All CLA requirements met.

@thibaultcha thibaultcha deleted the fix/gc-leak-in-pdk branch Jan 10, 2019

@hishamhm hishamhm added this to the 1.0.1 milestone Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.