bhovhannes / junit-report-merger

Merges multiple JUnit XML reports into one
MIT License
42 stars 13 forks source link

Passing a quantity of files greater than the file soft limit causes jrm to fail #342

Open michael-dresser-skydio opened 1 month ago

michael-dresser-skydio commented 1 month ago

Invoking jrm with a glob with many files, e.g. jrm ./build/bazel-out/combined-junit.xml "build/bazel-out/*/testlogs/**/test.xml", fails with an error like this:

node:events:492
      throw er; // Unhandled 'error' event
      ^
Error: EMFILE: too many open files, open './build/bazel-out/combined-junit.xml'
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'open',
  path: './build/bazel-out/combined-junit.xml'
}
Node.js v20.9.0
🚨 Error: The command exited with status 1

ulimit -n reports 1024, so I suspect this is occurring because we have > 1024 files returned by the test.xml glob and jrm is not limiting its use of file descriptors in this situation.

bhovhannes commented 1 month ago

Thank you for reporting. I agree, currently jrm opens all input files at once. That can be the cause.