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

Allocate transformation cache value on heap #554

Merged
merged 1 commit into from
Dec 28, 2022

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Dec 28, 2022

Previously I thought TinyGo problems were solved by #553 but I hadn't let the bench run long enough to see it get slower over time, an indication of memory leak.

It seems like there is a bug in TinyGo - tinygo-org/tinygo#3358

The issue only happens with largeish values it looks like - so using a pointer for the value appears to make the problem go away. This is not ideal as it means heap allocation, something we wanted to avoid with this cache. But performance does seem to be a bit better on FTW (and presumably more so with larger payloads) with this change compared to without a transformation cache, so we can live with it until debugging further. The heap allocated object is a fixed, smallish size (it contains a couple of slices, not data itself) so it's not related to payload size as a saving grace

@anuraaga anuraaga requested a review from a team as a code owner December 28, 2022 05:45
@codecov-commenter
Copy link

Codecov Report

Base: 78.41% // Head: 78.41% // No change to project coverage 👍

Coverage data is based on head (0edb258) compared to base (8d98bc0).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           v3/dev     #554   +/-   ##
=======================================
  Coverage   78.41%   78.41%           
=======================================
  Files         145      145           
  Lines        6985     6985           
=======================================
  Hits         5477     5477           
  Misses       1275     1275           
  Partials      233      233           
Flag Coverage Δ
default 73.81% <100.00%> (ø)
examples 27.36% <100.00%> (ø)
ftw 56.60% <100.00%> (ø)
tinygo 71.92% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/corazawaf/transaction.go 79.85% <ø> (ø)
internal/corazawaf/rule.go 94.67% <100.00%> (ø)
internal/corazawaf/waf.go 91.66% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

3 participants