Skip to content
This repository was archived by the owner on May 19, 2024. It is now read-only.

Fixing huge memory leak. #139

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

azuraerae
Copy link

No description provided.

@aljaxus
Copy link
Member

aljaxus commented May 13, 2023

Sorry, can you explain how would this prevent a "huge memory leak" ?

@azuraerae
Copy link
Author

Sorry, can you explain how would this prevent a "huge memory leak" ?
@aljaxus

The last line called printErrorAndDie no matter how the disconnect happened, even if successful. The issue is that then, in libraries.php, it created a loop, as the curl function did not receive a response, and threw a new printErrorAndDie. This looped until it completely filled the PHP allocated memory, before printing an error in the error.log file of Apache.

@azuraerae
Copy link
Author

By "no matter how the disconnect happened", I mean when the disconnect button was pressed, even if the disconnect was successful, it called an error.

@aljaxus
Copy link
Member

aljaxus commented May 16, 2023

By "no matter how the disconnect happened", I mean when the disconnect button was pressed, even if the disconnect was successful, it called an error.

What do you mean by "disconnect button"? The logout button?


I am a bit confused because there's no keyword "disconnect" in the SkinSystem codebase (so I have no clue what button you're talking about).

@azuraerae
Copy link
Author

Yes, the logout button, I am sorry. Basically, the file I edited (authenCore) takes care of the session, if I understood correctly. But when the session ends, no matter what, the printErrorAndDie function was fired. That caused it to call the curl function, which didn't have a $response and therefore called printErrorAndDie again, looping and filling up memory until it entirely filled the PHP allocated memory (memory leak, basically). The logouts would be painfully long, and also eat up a ton of ram server side.

@aljaxus
Copy link
Member

aljaxus commented May 16, 2023

Yeah took a look and ... this is an issue every time printErrorAndDie is called, not just that instance of it being called at the end of the file?

The problem is that printErrorAndDie calls curl which could call printErrorAndDie which calls curl which could call printErrorAndDie etc...

The problem is not the removed line - it's the interaction between functions printErrorAndDie and curl.

@azuraerae
Copy link
Author

I get that printErrorAndDie calls curl which could itself call printErrorAndDie but on one condition: $response has to be false, and the only case where it happens to be false is with this (genuinely useless) line, since, well, there is no error...

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

Successfully merging this pull request may close these issues.

2 participants