Skip to content

documentdb-setup cannot stop the gateway on non-systemd RHEL: undeclared procps dependency #727

Done

Description

@GuanzhouSong

Summary

On a host without systemd, documentdb-setup starts the gateway with nohup and then cannot reliably stop it again. The failure is silent, and it is architecture-dependent in a way that makes it look like a docs problem: the same command works on Debian/Ubuntu and fails on a minimal RHEL image.

Found while cold-start testing the published install docs against v0.116-0.

Root cause

documentdb-local/scripts/documentdb-setup.sh, in _kill_nohup_gateway_orphans():

for _pid in $(pgrep -f /usr/lib/documentdb-gateway/documentdb-gateway-daemon 2>/dev/null); do

If pgrep is not installed the command substitution yields nothing, the loop body never executes, and the function returns success having stopped nothing. 2>/dev/null swallows the command not found, so there is no diagnostic.

procps is present in ubuntu:24.04, so this works there by luck. It is not in minimal RHEL-compatible images, and neither package declares it:

  • packaging/rpm/spec/documentdb-common.spec — Requires: lists documentdb-gateway, documentdb-postgresql-tools, jq, shadow-utils. No procps-ng.
  • packaging/standalone/build-common-deb.sh:155 — Depends: documentdb-postgresql-tools, documentdb-gateway, jq. No procps.

Reproduction

Same command, both distros, v0.116-0 from the package repository, documentdb-setup run to completion:

Image documentdb-setup --restore Gateway afterwards
ubuntu:24.04 logs Stopping orphan (non-systemd) gateway daemon (pid 7770) port down ✅
rockylinux/rockylinux:9 reports SUCCESS: Restore complete. still serving authenticated traffic ❌

On Rocky, after the documented "stop", mongosh still authenticates and returns {ok: 1}.

Downstream failures

  1. Restart is impossible. Because the gateway is still holding the port, re-running documentdb-setup fails:

    ERROR: Port 10260 is already in use, but the owning process ID could not be
    determined safely (lsof/ss unavailable, or /proc/net could confirm a listener
    but not its owner). Install lsof or iproute2 so the owner can be identified...
    

    Following that advice (dnf install -y iproute lsof) and retrying produces the identical error — ss -lntp in the container shows the listener with no users:(...) column, so the owner is never resolvable.

  2. The error's other suggestion is unavailable. It recommends pkill -f ...documentdb-gateway-daemon, but pkill is part of the same missing procps-ng, so it exits 127.

  3. documentdb-local-reset --confirm-destroy orphans the gateway. It destroys the data directory but leaves a listener on the port answering An unexpected internal error has occurred.

Net effect: on a non-systemd RHEL host there is no working documented way to stop the stack. Recovery required kill <PID> with the PID found by hand from /proc.

Suggested fixes

Minimal — declare the dependency:

  • documentdb-common.spec: add Requires: procps-ng
  • build-common-deb.sh: add procps to Depends:

Better — don't depend on process discovery at all. documentdb-setup starts the daemon, so it can record the PID and reuse it rather than searching the process table and then the port table. That also fixes the "owner could not be determined" path, which is doing expensive discovery for a process the tool launched itself.

Also worth addressing:

  • Don't swallow the error — pgrep ... 2>/dev/null hides a missing dependency behind a success.
  • Don't suggest pkill in an error message when it may not be installed.
  • Have documentdb-local-reset either stop the gateway it manages or refuse until it is stopped.
  • Consider an explicit documentdb-setup --stop; the non-systemd path currently has no stop verb, which is why the docs had to describe --restore as one.

Docs status

The published docs claimed --restore stops the gateway. That has been corrected to note the procps-ng prerequisite (documentdb/documentdb.github.io#160), but that is a workaround for this bug, not a fix.

Activity

  1. documentdb-triage-tool commented on Aug 25, 2026

    @documentdb-triage-tool

    🤖 Auto-triaged by documentdb-triage-tool.

    Applied: packaging, bug
    Project fields suggested: Component packaging · Priority P2 · Effort M · Status Triage
    Confidence: 0.88 (llm)

    Reasoning

    LLM: Missing procps/procps-ng dependency declaration in both RPM spec and Debian build script causes silent gateway stop failure on minimal RHEL images, with cascading restart failures; fix touches packaging metadata and the setup shell script.

    If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

  2. added this to the 1.0-RC2 milestone on Oct 5, 2026
  3. added
    1.0-blocker
    on Oct 6, 2026
  4. guanzhousongmicrosoft commented on Oct 6, 2026

    @guanzhousongmicrosoft
    Member

    1.0 blocker. The fix (declare procps, fail loudly when pgrep is missing) is in review.

  5. documentdb-triage-tool commented on Oct 28, 2026

    @documentdb-triage-tool

    👋 @guanzhousongmicrosoft — this issue has been assigned for 22 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  6. documentdb-triage-tool commented on Nov 11, 2026

    @documentdb-triage-tool

    👋 @guanzhousongmicrosoft — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  7. guanzhousongmicrosoft commented on Nov 23, 2026

    @guanzhousongmicrosoft
    Member

    Fixed on main (1e882d8): the packages now depend on procps/procps-ng, documentdb-setup --restore fails loudly when pgrep is missing, and setup records the non-systemd gateway's PID so restore and reset stop it. Closing; a separate --stop verb can be its own issue.

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

Metadata

Metadata

Labels

1.0-blockerbugdocumentdb-1.0packaging

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions