WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API

Home Page:https://baileys.whiskeysockets.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Closing open session in favor of incoming prekey bundle / Closing session: SessionEntry

oscarguindzberg opened this issue · comments

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

Closing open session in favor of incoming prekey bundle
Closing session: SessionEntry {
  _chains: {
    'xxx': { chainKey: [Object], chainType: 2, messageKeys: {} },
    'xxx': { chainKey: [Object], chainType: 1, messageKeys: {} }
  },
  registrationId: 2031812068,
  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: 2,
    closed: -1,
    used: 1718654391536,
    created: 1718654391536,
    remoteIdentityKey: <Buffer xx xx xx ...>
  }
}

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):

  • Is this on a server? yes
  • What do your connectOptions look like?
const { version, isLatest } = await fetchLatestBaileysVersion()
const { state, saveCreds } = await useMultiFileAuthState('myPath')
const msgRetryCounterCache = new NodeCache()

        async function getMessage(key)  {
            if(store) {
                const msg = await store.loadMessage(key.remoteJid, key.id)
                return msg?.message || undefined
            }
            // only if store is present
            return proto.Message.fromObject({})
        }

 makeWASocket({
            version,
            logger,
            printQRInTerminal: false,
            mobile: false,
            auth: {
                creds: state.creds,
                keys: makeCacheableSignalKeyStore(state.keys, logger),
            },
            msgRetryCounterCache,
            generateHighQualityLinkPreview: true,
            // ignore broadcast and newsletter messages
            shouldIgnoreJid: jid => !jid || isJidBroadcast(jid) || isJidNewsletter(jid),
            // implement to handle retries & poll updates
            getMessage,
            shouldSyncHistoryMessage: () => true,
            markOnlineOnConnect: false
        })
  • Do you have multiple clients on the same IP? yes, 15 clients
  • Are you using a proxy? no

Additional context
Using baileys v6.7.5

These bugs may be related
#885
#886
#887
#888

I don't understand why was the issue closed.