Repository navigation
[24.05] Fix crashes: API exit code on signal, views period parse, star-rating period type - #8245
Merged
Merged
Conversation
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>
ar2rsawseen
approved these changes
Nov 9, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
api/api.jsstoreBatchedDataexits with1when given a non-numeric code. The signal handlers pass the signal name, andprocess.exit("SIGTERM")throwsERR_INVALID_ARG_TYPEon Node 20+, so the API process kept running after SIGTERM. It also logs why the batch state could not be stored. This is theapi/api.jspart of master commit 26f2da0 (applied by hand: that commit also carries MongoDB 7 install-script changes that do not belong here).87ad23d90dc9605e431058dd239cfd453d67bdbbplugins/views/api/api.jscreateAggregatePipeline, a period that is not a JSON[start, end]array no longer throws fromJSON.parse. It falls back to the start and end thatcountlyCommon.getPeriodObjalready 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,ea9d1ab1b86ba0b17d3e0cfee2387c2ab8deec5dplugins/star-rating/api/api.js/o?method=staranswers400 Bad request parameter: periodwhen the period is not a string (for example a number in a JSON body), instead of a TypeError fromindexOfthat left the request without a response.84582c4811bc5ce668ca6305002e8aa40d68c779The 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
process.exit("SIGTERM")throwsERR_INVALID_ARG_TYPE.test-api-pluginsjob:plugins/views/tests.js:getTablewith a period of two comma-separated millisecond timestamps (no brackets) answers 200 with exactly theperiod=30daystable, and the 30days table is not empty at that point.plugins/star-rating/tests.js:POST /owith{"method": "star", "period": 30}answers 400{"result": "Bad request parameter: period"}.eslint(eslint 8 with the repository's.eslintrcandbin/eslint-rules) andnode --checkpass on every changed file.api/api.jssignal 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