rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.68k stars 119 forks source link

Stop process if error during initialise #414

Closed 20TRIES closed 8 months ago

20TRIES commented 8 months ago

We use Ferrum with Puma and found that if an error is raised during initialisation of the browser, then chrome processes do not get stopped until the garbage collection runs.

Equally there is no way to stop these processes from the perspective of somebody using Ferrum because we never get a browser object back as the initialize method is raising the error.

From what i can tell, garbage collection doesn't run immediately and so these processes can live for longer then they need to.

By catching any errors raised between the process being started and returning from the browser initialiser then we can ensure that we stop any processes which were started.

route commented 8 months ago

Thank you! Looks good!