Skip to content

Unhandled JSON parse error #95

Description

@k1o0

The CI froze due to an unhandled rejection. My hypothesis is that a previous test took too long but the CI failed to kill the subprocess. The CI then tried reading the JSON file as the previous test's subprocess was writing to it.

2023-06-15T12:03:56.660Z ci:lib Loading test records from /home/experiment/.ci/.db.json for id 7293f56
Unhandled Rejection at: Promise Promise {
  <rejected> SyntaxError: Unexpected end of JSON input
      at JSON.parse (<anonymous>)
      at loadTestRecords (/home/experiment/Documents/github/matlab-ci/lib.js:111:20)
      at updateJobFromRecord (/home/experiment/Documents/github/matlab-ci/lib.js:167:15)
      at shortCircuit (/home/experiment/Documents/github/matlab-ci/lib.js:251:19)
      at Immediate.<anonymous> (/home/experiment/Documents/github/matlab-ci/main.js:17:26)
      at processImmediate (internal/timers.js:463:21)
} reason: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at loadTestRecords (/home/experiment/Documents/github/matlab-ci/lib.js:111:20)
    at updateJobFromRecord (/home/experiment/Documents/github/matlab-ci/lib.js:167:15)
    at shortCircuit (/home/experiment/Documents/github/matlab-ci/lib.js:251:19)
    at Immediate.<anonymous> (/home/experiment/Documents/github/matlab-ci/main.js:17:26)
    at processImmediate (internal/timers.js:463:21)
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at loadTestRecords (/home/experiment/Documents/github/matlab-ci/lib.js:111:20)
    at updateJobFromRecord (/home/experiment/Documents/github/matlab-ci/lib.js:167:15)
    at shortCircuit (/home/experiment/Documents/github/matlab-ci/lib.js:251:19)
    at Immediate.<anonymous> (/home/experiment/Documents/github/matlab-ci/main.js:17:26)
    at processImmediate (internal/timers.js:463:21)

First priority is to handle this exception, but it could also try reading the file twice just in case.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions