whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

WAstate, chromium crash aw snap

Open voidpack opened this issue 2 years ago • 24 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

when wastate repeat opening, pairing, connected it cause high cpu resource and then some pc/server which low resource will crash aw snap on chromium.

Expected behavior

1-2hours inactivity of chat sometimes wastate opening,pairing,connected especially on midnight 1am -4am

Steps to Reproduce the Bug or Issue

dont know how to reopening state it just happenned automatic. image

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

windows android wwebjs 1.16.6 wawebversion 2.2216.8 nodejs v13.14.0

Additional context

No response

voidpack avatar May 19 '22 07:05 voidpack

happened to me ,need to log out and login again out of memory message appeared too

islamelgaidi avatar May 19 '22 11:05 islamelgaidi

happened to me ,need to log out and login again out of memory message appeared too

yeah some of my client always random happened, some 24hours - 2/3days, some random 4-12hours. some with low spec pc, some with server pc 16-32gb ram occur too.

voidpack avatar May 19 '22 11:05 voidpack

I have a server with 128gb of ram and i9 processor, and even there it happens :) I had to make a handler that checks the status of the tab, and if it does not respond, restart the connection.

TiNaR71 avatar Jun 01 '22 07:06 TiNaR71

I have a server with 128gb of ram and i9 processor, and even there it happens :) I had to make a handler that checks the status of the tab, and if it does not respond, restart the connection.

Can you show me your solution, pls? I'm facing the same problem

bugsbunch avatar Jul 04 '22 15:07 bugsbunch

I have a server with 128gb of ram and i9 processor, and even there it happens :) I had to make a handler that checks the status of the tab, and if it does not respond, restart the connection.

sharing your solution would help alot

omarmyousef avatar Jul 29 '22 00:07 omarmyousef

Happens to me too. (I make also telegram bot to quick control the whatsapp bot) Screenshot_20220729-113054_Telegraph

ZeANi-SHILIX avatar Jul 29 '22 08:07 ZeANi-SHILIX

i found the fix for this //delete the service worker fix the issue @pedroslopez @PurpShell

const { Client, Location, List, Buttons, LocalAuth } = require('./index');
var fs = require('fs');
const authStrategy = new LocalAuth(); 

var worker = `${authStrategy.dataPath}/session/Default/Service Worker`;
//delete the service worker fix the issue
if (fs.existsSync(worker)) {
    fs.rmSync(worker, { recursive: true });
}
const client = new Client({ authStrategy, puppeteer: { headless: true, args: ['--no-sandbox'] }, restartOnAuthFail: true, takeoverOnConflict: true, takeoverTimeoutMs: 10 });

islamelgaidi avatar Jul 30 '22 01:07 islamelgaidi

I have a server with 128gb of ram and i9 processor, and even there it happens :) I had to make a handler that checks the status of the tab, and if it does not respond, restart the connection.

I'd also be curious to see your solution to this.

TasseDeCafe avatar Jul 31 '22 14:07 TasseDeCafe

i found the fix for this //delete the service worker fix the issue @pedroslopez @PurpShell

const { Client, Location, List, Buttons, LocalAuth } = require('./index');
var fs = require('fs');
const authStrategy = new LocalAuth(); 

var worker = `${authStrategy.dataPath}/session/Default/Service Worker`;
//delete the service worker fix the issue
if (fs.existsSync(worker)) {
    fs.rmSync(worker, { recursive: true });
}
const client = new Client({ authStrategy, puppeteer: { headless: true, args: ['--no-sandbox'] }, restartOnAuthFail: true, takeoverOnConflict: true, takeoverTimeoutMs: 10 });

Thing is we already do this behind the curtains

We stop the workers gracefully instead of deleting them but ok

PurpShell avatar Aug 04 '22 00:08 PurpShell

i found the fix for this //delete the service worker fix the issue @pedroslopez @PurpShell

const { Client, Location, List, Buttons, LocalAuth } = require('./index');
var fs = require('fs');
const authStrategy = new LocalAuth(); 

