Baileys: [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:

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

i found that solution, you just don’t use (level: ‘silent’) on pino, just use another level.

Any solution?

i just commented every single “console.something” (log, error, warn, info…) line from js files inside node_modules/libsignal/src folder.

and i had to, because my application uses a readline-based menu and custom logs. any library log messes things up.

but i still don’t know why pino settings doesn’t affect logs from libsignal library. 🤷‍♂️

I don’t understand why was the issue closed.

i think he closed due to duplicate