Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: EBADF: Closing file descriptor on garbage collection failed #363

Closed
davidbasalla opened this issue Nov 4, 2021 · 6 comments · Fixed by adamgruber/mochawesome-report-generator#181

Comments

@davidbasalla
Copy link

davidbasalla commented Nov 4, 2021

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.

@byg0n3
Copy link

byg0n3 commented Nov 4, 2021

Experiencing the same issue on amplify and locally:

    "mocha": "^9.1.3",
    "mochawesome": "^7.0.0",
    "mochawesome-merge": "^4.2.0",
    "mochawesome-report-generator": "^6.0.0",

@adamgruber
Copy link
Owner

I'll need an example or instructions to reproduce the issue. Also please indicate the version of Node.

@Keysox
Copy link

Keysox commented Nov 4, 2021

We're also seeing the same issue with Node v16.7.0

@adamgruber
Copy link
Owner

adamgruber commented Nov 4, 2021

When overwrite is set to false, fsu.writeFileUnique is called to output unique files instead of fs.outputFile (which comes from fs-extra). The fsu dependency was updated in mochawesome v7 which makes me think that could be where the root issue lies. The fsu package was changed in v2 to support async/await. The previous version of mochawesome would wrap the (non-async) fsu.writeFileUnique call in a Promise.

I can confirm this issue is not present when simply using mocha by itself but it does exist when using Cypress. I do not know enough about the inner workings of Cypress to determine the root problem.

@tit
Copy link

tit commented 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

@adamgruber
Copy link
Owner

Fix has been released in mochawesome v7.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants