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

Infinite cycle on video recorder when heartbeat fails #8212

Open
zamprano opened this issue Jun 13, 2024 · 1 comment
Open

Infinite cycle on video recorder when heartbeat fails #8212

zamprano opened this issue Jun 13, 2024 · 1 comment
Labels
TYPE: bug The described behavior is considered as wrong (bug).

Comments

@zamprano
Copy link

What is your Scenario?

When the heartbeat fails, the framework enters an infinite cycle, on the video recorder, filling the logs with the same error message until it blows up. Any test with video recording can be impacted.
The error message (repeated until log is 2+ Gb) is:

TypeError: Cannot destructure property 'browserClient' of 'this.openedBrowsers[browserId]' as it is undefined.
    at BrowserProviderPluginHost.getVideoFrameData (node_modules\testcafe\src\browser\provider\built-in\dedicated\chrome\index.js:172:17)
    at BrowserProvider.getVideoFrameData (node_modules\testcafe\src\browser\provider\index.ts:425:28)
    at VideoRecorder._capture (node_modules\testcafe\src\video-recorder\process.js:118:62)

We've traced the error to: node_modules\testcafe\lib\video-recorder\process.js, where it keeps calling getVideoFrameData() infinitely:

async _capture() {
	while (this.active) {
		try {
			const frame = await this.connection.provider.getVideoFrameData(this.connection.id);
			if (frame) {
				await this.emit('frame');
				await this._addFrame(frame);
			}
			else {
				await (0, delay_1.default)(DELAY_AFTER_EMPTY_FRAME);
			}
		}
		catch (error) {
			this.debugLogger(error);
		}
	}
}

As a patch, we're modifying node_modules\testcafe\lib\browser\provider\index.js, adding a validation that the browserId is still valid:

async getVideoFrameData(browserId) {
	if (!this.localBrowsersInfo[browserId]) return;
	return this.plugin.getVideoFrameData(browserId);
}

Even though the workaround works, it could be possible to find a better way to avid the issue.

What is the Current behavior?

  • No video.
  • No screenshots
  • Empty result reports.
  • Logs weighing 2+ Gb.

What is the Expected behavior?

The test restarts for a new attempt.

What is the public URL of the test page? (attach your complete example)

https://devexpress.github.io/testcafe/example

What is your TestCafe test code?

bug-reporting.ts:

import { Selector } from 'testcafe';

fixture('TestCafe example page')
    .page('https://devexpress.github.io/testcafe/example');

test('Bug reporting', async t => {
	await t
        .typeText('#developer-name2', 'John Smith')
        .click('#submit-button')
        .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
});

Your complete configuration file

No response

Your complete test report

N/A

Screenshots

N/A

Steps to Reproduce

Suggest updating HEARTBEAT_TIMEOUT on lib\utils\browser-connection-timeouts.js to 10s (default, 2min).

  1. Start any test.
  2. Once the test starts, open the browser's console and go to the Network tab.
  3. Change the throttling to Offline.
  4. Wait for the heartbeat to timeout and check the console.

TestCafe version

3.6.1

Node.js version

18.16.0

Command-line arguments

testcafe chrome bug-reporting.ts --video results/video --selector-timeout 150000

Browser name(s) and version(s)

Chrome 126

Platform(s) and version(s)

Windows 10

Other

Similar to #6288

@zamprano zamprano added the TYPE: bug The described behavior is considered as wrong (bug). label Jun 13, 2024
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jun 13, 2024
@Bayheck Bayheck added the STATE: Issue accepted An issue has been reproduced. label Jun 17, 2024
Copy link

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

@github-actions github-actions bot removed STATE: Need response An issue that requires a response or attention from the team. STATE: Issue accepted An issue has been reproduced. labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants