WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.76k stars 1.29k forks source link

[BUG] Closing stale open session for new outgoing prekey bundle / Closing session: SessionEntry #888

Open oscarguindzberg opened 3 months ago

oscarguindzberg commented 3 months ago

Describe the bug I have a server with 15 connected whatsapp users. I find this on the log from time to time:

Closing stale open session for new outgoing prekey bundle
Closing session: SessionEntry {
  _chains: {
    xxx: { chainKey: [Object], chainType: 1, messageKeys: {} }
  },
  registrationId: 149285497,
  currentRatchet: {
    ephemeralKeyPair: {
      pubKey: <Buffer xx xx xx ...>,
      privKey: <Buffer xx xx xx ...>
    },
    lastRemoteEphemeralKey: <Buffer xx xx xx ...>,
    previousCounter: 0,
    rootKey: <Buffer xx xx xx ...>
  },
  indexInfo: {
    baseKey: <Buffer xx xx xx ...>,
    baseKeyType: 1,
    closed: -1,
    used: xxx,
    created: 1718893928273,
    remoteIdentityKey: <Buffer xx xx xx ...>
  },
  pendingPreKey: {
    signedKeyId: 7192122,
    baseKey: <Buffer xx xx xx ...>,
    preKeyId: 1310
  }
}

I know this is printed by libsignal, I guess these lines are the culprits:

To Reproduce Steps to reproduce the behavior: Don't know how to reproduce, it happens from time to time on a server with 15 connected whatsapp users.

Expected behavior No errors on the log

Environment (please complete the following information):

Additional context Using baileys v6.7.5

oscarguindzberg commented 3 months ago

These bugs may be related https://github.com/WhiskeySockets/Baileys/issues/885 https://github.com/WhiskeySockets/Baileys/issues/886 https://github.com/WhiskeySockets/Baileys/issues/888

oscarguindzberg commented 3 months ago

I don't understand why was the issue closed.

PurpShell commented 3 months ago

I don't understand why was the issue closed.

i think he closed due to duplicate

Anshuljai commented 2 months ago

Any solution?

DanNisenson commented 1 month ago

Same, using SQL

lucianodltec commented 1 month ago

+1

lucas-linvix commented 3 weeks ago

hello I have this problem too.

andre-mr commented 2 weeks ago

I'm experiencing the same issue and have an additional question: Where in the library is this log being generated? When I initialize the socket, I set the logger level to silent using the pino module to prevent any logs from being printed to the terminal:

const sock = makeWASocket({
  auth: state,
  version: currentVersion,
  printQRInTerminal: true,
  logger: pino({ level: 'silent' }),
});

However, this specific error is still being printed. What part of the library is outputting this log and ignoring the silent parameter?

andre-mr commented 2 weeks ago

I know this is printed by libsignal, I guess these lines are the culprits:

Sorry, I hadn't seen that part of your post. I went into those files and simply commented out those lines, because those logs aren't interfering with the bot's operation, they're just polluting the terminal I use to see messages from my own code.

Developers could check if those logs are necessary maybe. Thanks!