Skip to content

[DC-30] fix: memory leak and general cleanup of AccountSettings - #12146

Merged
modSpike merged 19 commits into
masterfrom
work/fixSevereMemoryLeak
Apr 28, 2025
Merged

modSpike merged 19 commits into
masterfrom
work/fixSevereMemoryLeak

Conversation

@modSpike

Copy link
Copy Markdown
Contributor

see item #13 in the refactoring todo list

short story is: we almost always create a new ConnectionValidator when checkConnectivity is run. Fun part is that in addition to being called explicitly here and there, it also auto-runs in a polling pattern. In some cases the pointer is cleaned up but what I see when I break on the "new" for that ptr is that it's only null the very first time I hit it (eg when creating a new account)

@update-docs

update-docs Bot commented Apr 17, 2025

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@modSpike modSpike self-assigned this Apr 17, 2025
@modSpike
modSpike marked this pull request as draft April 17, 2025 10:43
@modSpike

modSpike commented Apr 17, 2025 •

Copy link
Copy Markdown
Contributor Author

added mystery:

we do have a check earlier in the code that should just return/skip creation of a new validator if the current validator is not null.

for completely unknown reasons the debugger only very rarely ends up returning via this trap, so it very frequently goes on to create a new validator even though it appears to be a non-null pointer already. Yes, indeed Erik saw this on his machine too - I'm not crazy - but the behavior is completely inexplicable.

New tack will be to replace the already low value use of qpointer with just a normal raw pointer so we don't have to worry about some subtle weirdness related to that.

and I will also start refactoring this function to JUST DO ONE THING instead of this, that and the other thing (including not only creating a new validator, but also adding the connections with plenty of lambdas inside lambdas)

fingers crossed that once it's simplified it behaves in a more reasonable way.

modSpike added 13 commits April 17, 2025 14:23
…ng a new validator unless the member is actually null.

I will clean up a bit more now.
… we use normal RAII to manage this resource.

SO much healthier (especially in the AccountState impls)

also moved various connections to dedicated connectXXX methods. this not only makes the ctr much easier to read, but in future we may want to connect at a different point in time, OUTSIDE the ctr. now we can move them around super easily.

next step is obliterating the lambdas...after a nice long easter break I should have the energy for this again.
…ions

also refactored the very strangely implemented dialog to confirm updating the url after a server redirect. I still need to find a way to test that but coceptually this is now cleaned up A LOT
got rid of the supportsSpaces property as it had a weird notification for "supportsSpacesChanged" that made no sense, then I could not find anyone using the property anyway. Goodbye!
put the mysterious property that requires a "supportsSpacesChanged" signal back, as removing that broke the bottom area of the account settings page
… the handling of the updated certificate acceptance dialog
@modSpike
modSpike marked this pull request as ready for review April 25, 2025 09:23
Comment thread src/gui/accountstate.cpp Resolved
Comment thread src/gui/accountstate.cpp Resolved
@modSpike

Copy link
Copy Markdown
Contributor Author

hello @saw-jan and @ishabaral I would like to ask for help with the test failure. since my last "real" commit (which passed) it has failed twice, once on a test related to syncing a file with special characters in the name, and once on a file with a very long name (but in that case the test with special chars passed). I'm really confused about what is actually happening there. I also see what look like some connection failures but not sure if those are expected or indicate some other problem.

any info is appreciated.

@saw-jan

saw-jan commented Apr 28, 2025

Copy link
Copy Markdown
Member

hello @saw-jan and @ishabaral I would like to ask for help with the test failure. since my last "real" commit (which passed) it has failed twice, once on a test related to syncing a file with special characters in the name, and once on a file with a very long name (but in that case the test with special chars passed). I'm really confused about what is actually happening there. I also see what look like some connection failures but not sure if those are expected or indicate some other problem.

any info is appreciated.

it was a flaky failure. I have restarted the build and it's green now.
we will look at how to harden those tests (might be flaky in sync check). THank you!

@modSpike modSpike changed the title we have a doozy of a memory leak in AccountSettings::checkConnectivity [DC-30] fix: memory leak and general cleanup of AccountSettings Apr 28, 2025
Comment thread src/gui/accountstate.cpp Resolved
Comment thread src/gui/owncloudgui.cpp Resolved
@modSpike
modSpike enabled auto-merge (squash) April 28, 2025 10:48
@modSpike
modSpike merged commit 24ae284 into master Apr 28, 2025
@modSpike
modSpike deleted the work/fixSevereMemoryLeak branch April 28, 2025 11:12
seleonovich added a commit to CSG-Development/owncloud-client that referenced this pull request Jul 22, 2025
Original:
24ae284 ("[DC-30] fix: memory leak and general cleanup of AccountSettings (owncloud#12146)", 2025-04-28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants