ARTICLE AD BOX
We have a golang web application which is using msedgedriver.exe to convert HTML to PDF. For each user session we create a new Edge Webdriver and Quit when the session terminates.
Our problem is, that it stays in memory after the session is finished. In our setup it will swallow all our server RAM in a few days, forcing us to restart the server.
We can't see the memory usage in taskmanager (windows), but in RAMMap.
For the sake of understanding: It's not the application which is using the memory
Code with error handling skipped.
main.go: import ( "github.com/go-auxiliaries/selenium" "github.com/go-auxiliaries/selenium/chrome" ) // Start a selenium service edge, err = selenium.NewChromeDriverService("C:\\Program Files\\EdgeWebDriver\\msedgedriver.exe", 4444) defer edge.Stop()And the implementation
filehandler.go: caps := selenium.Capabilities{} caps.AddChrome(chrome.Capabilities{Args: []string{ "--headless=new", // doesn't seem to be working on local }, W3C: true}) driver, err := selenium.NewRemote(caps, "http://127.0.0.1:4444/wd/hub") defer driver.Quit() err = driver.Get(path) err = driver.SetPageLoadTimeout(time.Minute * 1) pArgs := selenium.PrintArgs{ //Not part of go lib, added manually in the lib. Page: selenium.Page{Height: 29.7, Width: 21}, // A4-format } b, err := driver.Print(pArgs)If we start a selenium service when a requests comes in and close it. It will destroy any other requests being processed.
Anyone have some clues on how we fix this memory issue?
