From c2157417e66e133a4d7a1b58c032b03341f6e7cd Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 24 Oct 2024 12:53:39 +0800 Subject: [PATCH] fix: change inner req hdr caused race https://github.com/mosn/htnn/pull/775 doesn't really fix the problem. Since we already create the wrapper, we should pass the wrapper directly to OnLog, instead of setting the reqHdr field. Signed-off-by: spacewander --- api/pkg/filtermanager/filtermanager_dev.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/pkg/filtermanager/filtermanager_dev.go b/api/pkg/filtermanager/filtermanager_dev.go index 85aac872..8502847c 100644 --- a/api/pkg/filtermanager/filtermanager_dev.go +++ b/api/pkg/filtermanager/filtermanager_dev.go @@ -32,10 +32,7 @@ func (m *filterManager) OnLog(reqHdr capi.RequestHeaderMap, reqTrailer capi.Requ wrappedReqHdr := &filterManagerRequestHeaderMap{ RequestHeaderMap: reqHdr, } - m.hdrLock.Lock() - m.reqHdr = wrappedReqHdr - m.hdrLock.Unlock() - m.runOnLogPhase(m.reqHdr, reqTrailer, rspHdr, rspTrailer) + m.runOnLogPhase(wrappedReqHdr, reqTrailer, rspHdr, rspTrailer) } func wrapFilterManager(fm *filterManager) capi.StreamFilter {