fix: deep-copy Data in MakeHttpEvent to prevent nil pointer panic#804
fix: deep-copy Data in MakeHttpEvent to prevent nil pointer panic#804matthyx wants to merge 1 commit into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
MakeHttpEvent was sharing e.Data (a pooled *data pointer) with the returned HttpEvent. When Release() was called on the original bpfEvent after the HTTP tracer callback returned, it zeroed the shared *data's inner Data field and returned it to the pool. Any stored HttpEvent in eventsMap then held a dangling reference, causing a nil pointer dereference (SIGSEGV) when transmitOrphanRequests called GetTimestamp(). Fix by calling Datasource.DeepCopy so the HttpEvent owns an independent copy of Data, decoupled from the original event's lifecycle. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
b511089 to
008a6f0
Compare
Performance Benchmark ResultsNode-Agent Resource Usage
Dedup Effectiveness (AFTER only)
Event Counters
|
Summary
MakeHttpEventwas assigninge.Datadirectly to the newDatasourceEvent, sharing the same pooled*datapointerRelease()was called on the originalbpfEvent, it zeroed the innerData *DataElementfield of the shared*dataand returned the object to the poolHttpEventstored in the HTTP tracer'seventsMapthen held a stale reference;transmitOrphanRequestssubsequently calledGetTimestamp()→d.payload()→d.Data.Payloadwhered.Data == nil→ SIGSEGV at addr=0x8Fix: call
e.Datasource.DeepCopy(e.Data)so the returnedHttpEventowns an independent copy of the data, completely decoupled from the original event's release lifecycle.Stack trace
Test plan
go build ./pkg/utils/... ./pkg/containerwatcher/...transmitOrphanRequests🤖 Generated with Claude Code