var worker = `${authStrategy.dataPath}/session/Default/Service Worker`;
//delete the service worker fix the issue
if (fs.existsSync(worker)) {
    fs.rmSync(worker, { recursive: true });
}
const client = new Client({ authStrategy, puppeteer: { headless: true, args: ['--no-sandbox'] }, restartOnAuthFail: true, takeoverOnConflict: true, takeoverTimeoutMs: 10 });

Thing is we already do this behind the curtains

We stop the workers gracefully instead of deleting them but ok

I am having issues of high CPU usage and will try this. Thanks!

bernardoely avatar Aug 05 '22 03:08 bernardoely

Forgot to mention my client is dying when this happens:

image

bernardoely avatar Aug 05 '22 03:08 bernardoely

Forgot to mention my client is dying when this happens:

image

yes this is cause by wastate reconnecting (because of connection problem to server whatsapp) it cause high cpu on chromium using more than 8gb ram and then cause snap cannot reload page.

actually i already fix this issue on june but using custom client (old client base on purpshell latest md) also i'm not using authstrategy (still local path base on purpshell client) and the last step downgrade puppeteer using v10.4.0 and voila no more crash no more snap. run smooth almost 2 month nonstop without snap/crash

voidpack avatar Aug 05 '22 14:08 voidpack

Forgot to mention my client is dying when this happens: image

yes this is cause by wastate reconnecting (because of connection problem to server whatsapp) it cause high cpu on chromium using more than 8gb ram and then cause snap cannot reload page.

actually i already fix this issue on june but using custom client (old client base on purpshell latest md) also i'm not using authstrategy (still local path base on purpshell client) and the last step downgrade puppeteer using v10.4.0 and voila no more crash no more snap. run smooth almost 2 month nonstop without snap/crash

Sory, but what is a purpshell client? How to connect the local chromium profile folder on it?

bugsbunch avatar Aug 05 '22 21:08 bugsbunch

Forgot to mention my client is dying when this happens:

yes this is cause by wastate reconnecting (because of connection problem to server whatsapp) it cause high cpu on chromium using more than 8gb ram and then cause snap cannot reload page. actually i already fix this issue on june but using custom client (old client base on purpshell latest md) also i'm not using authstrategy (still local path base on purpshell client) and the last step downgrade puppeteer using v10.4.0 and voila no more crash no more snap. run smooth almost 2 month nonstop without snap/crash

Sory, but what is a purpshell client? How to connect the local chromium profile folder on it?

hi, this is my client.js file you can try use it (maybe you need a little custom on constant/injected file too) https://drive.google.com/file/d/1-Ym3mMs7OoGQxHHEIbUmSqpcTimWiMqF/view?usp=sharing

also on index.js file just add this (not using authstrategy) const client = new Client({ puppeteer: { headless: false , args:[ "--no-sandbox", ] }, clientId: 'wanode' });

voidpack avatar Aug 06 '22 07:08 voidpack

also i'm not using authstrategy (still local path base on purpshell clien

Thank you will give it a try!

bernardoely avatar Aug 08 '22 10:08 bernardoely

Forgot to mention my client is dying when this happens:

yes this is cause by wastate reconnecting (because of connection problem to server whatsapp) it cause high cpu on chromium using more than 8gb ram and then cause snap cannot reload page. actually i already fix this issue on june but using custom client (old client base on purpshell latest md) also i'm not using authstrategy (still local path base on purpshell client) and the last step downgrade puppeteer using v10.4.0 and voila no more crash no more snap. run smooth almost 2 month nonstop without snap/crash

Sory, but what is a purpshell client? How to connect the local chromium profile folder on it?

hi, this is my client.js file you can try use it (maybe you need a little custom on constant/injected file too) https://drive.google.com/file/d/1-Ym3mMs7OoGQxHHEIbUmSqpcTimWiMqF/view?usp=sharing

