Skip to content

[24.05] Fix crashes: API exit code on signal, views period parse, star-rating period type - #8245

Merged
Cookiezaurs merged 3 commits into
release.24.05from
fix/crash-reports-24.05-server
Nov 9, 2026
Merged

Cookiezaurs merged 3 commits into
release.24.05from
fix/crash-reports-24.05-server

Conversation

@Cookiezaurs

@Cookiezaurs Cookiezaurs commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Crash fixes for the 24.05 line, from the crash reports of running servers. Each fix is local: it removes the crash and changes nothing else.

File What happens now instead of the crash Crash groups
api/api.js storeBatchedData exits with 1 when given a non-numeric code. The signal handlers pass the signal name, and process.exit("SIGTERM") throws ERR_INVALID_ARG_TYPE on Node 20+, so the API process kept running after SIGTERM. It also logs why the batch state could not be stored. This is the api/api.js part of master commit 26f2da0 (applied by hand: that commit also carries MongoDB 7 install-script changes that do not belong here). 87ad23d90dc9605e431058dd239cfd453d67bdbb
plugins/views/api/api.js In createAggregatePipeline, a period that is not a JSON [start, end] array no longer throws from JSON.parse. It falls back to the start and end that countlyCommon.getPeriodObj already resolved the period to (30days for an unparsable value), so the table is built for the same range as the rest of the response. 9d2b14e79b7d9081634c5e31f7480ad1f055bdea, ea9d1ab1b86ba0b17d3e0cfee2387c2ab8deec5d
plugins/star-rating/api/api.js /o?method=star answers 400 Bad request parameter: period when the period is not a string (for example a number in a JSON body), instead of a TypeError from indexOf that left the request without a response. 84582c4811bc5ce668ca6305002e8aa40d68c779

The same views and star-rating bugs are being fixed on master in fix/crash-reports-25.03-server. That branch had no commits for them when this PR was opened, so check that the two lines answer the same way once it does.

Dropped items

None.

How it was checked

  • Confirmed on Node that process.exit("SIGTERM") throws ERR_INVALID_ARG_TYPE.
  • New tests, run by the test-api-plugins job:
    • plugins/views/tests.js: getTable with a period of two comma-separated millisecond timestamps (no brackets) answers 200 with exactly the period=30days table, and the 30days table is not empty at that point.
    • plugins/star-rating/tests.js: POST /o with {"method": "star", "period": 30} answers 400 {"result": "Bad request parameter: period"}.
  • I did not run these tests locally. CI on this PR is their first run.
  • eslint (eslint 8 with the repository's .eslintrc and bin/eslint-rules) and node --check pass on every changed file.
  • The api/api.js signal path has no automated test. To check it by hand, start the API, send it SIGTERM, and confirm the process exits after "Successfully stored batch state" instead of logging an unhandled rejection and staying up.

🤖 Generated with Claude Code

Cookiezaurs and others added 3 commits November 9, 2026 11:27
The signal handlers pass the signal name to storeBatchedData, which then
called process.exit() with that string. Node rejects a non-numeric exit
code, so the process kept running after SIGTERM. It now exits with 1 for a
non-numeric code, and logs why the batch state could not be stored.

Equivalent of the api/api.js part of master commit 26f2da0.

Crash group: 87ad23d90dc9605e431058dd239cfd453d67bdbb

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a JSON array

createAggregatePipeline parsed any period that matched none of the named
periods with JSON.parse and no guard, so a period that is not a JSON
[start, end] array threw and the request got no response. It now uses
the start and end that countlyCommon.getPeriodObj already resolved the
period to (30days for an unparsable value), so the table matches the
rest of the response. Adds a views test that such a period answers with
the 30days table.

Crash groups: 9d2b14e79b7d9081634c5e31f7480ad1f055bdea,
ea9d1ab1b86ba0b17d3e0cfee2387c2ab8deec5d

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The /o?method=star handler called indexOf on the period after only a
truthiness check. A period sent as a number in a JSON body threw a
TypeError and the request got no response. It now answers 400 "Bad
request parameter: period", the same answer the handler gives for an
unknown period. Adds a test for a numeric period.

Crash group: 84582c4811bc5ce668ca6305002e8aa40d68c779

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Cookiezaurs
Cookiezaurs merged commit 4446ab6 into release.24.05 Nov 9, 2026
6 of 7 checks passed
@Cookiezaurs
Cookiezaurs deleted the fix/crash-reports-24.05-server branch November 10, 2026 11:59
ar2rsawseen added a commit that referenced this pull request Nov 26, 2026
Same fixes as master's #8246, for crashes 24.05 servers have the same code for:
- events: a segment list stored as something other than an array
- ping and server-stats jobs log errors and finish once
- job manager: a failure computing the next run, clearing a job
- dashboards: retry while the job class is not loaded yet
- plugin dispatch: log failing handlers nobody waits for
- push: missing app user, closed connection pools, missing push config,
  legacy FCM credentials
- reports and star-rating reports answer once
- system-utility: missing sub-path
- views: an unparseable period answers 400

Conflicts kept 24.05's versions where it already had a fix (#8245 views
period fallback, star-rating period check, request docs); the push
connector keeps 24.05's id handling with master's guard.

(cherry picked from commit 4a0868e)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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