question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: EBADF: Closing file descriptor on garbage collection failed

See original GitHub issue

Describe the bug

When using the “Spec to STDOUT, produce a combined Mochawesome JSON file” config from the Cypress docs, we are seeing the test runs fail after an arbitrary number of tests (we have 30 tests in 7 files in total).

  Running:  examples/login_page.js                                                          (3 of 7)

[Error: EBADF: Closing file descriptor 110 on garbage collection failed, close
] {
  errno: -9,
  code: 'EBADF',
  syscall: 'close'
}
Error: EBADF: Closing file descriptor 110 on garbage collection failed, close
[42:1104/125012.598646:FATAL:scoped_file.cc(43)] Check failed: . : Bad file descriptor (9)
The Test Runner unexpectedly exited via a exit event with signal SIGTRAP

Code Reproduce

We’re invoking our test runs with:

docker-compose exec cypress bash -c "yarn && cypress run --reporter mochawesome --reporter-options reportDir="cypress/results",overwrite=false,html=false,json=true "

I haven’t had time to try to recreate this in a toy example yet. Will update here if I do.

Expected behavior

All tests should run until the end, and should emit one log file per file

Screenshots N/A

Environment (please complete the following information):

  • Platform: docker MacOS (cypress/included:6.8.0)
  • mochawesome version: 7.0.0
  • mochawesome-merge version: “^4.2.0”
  • mocha (or other test library) version: Cypress 6.8.0
  • Node version:

Additional context

We recently upgraded from "mochawesome": "6.2.2" to "mochawesome": "^7.0.0" and did not have this problem before.

From playing around with it, the problem seems to be caused by overwrite=false. I’ve tried replacing with timestamp=true and everything worked as expected.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
adamgrubercommented, Nov 5, 2021

Fix has been released in mochawesome v7.0.1

2reactions
titcommented, Nov 4, 2021

I’ll need an example or instructions to reproduce the issue

@adamgruber, I have created a reproducible example in https://github.com/tit/mochawesome-issue-363

[80459:1105/003438.711329:FATAL:scoped_file.cc(43)] Check failed: . : Bad file descriptor (9)
The Test Runner unexpectedly exited via a exit event with signal SIGTRAP

Versions

$ node --version                              
v16.11.1
$ cypress --version                               
Cypress package version: 8.7.0
Cypress binary version: 8.7.0
Electron version: 14.1.0
Bundled Node version: 14.17.0
$ npm --version                               
8.0.0
$ npm list mochawesome
cypress-playground@ /Users/sergeyblohin/incountry/cypress-playground
└── mochawesome@7.0.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js - Properly closing fd with multiple streams
[Window Title] Error [Content] Uncaught Exception: Error: EBADF: Closing file descriptor 5 on garbage collection failed, close.
Read more >
sock.close() raises OSError EBADF when socket's fd is closed
Another problem is if you don't end up calling socket.close(), the garbage collector may arbitrarily close an FD in use in the future....
Read more >
Frontity dev command error: Closing file descriptor 25 - Get Help
In the future, an error will be thrown if a file descriptor is closed during garbage collection.
Read more >
Java Bad File Descriptor Close Bug - 256
We have been fighting for a number of weeks with a bad file descriptor bug on a search ... aside from NFS which...
Read more >
System.Socket - Hackage
EBADF: Not a valid file descriptor (only after socket has been closed). ... closes the socket when the garbage collection decides to collect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found