Puppeteer error crash: Failed to launch the browser process!
Project id: cc7f19a6-bd5b-4ec4-8b2c-4f69684f4cc4
My puppeteer application occasionally crash. Puppeteer is launched with
args: ["--no-sandbox"]
In that time of a crash i can see on metrics that app ram usage spike from 600mb to 1gb and i get this error log:
https://pastebin.com/9DK4JqesPastebin
Railway log - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
34 Replies
Project ID:
cc7f19a6-bd5b-4ec4-8b2c-4f69684f4cc4
You might find these helpful:
- Deployed Project Crashed
- Why does my node.js app cras after 300mb network?
- Rust Rocket app high memory usage with no requests
⚠️ experimental feature
send your package.json?
thats it?
yeah
tiny
its simple telegram bot app
fair
send me your repo please?
GitHub
GitHub - lowzyyy/crypto-price-telegram-bot
Contribute to lowzyyy/crypto-price-telegram-bot development by creating an account on GitHub.
here there is node-fetch but node 18 has it so i should uninstall it
i am deploying railway branch, almost the same as master
does coingecko not have an api?
i am using coingecko in there
yeah but with puppet, not an api
but puppeteer for traidingview scrape chart pictures for various timeframes
you cant access that data with coingeckos api?
i want chart image
so i screenshot the web page
okay understood
so why is this happening?
i cant replicate your error
i am saying that error is happening occasionally
code issue
and thus out of the scope of these help threads
my code or puppeteer code?
yours
i am not doing pthread_create
you dont have to be to cause such an error
error is saying that operating system had error
some source is not available
i dont know how can my code make this problem
yes scary error means you are doing something very wrong
opening and closing browser on interval. Very hardcore programming 😄
with all due respect, your codebase isnt good to put it lightly
hard to read, bad formatting, bad practices, etc etc
can you point out what bad practices, i am trying to learn
formatting is done with prettier extension
out of the scope of what these help threads are for unfortunately
if it was simple id tell you, but the code is what some would call "spaghetti code"
ok, thanks for help
after a lot of inspections i came to conclusion that i am not doing anything wrong. It seems (for now) that keeping the browser opened and opening/closing pages works better than opening and closing browser.
There is some problem with opening the browser on linux because i did not have this problem at windows at all
Update2: puppeteer definitely leaks memory if you open/close pages a lot or at least on interval. RAM memory was always growing to the 700-800mb and i just used 3 pages!!!
Then i switched again to open/close browser strategy because closing the browser will free the used RAM until next call of the function. BUT linux have problem with opening the chrome browser. It would often crash, at least once a day. Sometime it wont even restart the container because how bad crash was!!!
So i found the solution. For some unknown reason chrome wont close properly in this container so i had to manually kill the process to free threads being used. Because chrome would not free the thread, after some time it would crash container because there would not be free threads to use.
This fixed my problem for now:
import shell from "shelljs";
Then after await browser.close()
i would run:
shell.exec("pkill chrome");