kizy008 commented on issue #7839:
URL: https://github.com/apache/apisix/issues/7839#issuecomment-1235024713

   > > no error log, just the behavior.
   > 
   > We must at least know the logs, without which we cannot imagine what the 
errors are like.
   
   file-logger run with no error. Just output two diffrent log message in one 
line. Message has been output to file but in wrong format. Here is the log file 
content example:
   
![image](https://user-images.githubusercontent.com/12572997/188045238-e50c00ff-38f8-4310-917e-cbfa57a96e90.png)
   
   Maybe two diffrent worker flush each log message to file at the same time,  
and log message size is larger then log cache buffer.
   Perhaps it happens like this: message A's size is larger than the cache 
size, so part of message flush to file, then message B in another worker begin 
to flush. After that message A continue flush its remained message.
   So I think we need concurrency control when file-logger flush to file.
   
   这里file-logger并没有执行报错, 正式将两个不通的日志混合在一行输出了,造成日志格式错误。相面是我得到的日志截图(对敏感数据进行了处理)。
   我猜测发生过程是这样的: 
一个工作进程将日志A的消息内容超过了用来缓存消息的buffer,当A开始向文件flush时,首先将前半部分内容flush到文件中。此时另一个工作进程开始将日志B向文件flush。最后将日志A的剩余消息写入到文件中。
   因此,我们认为在file-logger在向文件写数据的时候需要并发控制逻辑。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to