Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Sep 20, 2021

Cleaning code redundancies from the "restart with args" process.

@furszy furszy added the GUI label Sep 20, 2021
@furszy furszy added this to the 5.4.0 milestone Sep 20, 2021
@furszy furszy self-assigned this Sep 21, 2021
@furszy
Copy link
Author

furszy commented Sep 24, 2021

zebra's feedback tackled.

@furszy furszy force-pushed the 2021_clean_restart branch from b1014aa to 5a7b6f0 Compare October 3, 2021 15:15
@Fuzzbawls
Copy link
Collaborator

Mostly ACK, but i've noticed what looks to be a race condition with the directory locks not always being released before the restart happens. this behavior isn't introduced in this PR itself, but since we're on the subject of the restart process, this is as good a place to address it.

Simply adding a call to ReleaseDirectoryLocks() at the end of Shutdown() in init.cpp has show to clear up the issue for me

@furszy
Copy link
Author

furszy commented Oct 13, 2021

yeah, good catch.
I started doing this cleanup to investigate the race condition but stopped once i saw the ugly CExplicitNetCleanup::callCleanup function and all the other stuff that cleaned..
it's all related to the same cause: the restart functionality, as it was coded, starts a new process at the same time that the running process is being stopped, so there is a race condition over every shared resource (not only the dirs locks, there could be others).

Better to spend a bit more time looking for a cleaner way of doing the restart before moving forward with the introduction of another manual resource cleanup only for the restart flow and search if there is any other static field that is destructed/released at the program's exit that can be affected by this function's behavior. It smells bad.

@furszy furszy force-pushed the 2021_clean_restart branch from 5a7b6f0 to d3d8e1e Compare November 23, 2021 20:42
@furszy
Copy link
Author

furszy commented Nov 23, 2021

rebased on master, conflicts solved. Ready.

@random-zebra
Copy link

The comment before Shutdown(), mentioning the skip of PrepareShutdown() in case of restarts is now outdated.
In fact, we don't even need two separated steps anymore (can pick here if you want random-zebra@030d037)

Side note: #2646 will be rebased (removing RestartRequested()) after this PR and #2641 are merged. We could include that one too for 5.4 as it's very simple.

@furszy
Copy link
Author

furszy commented Nov 24, 2021

yeah, added your commit zebra. Further cleanups are more than welcome 👌. This process was full of redundancies.

all good for me to add #2646 to v5.4 as well. Let's just do it after branching off and starting the public testing phase.

@random-zebra random-zebra added Cleanup Refactoring Startup Wallet startup changes and/or improvements labels Nov 24, 2021
@furszy furszy requested a review from Fuzzbawls November 24, 2021 14:05
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a2de5cd

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a2de5cd

@random-zebra random-zebra merged commit b5b7431 into PIVX-Project:master Nov 25, 2021
@furszy furszy deleted the 2021_clean_restart branch November 29, 2022 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup GUI Refactoring Startup Wallet startup changes and/or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants