You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Additional context
code
when ew.incoming reach ew.tickerCount then always keep ew.writeEvent(e), ew.payload.Write(e.Payload()) makes e.Payload() too long to apply too much memory. In some cases, it may even trigger an OOM
Is it possible to add some configuration mechanism to limit the number of times a single uuid work executes ew.writeEvent(e)?
func (ew *eventWorker) Run() {
for {
select {
case <-ew.ticker.C:
// 输出包
if ew.tickerCount > MaxTickerCount {
//ew.processor.GetLogger().Printf("eventWorker TickerCount > %d, event closed.", MaxTickerCount)
ew.processor.delWorkerByUUID(ew)
for {
select {
case e := <-ew.incoming:
ew.writeEvent(e)
default:
if ew.IfUsed() {
time.Sleep(10 * time.Millisecond)
continue
}
ew.Close()
return
}
}
}
ew.tickerCount++
case e := <-ew.incoming:
// reset tickerCount
ew.tickerCount = 0
ew.writeEvent(e)
}
}
}
func (ew *eventWorker) writeEvent(e event.IEventStruct) {
if ew.status != ProcessStateInit {
_ = ew.writeToChan("write events failed, unknow eventWorker status")
return
}
ew.payload.Write(e.Payload())
}
The text was updated successfully, but these errors were encountered:
Hey there, @chilli13! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together!
To address the issue of excessive memory usage in eCapture when dealing with large files over a long connection, you can consider implementing a mechanism to limit the size of the payload buffer in the eventWorker. Here are a few potential approaches:
Limit Payload Size: Introduce a maximum payload size for the ew.payload buffer. Before writing to the buffer, check if adding the new payload would exceed this limit. If it does, you can either discard the data, log a warning, or handle it according to your application's needs.
Chunked Processing: Instead of writing the entire payload to the buffer at once, process the data in smaller chunks. This can help manage memory usage by not holding the entire payload in memory simultaneously.
Configuration Option: Add a configuration option to set a maximum buffer size or a maximum number of events that can be processed for a single connection. This allows users to adjust the settings based on their environment and requirements.
Garbage Collection and Buffer Reset: Regularly reset the buffer using ew.payload.Reset() after processing a certain amount of data to free up memory. Ensure that the data is processed or stored elsewhere before resetting.
Implementing one or more of these strategies can help mitigate the memory consumption issue you're experiencing.
Important
@dosu AI robot
Describe the bug
ecapture tls -m text cost memory over 1G when long connection access to large files
To Reproduce
Steps to reproduce the behavior:
some ecapture output,
Length
field is241283072
Linux Server/Android (please complete the following information):
Linux Server x86 vm
openeuler 20.03v0.9.2
Additional context
code
when ew.incoming reach
ew.tickerCount
then always keep ew.writeEvent(e),ew.payload.Write(e.Payload())
makes e.Payload() too long to apply too much memory. In some cases, it may even trigger an OOMIs it possible to add some configuration mechanism to limit the number of times a single uuid work executes ew.writeEvent(e)?
The text was updated successfully, but these errors were encountered: