You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using puppeteer in a Rails 7.2.1 application with external browserless Chrome container connection with Puppeteer.connect(..) do |browser| .. end. Memory usage slowly creeps up. When built into a Docker image, any hard limit will eventually be hit despite the ruby VM trying to garbage collect. I am "ensure"ing a browser.close and browser.disconnect within the block. Here's the exact block...
Puppeteer.connect(browser_ws_endpoint: ENV['WEBSOCKET_CHROME_URL'])do |browser|
Rails.logger.debug"Attempting to capture screenshot of: + #{uri}"beginpage=browser.new_pagepage.viewport=Puppeteer::Viewport.new(width: 1280,height: 1280)page.goto(uri.to_s,timeout: 5000)# , wait_until: 'domcontentloaded')self.http_screenshot=page.screenshotrescueStandardError=>e# Errors can be thrown due to a number of things: DNS, timeout, etc.Rails.logger.debug'Failed to capture screenshot.'Rails.logger.debugeensureRails.logger.debug'Closing browser.'browser.closebrowser.disconnectendend
Step To Reproduce / Observed behavior
Using puppeteer in a Rails 7.2.1 application with external browserless Chrome container connection with
Puppeteer.connect(..) do |browser| .. end
. Memory usage slowly creeps up. When built into a Docker image, any hard limit will eventually be hit despite the ruby VM trying to garbage collect. I am "ensure"ing a browser.close and browser.disconnect within the block. Here's the exact block...Expected behavior
Memory to remain fairly stable.
Environment
macOS with rvm
Paste the output of
ruby --version
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [arm64-darwin23]
The text was updated successfully, but these errors were encountered: