Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to reconnect a device via userDataDir after server is shutdown #1844

Open
carlosdarwed opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working needs triage

Comments

@carlosdarwed
Copy link

Description

When trying to reconnect a session from the userDataDir using the route start-session, an error about chromium locking the profile
because multiple processes were going on the same profile happens, eventually, the qrCode appears and you can try to connect the device, but if you don't, then the device becomes useless, you can't regenerate it's QrCode and reconnect it anymore, it turns into a ghost.

Environment

  • Wppconnect-server version(s): [e.g. 2.2.4]
  • Browser: [Chromium 85] // I guess...
  • OS: [Alpine Linux] // Running it in a Docker container
  • Node version: [Node 18.17]
  • WhatsApp version: [2.2412.54]
  • MultiDevice (BETA): yes
  • config.json:

// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();

export default {
secretKey: 'THISISMYSECURETOKEN',
host: 'http://localhost',
port: '21465',
deviceName: 'device name',
poweredBy: 'powered by',
startAllSession: true,
tokenStoreType: 'mongodb',
privateDb: true,
maxListeners: 15,
customUserDataDir: './userDataDir/',
webhook: {
url: null,
autoDownload: true,
uploadS3: false,
readMessage: true,
allUnreadOnStart: false,
listenAcks: true,
onPresenceChanged: true,
onParticipantsChanged: true,
onReactionMessage: true,
onPollResponse: true,
onRevokedMessage: true,
onLabelUpdated: true,
onSelfMessage: false,
},
chatwoot: {
sendQrCode: true,
sendStatus: true,
},
archive: {
enable: true,
waitTime: 10,
daysToArchive: 45,
},
log: {
level: 'silly', // Before open a issue, change level to silly and retry a action...
logger: ['console', 'file'],
},
createOptions: {
whatsappVersion: '2.2412.54',
browserArgs: [
'--disable-web-security',
'--no-sandbox',
'--disable-web-security',
'--aggressive-cache-discard',
'--disable-cache',
'--disable-application-cache',
'--disable-offline-load-stale-cache',
'--disk-cache-size=0',
'--disable-background-networking',
'--disable-default-apps',
'--disable-extensions',
'--disable-sync',
'--disable-translate',
'--hide-scrollbars',
'--metrics-recording-only',
'--mute-audio',
'--no-first-run',
'--safebrowsing-disable-auto-update',
'--ignore-certificate-errors',
'--ignore-ssl-errors',
'--ignore-certificate-errors-spki-list',
],
},
mapper: {
enable: false,
prefix: 'tagone-',
},
db: {
mongodbDatabase: 'mongoDbDatabase',
mongodbCollection: 'mongoDbCollection',
mongodbUser: 'mongodbUser',
mongodbPassword: 'mongodbPassword',
mongodbHost: 'mongodbhost',
mongoIsRemote: true,
mongoURLRemote: process.env.MONGODB_URL_CONN,
mongodbPort: 27017,
redisHost: 'localhost',
redisPort: 6379,
redisPassword: '',
redisDb: 0,
redisPrefix: 'docker',
},
aws_s3: {
region: 'sa-east-1',
access_key_id: null,
secret_key: null,
defaultBucketName: null,
},
};

Steps to Reproduce

  1. Turn on the the server in any server
  2. Connect a device via QrCode (Using my config, you should store this session in the userDataDir)
  3. Wait for it to be connected
  4. Shutdown the Server
  5. Turn the server on again
  6. Try to reconnect using the function start-session

Log Output

If relevant, paste all of your Log Output

error: [a98a79f7-8d5d-48b7-b4fc-18f31ae552c7:browser] Error no open browser
error: [a98a79f7-8d5d-48b7-b4fc-18f31ae552c7:browser] Failed to launch the browser process! undefined
[35:35:0507/183032.559839:ERROR:process_singleton_posix.cc(353)] another Chromium process (24) on another computer (goalwata-dev-7986f86bc-n6tlw). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.
[35:35:0507/183032.566728:ERROR:message_box_dialog.cc(146)] Unable to show a dialog outside the UI thread message loop: Chromium - The profile appears to be in use by another Chromium process (24) on another computer (goalwata-dev-7986f86bc-n6tlw). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.

TROUBLESHOOTING: https://pptr.dev/troubleshooting

error: 2024-05-07T18:30:32.681Z Failed to launch the browser process! undefined
[35:35:0507/183032.559839:ERROR:process_singleton_posix.cc(353)] The profile appears to be in use by another Chromium process (24) on another computer (goalwata-dev-7986f86bc-n6tlw). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.
[35:35:0507/183032.566728:ERROR:message_box_dialog.cc(146)] Unable to show a dialog outside the UI thread message loop: Chromium - The profile appears to be in use by another Chromium process (24) on another computer (goalwata-dev-7986f86bc-n6tlw). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.

Your Code

Not so relevant, it's basically some business rules added, if device is not on clientsArray or if it's status is "disconnected", then try to reconnect it via Axios call

Additional context / Screenshot

Add any other context about the problem here. If applicable, add screenshots to help explain.

I run this application in GCP, in a kubernetes cluster, containerizing it with Docker

One of the business rules of the system is if the server is somehow restarted, when online again, it should reconnect all the devices one by one, if a device has the status "connected' in userDataDir, use the start-session to just reconnect it again, else, generate the QR code and leave it alone. Because of this bug, I'm not being able to accomplish this rule. I understand I do not have a "priority pass" for being attended immediately, but I would appreciate it if the development team gave some attention to this, it's really important because it's preventing our custom system from improving.

image

@carlosdarwed carlosdarwed added bug Something isn't working needs triage labels May 8, 2024
@nestorcde
Copy link

same problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants