Skip to content

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

Open
@bakatz

Description

@bakatz

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestions related to rod

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions