mikepenz / action-junit-report

Reports junit test results as GitHub Pull Request Check
https://blog.mikepenz.dev
Apache License 2.0
298 stars 114 forks source link

Nullpointer in Node.js #1109

Closed guntermartens closed 2 months ago

guntermartens commented 2 months ago

We are seeing a weird issue when publishing test results:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal
  ----- Native stack trace -----

   1: 0xb82b0c node::OnFatalError(char const*, char const*) [/opt/github-runner/externals/node20/bin/node]
   2: 0xeee6b0 v8::api_internal::ToLocalEmpty() [/opt/github-runner/externals/node20/bin/node]
   3: 0xcc2144  [/opt/github-runner/externals/node20/bin/node]
   4: 0xf5596f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/opt/github-runner/externals/node20/bin/node]
   5: 0xf561dd  [/opt/github-runner/externals/node20/bin/node]
   6: 0xf566a5 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/opt/github-runner/externals/node20/bin/node]
   7: 0x1960df6  [/opt/github-runner/externals/node20/bin/node]

  ----- JavaScript stack trace -----

  1: readFileSync (node:fs:448:20)
  2: parseFile (/opt/github-runner/_work/_actions/mikepenz/action-junit-report/v4.2.2/dist/index.js:467:21)
  3: parseTestReports (/opt/github-runner/_work/_actions/mikepenz/action-junit-report/v4.2.2/dist/index.js:675:69)

This error appears with both v4 and v4.2.2 after processing roughly half of the test results (2160 lines vs. 4430 lines for the full report). It's only in one of our branches and but there it's reproducible reliably.

mikepenz commented 2 months ago

Based on the stack trace this is thrown here: https://github.com/mikepenz/action-junit-report/blob/ac30be7acb0a361e5492575ab42e47fcadec4928/src/testParser.ts#L155

As it happens within node, I am not sure there's a lot we can do to prevent this. as the node version installed on the system is outside of the actions control

guntermartens commented 2 months ago

Hi Mike, thanks a lot for your quick response. Already thought that it might be out of your control but wanted to confirm with you. Would it be possible to run this action on a newer node version?

mikepenz commented 2 months ago

While it should practically be possible to compile with a newer node version I doubt that this makes a difference as the node runtime itself being dependent on the runner.

From action developer perspective we only define this: https://github.com/mikepenz/action-junit-report/blob/main/action.yml#L121 to set which runtime to pick.

As far as I am aware node20 is the latest runtime GitHub actions supports at this time

guntermartens commented 2 months ago

Yes, my idea was to set up a newer node version on the runner and see if that makes a difference. Was just doubting if your action would pick this up correctly and (potentially) work with it.

mikepenz commented 2 months ago

I have not tried, but I don't see a reason why it wouldn't as unless some of the github dependency stack or so uses a now removed node functionality. which I doubt.

guntermartens commented 2 months ago

Hi Mike, in the end we changed the test set (readded the previously deleted test) and with that the error disappeared magically. We have still no clue about the root cause. If you consider this issue out of control of your action, I think it can be closed as long as we have no more insights. Thanks a lot for your quick replies.

mikepenz commented 2 months ago

Thanks for your response. Closing as I also don't think there's a lot we can do. unless we identify how to safely reproduce it, in which case we could maybe catch the problem and give a proper warning