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

Web crawler randomly fails on some manual test on CI #14906

Open
psmyrek opened this issue Aug 31, 2023 · 12 comments · May be fixed by ckeditor/ckeditor5-dev#918
Open

Web crawler randomly fails on some manual test on CI #14906

psmyrek opened this issue Aug 31, 2023 · 12 comments · May be fixed by ckeditor/ckeditor5-dev#918
Assignees
Labels
package:dev pending:browser-bug This issue is blocked by an upstream (browser) issue. squad:devops Issue to be handled by the Devops team. status:stale type:bug This issue reports a buggy (incorrect) behavior.

Comments

@psmyrek
Copy link
Contributor

psmyrek commented Aug 31, 2023

📝 Provide detailed reproduction steps (if any)

Recently, there have been a lot of reports from a web crawler that one test fails on CI:

❌ Failed to load resource from localhost:8125 (failure message: net::ERR_ABORTED)
    
    …found on the following page:
    ➥  http://localhost:8125/ckeditor5-engine/tests/manual/view/noselection-iframe.html

I'm not able to reproduce this error locally.

✔️ Expected result

The noselection-iframe manual test does not fail in web crawler.

❌ Actual result

The noselection-iframe manual test fails randomly in web crawler. After restarting the job on CI the test passes.

❓ Possible solution

Check the exact version of Chrome that is run on CI and its arguments. Maybe there is a difference between CI and local environment?


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@psmyrek psmyrek added type:bug This issue reports a buggy (incorrect) behavior. squad:devops Issue to be handled by the Devops team. package:dev labels Aug 31, 2023
@psmyrek psmyrek self-assigned this Aug 31, 2023
@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Aug 31, 2023
@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

I checked the browser version and launch arguments on CI and on my local environment:

Local environment
Browser version =  HeadlessChrome/112.0.5614.0
Browser arguments =  [
  'C:\\Users\\psmyrek\\.cache\\puppeteer\\chrome\\win64-1108766\\chrome-win\\chrome.exe',
  '--allow-pre-commit-input',
  '--disable-background-networking',
  '--disable-background-timer-throttling',
  '--disable-backgrounding-occluded-windows',
  '--disable-breakpad',
  '--disable-client-side-phishing-detection',
  '--disable-component-extensions-with-background-pages',
  '--disable-component-update',
  '--disable-default-apps',
  '--disable-dev-shm-usage',
  '--disable-extensions',
  '--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints',
  '--disable-hang-monitor',
  '--disable-ipc-flooding-protection',
  '--disable-popup-blocking',
  '--disable-prompt-on-repost',
  '--disable-renderer-backgrounding',
  '--disable-sync',
  '--enable-automation',
  '--enable-blink-features=IdleDetection',
  '--enable-features=NetworkServiceInProcess2',
  '--export-tagged-pdf',
  '--force-color-profile=srgb',
  '--metrics-recording-only',
  '--no-first-run',
  '--password-store=basic',
  '--use-mock-keychain',
  '--headless',
  '--hide-scrollbars',
  '--mute-audio',
  'about:blank',
  '--remote-debugging-port=0',
  '--user-data-dir=C:\\Users\\psmyrek\\AppData\\Local\\Temp\\puppeteer_dev_chrome_profile-ydGd22'
]
CI environment
Browser version =  HeadlessChrome/112.0.5614.0
Browser arguments =  [
  '/home/circleci/.cache/puppeteer/chrome/linux-1108766/chrome-linux/chrome',
  '--allow-pre-commit-input',
  '--disable-background-networking',
  '--disable-background-timer-throttling',
  '--disable-backgrounding-occluded-windows',
  '--disable-breakpad',
  '--disable-client-side-phishing-detection',
  '--disable-component-extensions-with-background-pages',
  '--disable-component-update',
  '--disable-default-apps',
  '--disable-dev-shm-usage',
  '--disable-extensions',
  '--disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints',
  '--disable-hang-monitor',
  '--disable-ipc-flooding-protection',
  '--disable-popup-blocking',
  '--disable-prompt-on-repost',
  '--disable-renderer-backgrounding',
  '--disable-sync',
  '--enable-automation',
  '--enable-blink-features=IdleDetection',
  '--enable-features=NetworkServiceInProcess2',
  '--export-tagged-pdf',
  '--force-color-profile=srgb',
  '--metrics-recording-only',
  '--no-first-run',
  '--password-store=basic',
  '--use-mock-keychain',
  '--headless',
  '--hide-scrollbars',
  '--mute-audio',
  'about:blank',
  '--remote-debugging-port=0',
  '--user-data-dir=/tmp/puppeteer_dev_chrome_profile-Lw4Wha'
]

There is no difference between local and CI environments, except the path to the executable and the --user-data-dir, but they shouldn't affect the tests.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

All debugging I'm doing on fix-crawler-failures-on-ci branches in ckeditor5 and ckeditor5-dev.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

Idea

Switching to the new headless mode in Puppeteer (headless: 'new') that brings the headless mode closer to Chrome's regular "headful" mode.

Result

Chrome doesn't seem to start at all. In console I see only two lines: "🔎 Starting the Crawler" and then "✨ No errors have been found.". The execution time of the crawler script is ~1 second.

Logs in CircleCI.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

Idea

Bumping Puppeteer to the latest version v21.1.1.

Result

Same as above: Chrome doesn't seem to start at all.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

Idea

Enabling debug mode in Puppeteer v21.1.1 by providing dumpio: true launch option.

Result

There are some errors that does not tell much about how to fix them:

[12220:12240:0831/104842.579336:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[12220:12240:0831/104842.579398:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[12220:12240:0831/104842.579407:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[12220:12240:0831/104842.579417:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[12220:12220:0831/104842.587321:ERROR:chrome_browser_cloud_management_controller.cc(163)] Cloud management controller initialization aborted as CBCM is not enabled.
[12220:12240:0831/104842.606922:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[12220:12240:0831/104842.606944:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon

DevTools listening on ws://127.0.0.1:43927/devtools/browser/c7f923d7-9a5b-4388-9f6c-14e02ea6f07e
[12220:12220:0831/104842.675743:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type: 
[12220:12277:0831/104842.716499:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[12220:12277:0831/104842.716932:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[12220:12277:0831/104842.717704:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files

[12262:7:0831/104842.782995:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

Idea

Installing some dependencies that might be needed on Linux machine, as described on https://pptr.dev/troubleshooting#running-puppeteer-on-circleci. Still using Puppeteer v21.1.1.

Result

Same as above: Chrome doesn't seem to start at all.

@psmyrek
Copy link
Contributor Author

psmyrek commented Aug 31, 2023

Idea

Maybe manually starting the dbus service could help?
Executing sudo service dbus start and configuring environment variable DBUS_SESSION_BUS_ADDRESS: "autolaunch:".

Result

Same as above: Chrome doesn't seem to start at all.

@psmyrek
Copy link
Contributor Author

psmyrek commented Sep 1, 2023

It seems that after using the latest Puppeteer, the noselection-iframe manual test always throws an error, both on CI and in the local environment. It is either a single navigation timeout or both navigation timeout and net::ERR_ABORTED. One important thing how to reproduce the issue: a few lines of code that removes a default blank page have to be commented out locally, but they must not be commented out on CI.

It seems that the issue with net::ERR_ABORTED and navigation timeout is triggered because:

  • noselection-iframe.html loads via src attribute the immutable.html file.
  • Then, immutable.html loads immutable.js file and other resources (e.g. inspector).
  • Then, in the meantime, noselection-iframe.html loads noselection-iframe.js file.
  • Then, noselection-iframe.js file overwrites the source of the iframe via srcdoc attribute.

It seems that the request to the immutable.html and its resources is cancelled, but it is not handled by Puppeteer (?) and/or web crawler (?).

Attached a log from the Puppeteer when the noselection-iframe manual test starts: log.txt. See request id 14552.22 that tried to load http://localhost:8125/assets/attachinspector.js from immutable.html frame.

@psmyrek
Copy link
Contributor Author

psmyrek commented Sep 1, 2023

I tried detecting if the frame navigation was performed:

await Promise.all(
	page.mainFrame().childFrames().map( frame => {
		return frame.waitForNavigation();
	} )
);

but the promise is not resolved for the iframe.

Also, I experimented with many chrome flags but without success.

For now, no idea how to fix this issue.

@psmyrek
Copy link
Contributor Author

psmyrek commented Sep 1, 2023

This issue is not reproducible in a non-headless mode locally. But on CI the error occurs in both headless modes (new and old ones) and in a non-headless mode.

@psmyrek
Copy link
Contributor Author

psmyrek commented Sep 4, 2023

I was able to create a minimal reproducible example. It looks like that this is an issue either in Puppeteer or Chrome.
See the details in puppeteer/puppeteer#10838.

@pomek pomek added the pending:browser-bug This issue is blocked by an upstream (browser) issue. label Sep 4, 2023
@CKEditorBot CKEditorBot added status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Oct 4, 2023
@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:dev pending:browser-bug This issue is blocked by an upstream (browser) issue. squad:devops Issue to be handled by the Devops team. status:stale type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants