Skip to content

Commit 032c366

Browse files
committed
revert globalreader
1 parent f9c6c1e commit 032c366

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

ebpf/bpfwrapper/perfbufferreaders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func NewProbeChannel(name string, handler ProbeEventLoop) *ProbeChannel {
3636

3737
// Start initiate a goroutine for the event loop handler, for a lost events messages and the perf map.
3838
func (probeChannel *ProbeChannel) Start(module *bcc.Module, connectionFactory *connections.Factory) error {
39-
probeChannel.eventChannel = make(chan []byte, 100)
39+
probeChannel.eventChannel = make(chan []byte)
4040
probeChannel.lostEventsChannel = make(chan uint64)
4141

4242
table := bcc.NewTable(module.TableId(probeChannel.name), module)

trafficUtil/kafkaUtil/parser.go

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ var (
4040
"TRACE": true,
4141
"TRACK": true,
4242
"PATCH": true}
43-
DebugStrings = []string{}
44-
globalReader = &bytes.Reader{}
45-
globalReaderLock sync.Mutex
46-
43+
DebugStrings = []string{}
4744
)
4845

4946
const ONE_MINUTE = 60
@@ -133,7 +130,7 @@ func checkDebugUrlAndPrint(url string, host string, message string) {
133130
utils.PrintLogDebug(logMsg)
134131
go ProduceLogs(ctx, logMsg, LogTypeInfo)
135132
break
136-
}else if strings.Contains(host, debugString) {
133+
} else if strings.Contains(host, debugString) {
137134
ctx := context.Background()
138135
logMsg := fmt.Sprintf("%s : %s", message, host)
139136
utils.PrintLogDebug(logMsg)
@@ -185,12 +182,7 @@ func ParseAndProduce(receiveBuffer []byte, sentBuffer []byte, sourceIp string, d
185182
slog.Debug("ParseAndProduce", "receiveBuffer", string(receiveBuffer), "sentBuffer", string(sentBuffer))
186183
}
187184

188-
reader := func() *bufio.Reader {
189-
globalReaderLock.Lock()
190-
defer globalReaderLock.Unlock()
191-
globalReader.Reset(receiveBuffer)
192-
return bufio.NewReader(globalReader)
193-
}()
185+
reader := bufio.NewReader(bytes.NewReader(receiveBuffer))
194186
i := 0
195187
requests := []http.Request{}
196188
requestsContent := []string{}
@@ -222,12 +214,7 @@ func ParseAndProduce(receiveBuffer []byte, sentBuffer []byte, sourceIp string, d
222214
return
223215
}
224216

225-
reader = func() *bufio.Reader {
226-
globalReaderLock.Lock()
227-
defer globalReaderLock.Unlock()
228-
globalReader.Reset(sentBuffer)
229-
return bufio.NewReader(globalReader)
230-
}()
217+
reader = bufio.NewReader(bytes.NewReader(sentBuffer))
231218
i = 0
232219

233220
responses := []http.Response{}
@@ -474,7 +461,7 @@ func ParseAndProduce(receiveBuffer []byte, sentBuffer []byte, sourceIp string, d
474461
}
475462
}
476463
} else {
477-
checkDebugUrlAndPrint(url,req.Host, "Pod labels not resolved, PodInformerInstance is nil or direction is not inbound, direction: "+fmt.Sprint(direction))
464+
checkDebugUrlAndPrint(url, req.Host, "Pod labels not resolved, PodInformerInstance is nil or direction is not inbound, direction: "+fmt.Sprint(direction))
478465
}
479466

480467
out, _ := json.Marshal(value)

0 commit comments

Comments
 (0)