Luna
Luna

Reputation: 305

Error message "Crit uncaptured python exception" while running supervisord on docker

I'm trying out supervisord on a docker container to try to control two processes inside a container. For now, process1 types every 10 seconds "I am process 1" and process 2 types "I am process 2". They are both really simple bash scripts.

In docker logs I encounter this error:

2022-04-04T15:40:56.770705073Z I am process 1
2022-04-04T15:40:56.770775532Z 2022-04-04 15:40:56,770 CRIT uncaptured python exception, closing channel <POutputDispatcher at 140473979288352 for <Subprocess at 140473979288304 with name PROGRAM1 in state RUNNING> (stdout)> (<class 'OSError'>:[Errno 29] Illegal seek [/usr/lib/python3/dist-packages/supervisor/supervisord.py|runforever|218] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|handle_read_event|281] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|record_output|215] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|_log|184] [/usr/lib/python3/dist-packages/supervisor/loggers.py|info|327] [/usr/lib/python3/dist-packages/supervisor/loggers.py|log|345] [/usr/lib/python3/dist-packages/supervisor/loggers.py|emit|227] [/usr/lib/python3/dist-packages/supervisor/loggers.py|doRollover|264])
2022-04-04T15:41:06.761850899Z I am process 2
2022-04-04T15:41:06.761913329Z 2022-04-04 15:41:06,761 CRIT uncaptured python exception, closing channel <POutputDispatcher at 140473979378128 for <Subprocess at 140473979378224 with name PROGRAM2 in state RUNNING> (stdout)> (<class 'OSError'>:[Errno 29] Illegal seek [/usr/lib/python3/dist-packages/supervisor/supervisord.py|runforever|218] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|handle_read_event|281] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|record_output|215] [/usr/lib/python3/dist-packages/supervisor/dispatchers.py|_log|184] [/usr/lib/python3/dist-packages/supervisor/loggers.py|info|327] [/usr/lib/python3/dist-packages/supervisor/loggers.py|log|345] [/usr/lib/python3/dist-packages/supervisor/loggers.py|emit|227] [/usr/lib/python3/dist-packages/supervisor/loggers.py|doRollover|264])

My Dockerfile looks like this:

FROM debian:bullseye
WORKDIR /app
COPY . /app
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN apt-get update && apt-get install -y  supervisor && apt-get install -y procps
#RUN apt-get install -y python3-pip && pip install supervisor-stdout
CMD ["/usr/bin/supervisord"]

And my supervisord.conf looks like this:

[supervisord]
nodaemon=true

[program:program1]
command=/bin/bash /app/process1.sh &
process_name=PROGRAM1
autostart=true
autorestart=true
priority=0
redirect_stderr=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr

[program:program2]
command=/bin/bash /app/process2.sh &
process_name=PROGRAM2
autostart=true
autorestart=true
priority=0
redirect_stderr=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr

What is happening here? Is there a problem with my configuration?

Thanks!

Upvotes: 2

Views: 2143

Answers (1)

Luna
Luna

Reputation: 305

I found out what was going on. You need to specify that the max size of the log file is 0, because supervisor can't write a file on /dev/stdout.

On each program:

stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0

Inspiration: https://github.com/Supervisor/supervisor/issues/1412

Upvotes: 8

Related Questions