Supervisor: 主管 3.3.1:CRIT 未捕获的 python 异常,关闭通道

创建于 2017-05-17  ·  4评论  ·  资料来源: Supervisor/supervisor

我们仍然遇到这样的问题,即主管在将日志定向到 /dev/stdout 时生成的每条日志消息上都记录了一个未捕获的 CRIT,类似于以下内容:

2017-05-17 12:20:27,860 CRIT uncaptured python exception, closing channel <POutputDispatcher at 140178721855392 for <Subprocess at 140178721855248 with name cause-error in state STARTING> (stdout)> (<type 'exceptions.IOError'>:[Errno 29] Illegal seek [/usr/local/lib/python2.7/dist-packages/supervisor/supervisord.py|runforever|227] [/usr/local/lib/python2.7/dist-packages/supervisor/dispatchers.py|handle_read_event|232] [/usr/local/lib/python2.7/dist-packages/supervisor/dispatchers.py|record_output|166] [/usr/local/lib/python2.7/dist-packages/supervisor/dispatchers.py|_log|142] [/usr/local/lib/python2.7/dist-packages/supervisor/loggers.py|info|275] [/usr/local/lib/python2.7/dist-packages/supervisor/loggers.py|log|293] [/usr/local/lib/python2.7/dist-packages/supervisor/loggers.py|emit|186] [/usr/local/lib/python2.7/dist-packages/supervisor/loggers.py|doRollover|211])

这看起来类似于 #638,但在 3.3.1 中仍然存在,并且具有不同的堆栈跟踪。

我创建了一个最小的 Dockerfile,可以重现地导致我这边的问题: https ://gist.github.com/madmuffin1/33408001a402c2fd98bc0b227185b363

如果您需要更多详细信息,请告诉我,我很乐意提供帮助。

logging

最有用的评论

非常感谢@mnaberez!

如果有人像我一样偶然发现此错误,请注意上述选项适用于[supervisord]部分,在[program:x]部分中,您需要使用stdout_logfile_maxbytes = 0和/或stderr_logfile_maxbytes = 0分别。

所有4条评论

通过进一步研究文档,我发现有redirect_stdoutredirect_stderr ,它们按预期工作。 因此,应该通过生成更有用的错误消息来防止这个问题。

上面的日志消息显示在日志轮换期间发生了非法查找错误。

你的配置文件是这样的:

运行 apt-get update && apt-get install -y -q locales python-pip && pip install supervisor && \
echo "[supervisord]nnodaemon=truenn[program:cause-error]ncommand=/bin/bash -c 'echo Test'nstdout_logfile=/dev/stdout" > /etc/supervisord.conf

该配置使用日志轮换(默认情况下启用),但您指定了一个不可搜索的日志文件:

stdout_logfile=/dev/stdout

如果您真的想使用标准输出,它可能会起作用,但您至少需要禁用日志轮换(设置stdout_maxbytes=0配置)。

通过进一步研究文档,我发现有redirect_stdout和redirect_stderr,它们按预期工作。

没有redirect_stdout选项, redirect_stderr不会影响这一点。 redirect_stderr选项将导致supervisordstderr记录到与stdout相同的文件中。 如果您不将日志文件更改为可查找文件或禁用轮换,您仍然会看到错误。

非常感谢@mnaberez!

如果有人像我一样偶然发现此错误,请注意上述选项适用于[supervisord]部分,在[program:x]部分中,您需要使用stdout_logfile_maxbytes = 0和/或stderr_logfile_maxbytes = 0分别。

我做了这样的事情:

stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_maxbytes=0
stderr_maxbytes=0
stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0

此页面是否有帮助?
0 / 5 - 0 等级