R
Railway16mo ago
lowzyyy

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/9DK4Jqes
Pastebin
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
Percy
Percy16mo ago
Project ID: cc7f19a6-bd5b-4ec4-8b2c-4f69684f4cc4
Brody
Brody16mo ago
send your package.json?
Brody
Brody16mo ago
thats it?
lowzyyy
lowzyyy16mo ago
yeah
Brody
Brody16mo ago
tiny
lowzyyy
lowzyyy16mo ago
its simple telegram bot app
Brody
Brody16mo ago
fair send me your repo please?
lowzyyy
lowzyyy16mo ago
GitHub
GitHub - lowzyyy/crypto-price-telegram-bot
Contribute to lowzyyy/crypto-price-telegram-bot development by creating an account on GitHub.
lowzyyy
lowzyyy16mo ago
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
Brody
Brody16mo ago
does coingecko not have an api?
lowzyyy
lowzyyy16mo ago
i am using coingecko in there
Brody
Brody16mo ago
yeah but with puppet, not an api
lowzyyy
lowzyyy16mo ago
but puppeteer for traidingview scrape chart pictures for various timeframes
Brody
Brody16mo ago
you cant access that data with coingeckos api?
lowzyyy
lowzyyy16mo ago
i want chart image so i screenshot the web page
Brody
Brody16mo ago
okay understood
lowzyyy
lowzyyy16mo ago
so why is this happening?
Brody
Brody16mo ago
Brody
Brody16mo ago
i cant replicate your error
lowzyyy
lowzyyy16mo ago
i am saying that error is happening occasionally
Brody
Brody16mo ago
code issue and thus out of the scope of these help threads
lowzyyy
lowzyyy16mo ago
my code or puppeteer code?
Brody
Brody16mo ago
yours
lowzyyy
lowzyyy16mo ago
i am not doing pthread_create
Brody
Brody16mo ago
you dont have to be to cause such an error
lowzyyy
lowzyyy16mo ago
error is saying that operating system had error some source is not available i dont know how can my code make this problem
Brody
Brody16mo ago
yes scary error means you are doing something very wrong
lowzyyy
lowzyyy16mo ago
opening and closing browser on interval. Very hardcore programming 😄
Brody
Brody16mo ago
with all due respect, your codebase isnt good to put it lightly hard to read, bad formatting, bad practices, etc etc
lowzyyy
lowzyyy16mo ago
can you point out what bad practices, i am trying to learn formatting is done with prettier extension
Brody
Brody16mo ago
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"
lowzyyy
lowzyyy14mo ago
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");