Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak around g_ProcessPersonaSemaphore #441

Open
Sadzurami opened this issue Jun 1, 2023 · 2 comments
Open

Memory leak around g_ProcessPersonaSemaphore #441

Sadzurami opened this issue Jun 1, 2023 · 2 comments
Labels

Comments

@Sadzurami
Copy link
Contributor

Sadzurami commented Jun 1, 2023

Describe the bug

Memory usage increases while the application is running.
The app crashes after a few hours.

Application logic: logOn -> gamesPlayed(440, true) -> createAuthSessionTicket(440) -> idle
With 500+ SteamUser instances.

Versions

4.28.5
18.5.0

Screenshots and Error Logs

C:\snapshot\yet-another-reward\node_modules\steam-user\components\friends.js:978
                        g_ProcessPersonaSemaphore.wait(async (release) => {
                                                       ^

RangeError: Maximum call stack size exceeded
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.5.0

Or:

<--- Last few GCs --->

[5780:000001300C5465C0] 11460942 ms: Mark-sweep 2007.5 (2080.3) -> 1991.5 (2080.3) MB, 3335.5 / 0.5 ms  (average mu = 0.129, current mu = 0.030) allocation failure; scavenge might not succeed
[5780:000001300C5465C0] 11464521 ms: Mark-sweep 2007.5 (2080.3) -> 1991.5 (2080.3) MB, 3337.8 / 0.5 ms  (average mu = 0.099, current mu = 0.067) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
@Sadzurami Sadzurami added the bug label Jun 1, 2023
@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jun 1, 2023

The problem exists even with one instance.
Try to start the instance normally, check the memory usage, then disable the handler here

SteamUserBase.prototype._handlerManager.add(EMsg.ClientPersonaState, function(body) {

A simple immediate return would be enough.
Start the instance and check the memory usage now.

Disabling the EMsg.ClientClanState handler helps with memory leaks and reduces memory usage by 75%.

Before 4.28.4 memory usage was ~50% lower.

@Sadzurami
Copy link
Contributor Author

Behavior similar to
#437

In both cases, semaphores are used.
Maybe the semaphore is not working properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant