Skip to content

Navigation Menu

Sign in
Sign up

lambda: return a copy of the pooled response buffer from Invoke - #639

Open
lenamonj wants to merge 1 commit into
aws:main from
lenamonj:handler-invoke-copies-pooled-buffer
Open

lambda: return a copy of the pooled response buffer from Invoke #639
lenamonj wants to merge 1 commit into
aws:main from
lenamonj:handler-invoke-copies-pooled-buffer

Conversation

@lenamonj

@lenamonj lenamonj commented Sep 7, 2026

Copy link
Copy Markdown

handlerFunc.Invoke returns response.Bytes() from a pooled *jsonOutBuffer after its deferred Close() has reset it and returned it to the pool, so the caller holds a slice of pooled storage that the next invoke overwrites in place. Two sequential calls on NewHandler(func(s string) (string, error) { return s, nil }) show it: once the second returns "BBBB", the first result reads "BBBB" too. Function.Invoke on the net/rpc path assigns the same slice to response.Payload.

The fix returns a copy. The new test fails on main as described and passes with the change. go test -race ./lambda/ is otherwise unchanged and golangci-lint v2.13.1 reports no issues.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.38%. Comparing base (6800157) to head (69471fa).

Additional details and impacted files
@@ Coverage Diff @@
## main #639 +/- ##
=======================================
 Coverage 82.38% 82.38% 
=======================================
 Files 36 36 
 Lines 1419 1419 
=======================================
 Hits 1169 1169 
 Misses 247 247 
 Partials 3 3 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /