Skip to content

Fix --daemon flag being silently dropped in webless mode - #480

Open
gkr0110 wants to merge 2 commits into
galaxyproject:masterfrom
gkr0110:fix-webless-daemon-flag
Open

Fix --daemon flag being silently dropped in webless mode#480
gkr0110 wants to merge 2 commits into
galaxyproject:masterfrom
gkr0110:fix-webless-daemon-flag

Conversation

@gkr0110

@gkr0110 gkr0110 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

scripts/pulsar forwards "$@" to the underlying command for every launch mode (gunicorn, uwsgi, chaussette, circusd, paster) except webless, where the arguments are dropped entirely. As a result, pulsar --mode webless --daemon silently starts pulsar-main in the foreground, attached to the caller's shell, instead of daemonizing it. No error is raised, so this is easy to miss — the process looks like it started fine until the terminal session closes and it dies with it.

This came up while standing up a webless/AMQP-driven Pulsar deployment talking to a RabbitMQ broker: the AMQP consumers bound and started heartbeating correctly, but the process wasn't actually backgrounded despite --daemon being passed.

Root cause

elif [ "$MODE" == "webless" ]; then
    if hash pulsar-main 2>/dev/null; then
        echo "Starting pulsar with command [pulsar-main]"
        pulsar-main          # <-- "$@" never referenced
    else
        ...
        python pulsar/main.py    # <-- same here
    fi

Compare to every other branch, e.g. gunicorn mode:

elif [ "$MODE" == "gunicorn" ]; then
    echo "Starting pulsar with command [pulsar-serve \"$PULSAR_CONFIG_FILE\" \"$@\"]"
    pulsar-serve "$PULSAR_CONFIG_FILE" "$@"

Simply adding "$@" to the webless branch isn't quite enough on its own, though, because pulsar-main doesn't share pulsar-serve's flag names:

  pulsar-serve (gunicorn) pulsar-main (webless)
Daemonize --daemon -d / --daemonize
Stop a running daemon --stop-daemon (not implemented)

Testing

Manually tested against a live webless deployment connecting to RabbitMQ over AMQPS (password auth, TLS via amqp_connect_ssl_ca_certs):

  • pulsar --mode webless --daemon now correctly forks into the background and writes to the expected log file, instead of staying attached to the invoking shell.
  • bash -n scripts/pulsar passes.
  • Confirmed via ps/process inspection that the daemonized process survives the originating SSH session closing.

Related

None found — searched existing issues/PRs for webless + daemon without a match before opening this.

scripts/pulsar forwards "$@" to the underlying command for every mode
(gunicorn, uwsgi, etc.) except webless, where it was ignored entirely.
This meant 'pulsar --mode webless --daemon' silently ran pulsar-main in
the foreground instead of daemonizing - no error, just the wrong
behavior, discovered while debugging a webless AMQP deployment.

pulsar-main also doesn't share pulsar-serve's flag names (-d/--daemonize
instead of --daemon, and no --stop-daemon support at all), so this
translates/validates args before forwarding rather than passing them
through unchanged.
@gkr0110

gkr0110 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@jmchilton - Could you please review this PR?

Comment thread scripts/pulsar Outdated
Removed deprecated comments regarding webless mode argument handling.
@gkr0110

gkr0110 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@mvdbeek - removed the comments as you suggested, could you please review and merge if it's good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants