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

go-rod browser becomes unresponsive once in a while while running under Docker #1155

Open
bakatz opened this issue Nov 29, 2024 · 0 comments
Labels
question Questions related to rod

Comments

@bakatz
Copy link

bakatz commented Nov 29, 2024

Rod Version: v0.116.2

Having a very weird issue with the go-rod Docker container. I'm running the container in a production environment on an arm64 host with the default settings, and it works fine 99% of the time. The disk has plenty of space and the system is healthy overall with normal RAM/CPU usage.

However, once every few days, the browser appears to partially crash. I say partially because it appears that all commands (i.e. clicking elements on the page, etc) start timing out and the monitoring UI loads (and the title of the browser tab is correct) but the UI looks like this:

image

My initialization code (only runs once on app startup, trace is false and ws url = ws://go-rod:7317)

launcherPtr, err := launcher.NewManaged(os.Getenv("BROWSER_WEBSOCKET_URL"))
		if err != nil {
			logger.Error("Got an error initializing the launcher", "err", err)
			return nil, err
		}

		cdpClient, err := launcherPtr.Headless(true).Devtools(false).Client()
		if err != nil {
			logger.Error("Got an error initializing the launcher client", "err", err)
			return nil, err
		}

		browser := rod.New().
			Client(cdpClient).
			Trace(os.Getenv("BROWSER_TRACE") == "true").
			SlowMotion(1000 * time.Millisecond)

What you got

Periodic crashes / unresponsive browser

What you expect to see

No periodic crashes / responsive browser at all times

What have you tried to solve the question

This is very hard to diagnose since the issue only happens once every week or so. Timing seems to be random i.e. I've had it happen while I was sleeping and also during the day.

  1. I inspected the web requests for the monitoring server and everything looks fine - i.e. 200 response with no errors. Although the response body does not include a screenshot URL, so maybe that's related to the "error loading screenshots" issue (?)

  2. I also tried looking at container logs for go-rod via docker cli and I see nothing unusual, just a few logs reporting that the browser process was killed and restarted. These seem normal and make sense as they were around times I redeployed my app which causes a browser disconnect.

@bakatz bakatz added the question Questions related to rod label Nov 29, 2024
@bakatz bakatz changed the title go-rod crashes once in a while while running under Docker go-rod browser becomes unresponsive once in a while while running under Docker Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

1 participant