-
-
Notifications
You must be signed in to change notification settings - Fork 736
[Asking for help] Process are blocking when throw error in scenario with Retry enabled #4358
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
Comments
This issue, append in local too but it's not on each run, so it's seems to be random... I don't know how to fix this |
I've worked on a reproductible repo, you can find here https://github.com/Horsty80/codeceptjs-debug Working test
Throwing error in After/Before without try/catch
Lead to error but the CI is not block 4) Error 1 @error1
"before each" hook: Before for "test something 6":
Error: done() called multiple times in hook <Error 1 @error1 "before each" hook: Before for "test something 6"> of file /Users/cyril/Workspace/codeceptjs-debug/tests/error-1_test.ts
at /Users/cyril/Workspace/codeceptjs-debug/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/scenario.js:156:55
at runNextTicks (node:internal/process/task_queues:60:5)
at processTimers (node:internal/timers:511:9)
5) Error 1 @error1
"before each" hook: Before for "test something 5":
Uncaught Async error
at Timeout._onTimeout (tests/error-1_test.ts:7:11)
at listOnTimeout (node:internal/timers:573:17)
at processTimers (node:internal/timers:514:7) Throwing error in some random Scenario without try/catch
Lead to mentioned error ✖ "after all" hook: codeceptjs.afterSuite in "Error 2 @error2" in 0ms -- FAILURES:
1) Error 2 @error2
"before each" hook: Before for "test something 5":
Uncaught Async error
at Timeout._onTimeout (tests/error-2_test.ts:16:11)
at listOnTimeout (node:internal/timers:573:17)
at processTimers (node:internal/timers:514:7)
Scenario Steps:
- I.amOnPage("https://www.google.com") at Context.<anonymous> (./tests/error-2_test.ts:4:5)
Scenario Steps:
- I.amOnPage("https://www.google.com") at Context.<anonymous> (./tests/error-2_test.ts:4:5)
2) Error 2 @error2
"before each" hook: Before for "test something 5":
Error: done() called multiple times in hook <Error 2 @error2 "before each" hook: Before for "test something 5"> of file /Users/cyril/Workspace/codeceptjs-debug/tests/error-2_test.ts
at /Users/cyril/Workspace/codeceptjs-debug/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/codeceptjs/lib/scenario.js:156:55
FAIL | 1 passed, 2 failed // 2s
--- STARTED "before each" hook: Before for "test something 6" ---
I am on page "https://www.google.com"
› [Browser:Info] Autofocus processing was blocked because a document already has a focused element.
› [Browser:Info] Autofocus processing was blocked because a document already has a focused element.
› [Browser:Error] Permissions policy violation: unload is not allowed in this document.
› [Browser:Error] Permissions policy violation: unload is not allowed in this document.
--- ENDED "before each" hook: Before for "test something 6" ---
I see element button#W0wltc
I click button#W0wltc
--- ENDED "before each" hook: Before for "test something 7" ---
I see element button#W0wltc
I click button#W0wltc
I dont see element button#W0wltc
[03] ✔ test something 6 in 59ms
✔ test something 6 in 168ms
test something 9
I dont see element button#W0wltc
[01] ✔ test something 7 in 177ms
✔ OK in 177ms
OK | 3 passed // 3s
--- STARTED "before each" hook: Before for "test something 9" ---
I am on page "https://www.google.com"
› [Browser:Info] Autofocus processing was blocked because a document already has a focused element.
› [Browser:Error] Permissions policy violation: unload is not allowed in this document.
--- ENDED "before each" hook: Before for "test something 9" ---
I see element button#W0wltc
I click button#W0wltc
I dont see element button#W0wltc
[03] ✔ test something 9 in 168ms
✔ OK in 168ms
-- FAILURES:
✖ "after all" hook: codeceptjs.afterSuite in "Error 2 @error2" in 0ms Throwing error in some random Scenario with try/catch
Lead to the same error as Throwing error in Before with try/catch
Lead to the same error as |
So my first conclusion are something in my test code throw an async error and it's not try/catch and Codecept can not handle it correctly. Tomorrow I will work on adding some try/catch on stuff I presume can lead to unhandled error, but is it possible that some error inside codeceptJs code can lead to unhandled error ? |
🎉UPDATE It's seems that if I remove |
I invok @DavertMik 🙌 you have work on the global |
Last test and last conclusion ^^ For With the same config After checking changelog, I've found the line that cause the issue from the fix here #3667 I've try to replace this code block if (Number.isInteger(+retryConfig)) {
if (test.retries() === -1) test.retries(retryConfig);
return;
} By this: if (Number.isInteger(+retryConfig)) {
if (isNotSet(test.retries())) test.retries(retryConfig);
return;
} I don't really understand what is in cause, but clearly the |
Investigation are explain on this issue codeceptjs#4358
... Wrong fixed, that is not the root cause of the issue. So I keep investigate ✌️ |
I think using a
to me, |
Yes it's test.retries is defined, just a wrong idea of the root cause for me ( that for i delete my PR)
|
Maybe link with #4197 ? |
We patched the retryTo issue in 3.5.11 > https://codecept.io/changelog/#_3-5-11 and the stale issue is found by you from 3.5.0. So the issue should be somewhere else, I think. |
Ok so the issue ara around the retry and how promise rejection are handled i presume ? |
adding more debug info
|
Using the version 3.6.3-beta.2 doesn't change the behavior, i still have the blocked issue -- FAILURES:
✖ "after all" hook: codeceptjs.afterSuite in "My custom test" in 1ms Maybe that can help you, but i get a lot of allure report error like this mention that something wrong append from Something went wrong Error: Something went wrong
at AllureReporter.debug (/e2e/node_modules/.pnpm/[email protected]/node_modules/allure-codeceptjs/src/index.ts:316:19)
at AllureReporter.allureStepByCodeceptStep (/e2e/node_modules/.pnpm/[email protected]/node_modules/allure-codeceptjs/src/index.ts:127:12)
at AllureReporter.stepFinished (/e2e/node_modules/.pnpm/[email protected]/node_modules/allure-codeceptjs/src/index.ts:289:29)
at EventEmitter.emit (node:events:526:35)
at EventEmitter.emit (node:domain:488:12)
at Object.emit (/e2e/node_modules/.pnpm/[email protected][email protected]/node_modules/codeceptjs/lib/event.js:149:28)
at /e2e/node_modules/.pnpm/[email protected][email protected]/node_modules/codeceptjs/lib/actor.js:146:11 |
hey @Horsty80 which allure report are you using? the legacy one or the one from allure team? Also if you disable the allure plugin, does your CI still stale? |
I use this one : https://www.npmjs.com/package/allure-codeceptjs
Before this new beta version, I have already try to remove allure but there are no impact on the issue. I pointing on this allure's error only because the stacktrace begin inside codeceptjs lib so maybe that can help to debug |
well if that's possible, adding the |
So i've retry without allure, and i get the same behavior. |
With debug, I have a tons of log to explore, but I see nothing strange or something can be useful Just to recap, I play 70 tests with run-worker command (with 4 or 6 workers), and I use plugin autoLogin and Retry + the Allure reporter My CI is blocked each time, and even remove the retry didn't have the expected solution. I don't know where to search but I can test what you propose, let me know |
Out of curiosity, are you using the After/AfterSuite in your Scenario files? I recall recently I got the issue (the process hangs) when using the hook like Before/After stuff like that. So the solution is moving the code from those hooks to a function and call that function in the scenario. Not a clean solution but at least it helped. Before(() => {...}) -> preconditions() {...} After(() => {...}) -> postconditions() {...} Scenario('test', () => { |
Yes i have that before, but i have remove all before/after from scenario files |
https://github.com/Horsty80/codeceptjs-debug/blob/main/tests/error-2_test.ts#L3 maybe redundant async cause some side effects? |
I will update with a new test file without the befare and test that but i think i get the same behavior |
@kobenguyent i still have the stale process issue with the 3.6.3-beta.2 The debug show me some much logs that can not exploit them |
Did you spot any unusual with your After block? |
When i run to all test (~70) in 4 workers, at the end, i get stuck with this error message
I have allready open here #3640 an issue before, but no response and the probleme has gone, but it's here again :'(
The text was updated successfully, but these errors were encountered: