Baileys
Baileys copied to clipboard
[BUG] Closing stale open session for new outgoing prekey bundle / Closing session: SessionEntry
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:
- https://github.com/adiwajshing/libsignal-node/blob/11dbd962ea108187c79a7c46fe4d6f790e23da97/src/session_builder.js#L46
- https://github.com/adiwajshing/libsignal-node/blob/11dbd962ea108187c79a7c46fe4d6f790e23da97/src/session_record.js#L273
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