also on index.js file just add this (not using authstrategy) const client = new Client({ puppeteer: { headless: false , args:[ "--no-sandbox", ] }, clientId: 'wanode' });

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

bugsbunch avatar Aug 09 '22 11:08 bugsbunch

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

i downgrade puppeteer using v10.4.0 so it was using chromium Version 93.0.4577.0

voidpack avatar Aug 09 '22 13:08 voidpack

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

i downgrade puppeteer using v10.4.0 so it was using chromium Version 93.0.4577.0

Hi @voidpack. I've downgraded to v10.4.0 (using Chromium v93.0.4577.0) and used the indicated Client.js but I'm still getting the "Aw, Snap!" crash.

My WhatsApp instance is very heavy in chats and daily message volume.

Any tips are welcome!

bernardoely avatar Aug 17 '22 11:08 bernardoely

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

i downgrade puppeteer using v10.4.0 so it was using chromium Version 93.0.4577.0

Hi @voidpack. I've downgraded to v10.4.0 (using Chromium v93.0.4577.0) and used the indicated Client.js but I'm still getting the "Aw, Snap!" crash.

My WhatsApp instance is very heavy in chats and daily message volume.

Any tips are welcome!

me too

bugsbunch avatar Aug 17 '22 13:08 bugsbunch

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

i downgrade puppeteer using v10.4.0 so it was using chromium Version 93.0.4577.0

Hi @voidpack. I've downgraded to v10.4.0 (using Chromium v93.0.4577.0) and used the indicated Client.js but I'm still getting the "Aw, Snap!" crash.

My WhatsApp instance is very heavy in chats and daily message volume.

Any tips are welcome!

if you are using my client.js file, on index file new client still using authstrategy or not ? because authstrategy dont work with my client.js if not using it backup your file/respository first then try this old package.json (remove the package-lock.json first) https://drive.google.com/file/d/1vhwdIpFAXBCAO58Q_NoAoOe-zByRpVB7/view?usp=sharing (i'm suggest remove the node_modules folder too) then npm install. this is my last step using old package.json from pedro. after that a hundred client of mine never occur snap/crash again from june run nonstop 24hours.

voidpack avatar Aug 17 '22 14:08 voidpack

