简体   繁体   English

系统将日志 fd 刷新写入 mq socket fd

[英]the log fd was flush to write to mq socket fd by system

I use python uwsgi to make my code.我使用 python uwsgi 来制作我的代码。 there is a error occur sometime when i send message to rabbbitmq and didn't use confirm mode.当我向 rabbbitmq 发送消息并且没有使用确认模式时,有时会发生错误。 the error like this:错误是这样的:

rabbmitmq server log error =ERROR REPORT==== 21-Jul-2022::15:23:04 === Error on AMQP connection <0.23590.991> (172.198.12.10:59211 -> 10.0.12.1:5672, vhost: 'host', user: 'host', state: running), channel 12848: operation none caused a connection exception frame_error: "type 91, all octets = <<>>: {frame_too_large,842149168,131064}" rabbmitmq 服务器日志错误 =ERROR REPORT==== 21-Jul-2022::15:23:04 === AMQP 连接错误 <0.23590.991> (172.198.12.10:59211 -> 10.0.12.1:5672, vhost : 'host', user: 'host', state: running), channel 12848: operation none caused a connection exception frame_error: "type 91, all octets = <<>>: {frame_too_large,842149168,131064}"

in other way, i find my python create log file fd also put some error logs:换句话说,我发现我的 python 创建日志文件 fd 也放了一些错误日志:

python log error IOError: [Errno 9] Bad file descriptor Traceback (most recent call last): File "/usr/lib64/python2.6/logging/ init .py", line 800, in emit self.flush() File "/usr/lib64/python2.6/logging/ init .py", line 762, in flush self.stream.flush() python 日志错误 IOError: [Errno 9] Bad file descriptor Traceback (most recent call last): File "/usr/lib64/python2.6/logging/ init .py", line 800, in emit self.flush() File " /usr/lib64/python2.6/logging/init .py”,第 762 行,在 flush self.stream.flush () 中

this is create python log file code:这是创建 python 日志文件代码:

   def init_logger(self):
    self._logger = logging.getLogger(self._proj)
    self._logger.setLevel(logging.DEBUG)
    formatter = logging.Formatter('[%(asctime)s] [%(process)d] [%(levelname)s] %(message)s')
    if not self._b_stream_init:
        stream_handler = logging.StreamHandler(sys.stderr)
        stream_handler.setFormatter(formatter)
        stream_handler.setLevel(logging.DEBUG)
        self._logger.addHandler(stream_handler)
        self._b_stream_init = True
    ret = self.check_log_name()
    if ret[0]:
        return 0
    try:
        log_file_handler = logging.FileHandler(ret[1])
        log_file_handler.setFormatter(formatter)
        log_file_handler.setLevel(CLog.LEVEL_MAP[self._log_level])
        self._logger.addHandler(log_file_handler)
        if self._last_file_handle is not None:
            self._logger.removeHandler(self._last_file_handle)
            self._last_file_handle.close()
        self._last_file_handle = log_file_handler
        self._last_log_name = ret[1]
    except:
        pass
def check_log_name(self):
    if self._log_dir is None or self._log_prefix is None:
        return True, None
    log_name_arr = [self._log_dir, self._log_prefix, '_', time.strftime('%Y%m%d_%H'), '.log']
    log_name = ''.join(log_name_arr)
    if self._last_log_name != log_name or not os.path.exists(log_name):
        return False, log_name
    else:
        return True, log_name

this code raise exception but i can't find out the reason why.此代码引发异常,但我找不到原因。

this code i use client send message to rabbitmq server:
@trace_report(switch=True)
def send(self, key, message, declare=False, expiration=None):

    if declare:
        self._declare_exchange()
        self._declare_queue_with_key(key)
    if isinstance(expiration, int):
        expiration = str(expiration)
    properties = pika.BasicProperties(delivery_mode=2,
                                      expiration=expiration)
    self.channel.basic_publish(exchange=self.exchange, routing_key=key,
                               body=message, properties=properties)

I guess that the file system write log content to the rabbitmq server socket fd by mistake.猜测是文件系统误将日志内容写入rabbitmq服务器socket fd。 what i can do in this situation.在这种情况下我能做什么。

ps: socket_wait was so much(4w) but without no any kernel log ps:socket_wait 太多(4w)但没有任何 kernel 日志

{frame_too_large,842149168,131064}

means that you sent a message larger than what the RabbitMQ server is configured for.意味着您发送的消息大于 RabbitMQ 服务器的配置。

You can try increasing the max-frame configuration of the server but it can impact performance of it as well.您可以尝试增加服务器的最大帧配置,但这也会影响它的性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM