Docker_manager returns null for progress despite there being progress

AI-generated summary

In a bug report titled ‘Docker_manager returns null for progress despite there being progress,’ yanokwa reports that while upgrading Discourse via the API endpoint GET /admin/docker/progress, the logs and percentage fields return null midway through the upgrade — even though the admin UI continues to display real-time progress. The null values appear to coincide with the stopping of the job queue, which frees memory for the upgrade. justin suggests the UI updates via MessageBus and speculates that API access may be disrupted when Unicorn workers are stopped. yanokwa asks for alternative ways to monitor upgrade progress, noting that production logs don’t contain the status and is open to workarounds like scraping the upgrade page. The issue appears to be a disconnect between UI and API state during a critical upgrade phase.

If during an upgrade I check the progress of said upgrade via the API, I get null progress (logs and percentage) even though the UI shows progress.

The command I’m running is this:

curl -X GET "https://example.com/admin/docker/progress" -H "Content-Type: multipart/form-data;" -d "path=all" -d "api_key=1234" -d "api_username=system"

In the beginning of the upgrade, the output I get looks like this:

{"progress":{"logs":"********************************************************\n*** Please be patient, next steps might take a while ***\n********************************************************\nCycling Unicorn, to free up memory\nRestarting unicorn pid:... 386\n","percentage":"10"}}

In the middle of the upgrade, the output looks like this:

{"progress":{"logs":null,"percentage":null}}

I believe the progress goes to null right when the job queue is stopped. The admin UI still shows lots of progress (the below log is from the UI), but the progress via API remains at null.

Stopping job queue to reclaim memory, master pid is 386
$ cd /var/www/discourse && git fetch --tags && git reset --hard HEAD@{upstream}
From https://github.com/discourse/discourse
 - [tag update]      latest-release -> latest-release
HEAD is now at 6525613 PERF: Use joins for `Post.for_mailing_list` instead of `NOT IN`.
$ cd /var/www/discourse/plugins/discourse-custom-wizard && git fetch --tags && git reset --hard HEAD@{upstream}
HEAD is now at e127d0c Merge pull request #7 from procourse/fix_footer_logo

Any ideas what’s going on?

3 Likes

I know the UI is getting updated through the MessageBus, so I’m wondering if when the Unicorn workers are stopped, the API endpoint you’re looking at doesn’t update or isn’t accessible at that time.

2 Likes

Is there an alternative way of getting progress? I just need to know if the upgrade is still ongoing. The status doesn’t seem to be in /var/www/discourse/log/production.log and I’m open to hackery methods like scraping the upgrade page…