Jump to content
McKay Development

Recommended Posts

Posted (edited)

There's a possible memory leak in comps/friends.js or comps/familysharing.js
(edit: I could be wrong about where the leak is)
(please check my attached image)

The issue is rare and I'm unable to actively reproduce it yet, However it happens every 7 to 14 days after the App has been running for a while with 150~ instances of steamUser. (no memory leak until it happens)

 I will update this thread as I find more useful details to go on.

 

the only part of my code which interacts with the steamUserFriends

    steamUser.chat.on('friendMessage', async (message) => {
        if (config.autoReply) {
            if (!client.autoReplyRecipients.includes(message.steamid_friend.getSteamID64())) {
                client.autoReplyRecipients.push(message.steamid_friend.getSteamID64())
                steamUser.chat.sendFriendMessage(message.steamid_friend, config.autoReply)
                setTimeout((removeSteamId) => {
                    client.autoReplyRecipients = client.autoReplyRecipients.filter(steamId => steamId !== removeSteamId)
                }, 60000, message.steamid_friend.getSteamID64())
            }
        }
    })

    steamUser.on('friendRelationship', (sid, relationship) => {
        if (config.autoFriend && relationship == SteamUser.EFriendRelationship.RequestRecipient) {
            steamUser.addFriend(sid)
        }
    })

 

image.png

Edited by Yeezy
Posted

15 May, Heapsnapshot size: 71 MB (no leak)

image22.png.705bccd376d8a9411d19bddc10196b32.png

16 May, Heapsnapshot size: 1.85 GB

ljPPRSF.png.2d2c3151ef69a2f1d21c855b2b371da4.png

Should I log/trace all locations where a new SteamID gets created (inside the node-steam-user lib) and see if that leads me anywhere?

Posted

Between your two screenshots, it kinda looks to me like g_ProcessPersonaSemaphore is somehow hanging at some point. The semaphore is backed by a linked list, and I see a lot of prev pointers in your OP screenshot. I don't really see why it would hang though, all code paths end in releasing the lock. That would also cause SteamID objects to pile up, as you're seeing in your heap snapshot.

In any case, try 4.28.4 and see if that fixes things for you.

Posted
14 hours ago, Dr. McKay said:

Between your two screenshots, it kinda looks to me like g_ProcessPersonaSemaphore is somehow hanging at some point. The semaphore is backed by a linked list, and I see a lot of prev pointers in your OP screenshot. I don't really see why it would hang though, all code paths end in releasing the lock. That would also cause SteamID objects to pile up, as you're seeing in your heap snapshot.

In any case, try 4.28.4 and see if that fixes things for you.

Thank you, I'll try the update and let you know

Posted

Node: v16.14
[email protected]

Should I run node LTS 18.x and see if that resolves anything?
or log a specific variable/obj count inside the module to see whats happening?


I took a heap snapshot and will be checking it, I'll post an update if I find anything

image-1.thumb.png.eccc47e06ed039a6ca5f140bd6a9bc2a.png


 

Posted

I don't have a snapshot from when the server was initialized but I have one from a server that was started at the exact same time and has the same amount of steamUser instances on it.

If there's anything specific you'd like me to try and/or look at please let me know.

 

no leak:

Screenshot2023-05-23at12_41_40.thumb.png.24fdad189eeaba05540e2fa4482014ac.png

Screenshot2023-05-23at12_41_48.thumb.png.a21f035194750deee6dffb4d93aeed36.png

 

leaked:

Screenshot2023-05-23at12_41_00.thumb.png.3998c27e88d3713f4e0bba1e05249129.png

Screenshot2023-05-23at12_41_33.thumb.png.e69e019a3ca0cd3e2892818b2f2b106e.png

  • 2 weeks later...
Posted

4.28.4 still leaked memory unfortunately.

 

Running a test currently with the following handlers disabled:

EMsg.ClientPersonaState
EMsg.ClientClanState
EMsg.ClientFriendsList

It's been looking good so far no memory leak yet (running for 4+ days now)
 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...