We did exactly as you wrote, but it didn’t help :( What version of Chromium do you use? Could it be a browser issue?

i downgrade puppeteer using v10.4.0 so it was using chromium Version 93.0.4577.0

Hi @voidpack. I've downgraded to v10.4.0 (using Chromium v93.0.4577.0) and used the indicated Client.js but I'm still getting the "Aw, Snap!" crash. My WhatsApp instance is very heavy in chats and daily message volume. Any tips are welcome!

if you are using my client.js file, on index file new client still using authstrategy or not ? because authstrategy dont work with my client.js if not using it backup your file/respository first then try this old package.json (remove the package-lock.json first) https://drive.google.com/file/d/1vhwdIpFAXBCAO58Q_NoAoOe-zByRpVB7/view?usp=sharing (i'm suggest remove the node_modules folder too) then npm install. this is my last step using old package.json from pedro. after that a hundred client of mine never occur snap/crash again from june run nonstop 24hours.

Thanks for your reply.

When you say for me not to use authStrategy, do you mean removing the argument like below (where I commented the line)?

var client = new Client({ //authStrategy: new LocalAuth(), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', '--disable-gpu' ],}})

I see in your package.json you are pointing to puppeteer "^10.4.0" and not "10.4.0". This causes Chromium to go beyond v93 (goes to version 100.x). Can you confirm which version of Puppeteer and Chromium is running there?

My instance (which 6k chats) is running fine for a couple days with puppeteer 10.4.0 and Chromium 93.x, so the workaround helped indeed! But if I run a client.getChats() then chat.fetchMessages() a few times, I get the Aw Snap crash right away.

bernardoely avatar Aug 21 '22 21:08 bernardoely

Thanks for your reply.

When you say for me not to use authStrategy, do you mean removing the argument like below (where I commented the line)?

var client = new Client({ //authStrategy: new LocalAuth(), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', '--disable-gpu' ],}})

I see in your package.json you are pointing to puppeteer "^10.4.0" and not "10.4.0". This causes Chromium to go beyond v93 (goes to version 100.x). Can you confirm which version of Puppeteer and Chromium is running there?

My instance (which 6k chats) is running fine for a couple days with puppeteer 10.4.0 and Chromium 93.x, so the workaround helped indeed! But if I run a client.getChats() then chat.fetchMessages() a few times, I get the Aw Snap crash right away.

i'm still using puppeeter v10.4.0 (using Chromium v93.0.4577.0). maybe your 6000 chat have to many message to fetch ? if not important message maybe you can try clear all chat history(just clear not delete) from WA app on the phone. maybe it can help from aw snap for fetchMessage

voidpack avatar Aug 22 '22 01:08 voidpack

Thanks for your reply. When you say for me not to use authStrategy, do you mean removing the argument like below (where I commented the line)? var client = new Client({ //authStrategy: new LocalAuth(), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', '--disable-gpu' ],}}) I see in your package.json you are pointing to puppeteer "^10.4.0" and not "10.4.0". This causes Chromium to go beyond v93 (goes to version 100.x). Can you confirm which version of Puppeteer and Chromium is running there? My instance (which 6k chats) is running fine for a couple days with puppeteer 10.4.0 and Chromium 93.x, so the workaround helped indeed! But if I run a client.getChats() then chat.fetchMessages() a few times, I get the Aw Snap crash right away.

i'm still using puppeeter v10.4.0 (using Chromium v93.0.4577.0). maybe your 6000 chat have to many message to fetch ? if not important message maybe you can try clear all chat history(just clear not delete) from WA app on the phone. maybe it can help from aw snap for fetchMessage

Thanks for your reply again and all of your support. The issue was that I was running a parallel iteration which was causing like 6k fetchmessages at the same time. Now my sync of chats is running a regular loop and all is fine!

I am using puppeeter v10.4.0 (using Chromium v93.0.4577.0) as well, based on your recommendation and now my instance takes like 3 days to crash instead of a couple hours, it's much better. Thank you so much. Cheers.

bernardoely avatar Aug 22 '22 12:08 bernardoely

Thanks for your reply. When you say for me not to use authStrategy, do you mean removing the argument like below (where I commented the line)? var client = new Client({ //authStrategy: new LocalAuth(), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', '--disable-gpu' ],}}) I see in your package.json you are pointing to puppeteer "^10.4.0" and not "10.4.0". This causes Chromium to go beyond v93 (goes to version 100.x). Can you confirm which version of Puppeteer and Chromium is running there? My instance (which 6k chats) is running fine for a couple days with puppeteer 10.4.0 and Chromium 93.x, so the workaround helped indeed! But if I run a client.getChats() then chat.fetchMessages() a few times, I get the Aw Snap crash right away.

i'm still using puppeeter v10.4.0 (using Chromium v93.0.4577.0). maybe your 6000 chat have to many message to fetch ? if not important message maybe you can try clear all chat history(just clear not delete) from WA app on the phone. maybe it can help from aw snap for fetchMessage

Thanks for your reply again and all of your support. The issue was that I was running a parallel iteration which was causing like 6k fetchmessages at the same time. Now my sync of chats is running a regular loop and all is fine!

I am using puppeeter v10.4.0 (using Chromium v93.0.4577.0) as well, based on your recommendation and now my instance takes like 3 days to crash instead of a couple hours, it's much better. Thank you so much. Cheers.

hai, that's great to hear your aw snap issue has been solve. it was nightmare for me too on late may till june when random a few hour and random clients have crash aw snap hahahahha. maybe my client not have 6k chat like your instance( i only have a few hundred chat) so i still have not found any crash aw snap again. cheers

voidpack avatar Aug 22 '22 13:08 voidpack