Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions deploy/docker/fs/etc/supervisor/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ username=%(ENV_APPSMITH_SUPERVISOR_USER)s
password=%(ENV_APPSMITH_SUPERVISOR_PASSWORD)s

[supervisord]
logfile=%(ENV_APPSMITH_LOG_DIR)s/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile=%(ENV_APPSMITH_LOG_DIR)s/supervisor/%(ENV_HOSTNAME)s-stdout.log ; (main log file;default $CWD/supervisord.log)
pidfile=%(ENV_TMP)s/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=%(ENV_APPSMITH_LOG_DIR)s/supervisor ; ('AUTO' child log dir, default $TEMP)
stdout_logfile_maxbytes = 0
Expand All @@ -35,13 +35,12 @@ serverurl=unix://%(ENV_TMP)s/supervisor.sock ; use a unix:// URL for a unix soc
files = %(ENV_SUPERVISORD_CONF_TARGET)s/*.conf

[eventlistener:stdout]
# This eventlistener sends logs to the python handler in /usr/lib/python3/dist-packages/supervisor/appsmith_supervisor_stdout.py created in this repo
# It sends logs for individual processes to stdout/stderr of the main process, which lets logging pipelines to capture logs from each process.
# Supervisor then wants to send these messages to a logfile by default, so directing them to /dev/null prevents double logging.
command = python3 -m supervisor.appsmith_supervisor_stdout
buffer_size = 10000
events = PROCESS_LOG
result_handler = supervisor.appsmith_supervisor_stdout:event_handler
stdout_logfile=%(ENV_APPSMITH_LOG_DIR)s/supervisor/access-supervisor-%(ENV_HOSTNAME)s.log
stderr_logfile=%(ENV_APPSMITH_LOG_DIR)s/supervisor/error-supervisor-%(ENV_HOSTNAME)s.log
stdout_logfile_maxbytes=10MB
stderr_logfile_maxbytes=10MB
stdout_logfile_backups=10
stderr_logfile_backups=10
stdout_logfile=/dev/null
stderr_logfile=/dev/null
Comment on lines +45 to +46
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Ensure error handling in the Python handler to prevent log loss.

Routing stdout/stderr to /dev/null prevents double-logging as intended. However, if the Python handler in line 41 fails or crashes, logs would be permanently lost. Ensure the handler has robust error handling and consider adding monitoring/alerting for handler failures.

Run the following script to check for error handling in the Python handler:


🏁 Script executed:

#!/bin/bash
# Description: Check error handling in the appsmith_supervisor_stdout module

# Find and examine the Python handler for error handling patterns
fd -t f 'appsmith_supervisor_stdout.py' --exec cat {} \; | rg -C5 'try:|except:|logging.error|raise'

# Check for any supervisor event handler error logs or monitoring
rg -n 'event_handler|PROCESS_LOG.*error|supervisor.*error' --type=py -g 'deploy/**'

Length of output: 400


🏁 Script executed:

#!/bin/bash
rg -n -C10 'def event_handler' deploy/docker/fs/usr/lib/python3/dist-packages/supervisor/appsmith_supervisor_stdout.py

Length of output: 768


Add error handling to event_handler
Wrap the logic in deploy/docker/fs/usr/lib/python3/dist-packages/supervisor/appsmith_supervisor_stdout.py lines 24–28 in a try/except and emit any exceptions to stderr or a fallback logger to prevent silent failures and lost logs.

🤖 Prompt for AI Agents
deploy/docker/fs/usr/lib/python3/dist-packages/supervisor/appsmith_supervisor_stdout.py
around lines 24–28: the event_handler logic must be wrapped in a try/except to
avoid silent failures; surround the existing body with a broad try block, catch
Exception as e, emit the exception details to stderr (or use a fallback logger
via logging.exception) and ensure the handler returns or continues gracefully so
logs are not lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not completely wrong.. but this is also the case if we were to continue persisting these to disk in the way we were before this proposed change.

Whatever exception is thrown would go to stderr of the container, so it's not really lost. And we don't gain a lot from continuing to write it to disk either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wyattwalter, you're absolutely right—this failure mode was already present before the change, and routing to /dev/null doesn't introduce new risk. Since exceptions from the handler would still appear in the container's stderr, observability is maintained without the double-logging overhead. Thank you for the clarification!

1 change: 0 additions & 1 deletion deploy/docker/fs/opt/appsmith/caddy-reconfigure.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const parts = []

parts.push(`
{
debug
admin 0.0.0.0:2019
persist_config off
acme_ca_root /etc/ssl/certs/ca-certificates.crt
Expand Down