Move scheduler/threadGroup into common-init instead of per-app #12266
pull TheBlueMatt wants to merge 1 commits into bitcoin:master from TheBlueMatt:2018-01-common-init changing 4 files +22 −27-
TheBlueMatt commented at 2:21 am on January 25, 2018: memberThis resolves #12229 which pointed out a shutdown deadlock due to scheduler/checkqueue having been shut down while network message processing is still running.
-
fanquake added the label Refactoring on Jan 25, 2018
-
TheBlueMatt commented at 2:23 am on January 25, 2018: memberNeeds an 0.16 tag.
-
TheBlueMatt force-pushed on Jan 25, 2018
-
sipa added this to the milestone 0.16.0 on Jan 25, 2018
-
in src/init.cpp:158 in 935f287a60 outdated
154@@ -155,7 +155,10 @@ class CCoinsViewErrorCatcher final : public CCoinsViewBacked 155 static std::unique_ptr<CCoinsViewErrorCatcher> pcoinscatcher; 156 static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle; 157 158-void Interrupt(boost::thread_group& threadGroup) 159+boost::thread_group threadGroup;
promag commented at 9:43 am on January 25, 2018:static?in src/init.cpp:159 in 935f287a60 outdated
154@@ -155,7 +155,10 @@ class CCoinsViewErrorCatcher final : public CCoinsViewBacked 155 static std::unique_ptr<CCoinsViewErrorCatcher> pcoinscatcher; 156 static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle; 157 158-void Interrupt(boost::thread_group& threadGroup) 159+boost::thread_group threadGroup; 160+CScheduler scheduler;
promag commented at 9:44 am on January 25, 2018:static?promag commented at 9:45 am on January 25, 2018: memberConcept ACK.Move scheduler/threadGroup into common-init instead of per-app
This resolves #12229 which pointed out a shutdown deadlock due to scheduler/checkqueue having been shut down while network message processing is still running.
TheBlueMatt force-pushed on Jan 25, 2018theuni commented at 11:36 pm on January 26, 2018: memberSince the scheduler is going to need a proper Interrupt/Shutdown before dropping the threadGroup anyway, can we just take this opportunity to create those? Then we could just skip the threadGroup.interrupt_all(), and the .join_all() would finish immediately.
That would be much easier to review, IMO, because it makes the scheduler’s teardown procedure explicit.
laanwj commented at 8:49 am on January 28, 2018: memberThen we could just skip the threadGroup.interrupt_all(), and the .join_all() would finish immediately.
Right - the longer term plan is to rid of ’threadgroup’ completely, by giving each ‘module’ its own Interrupt/Shutdown.
But more often than not, changes to shutdown introduced new problems. I think this is very risky to do this last minute for 0.16.
Is there a more minimalistic, easy to review fix for #12229 that we can do for 0.16, then leave the refactors for 0.17?
TheBlueMatt commented at 2:19 pm on January 29, 2018: memberGiven that threadGroup is only used for scheduler and checkqueue, I’d strongly object to this being more than a rather-minimalistic change. The “obvious, minimalistic” change is to keep the scheduler running until after CConnman has been Stop()ed, which this does, the only additional thing is it keeps the checkqueue running, which is a rather trivial change.promag commented at 9:37 pm on January 29, 2018: memberBut more often than not, changes to shutdown introduced new problems. I think this is very risky to do this last minute for 0.16.
Agree.
Is there a way I can reproduce the issue?
laanwj commented at 8:53 am on January 30, 2018: memberI discussed with @TheBlueMatt on IRC and now I think this is very straightforward - there’s not much left using the thread group (only the scheduler and checkqueue), and anything that removes the global thread group will also need the changes to remove the arguments. So it’s a step forward in that regard.
So utACK 082a61c69d7a539b5a48c4376a657f1c5aa92d81
meshcollider commented at 11:09 am on January 30, 2018: contributorI’m not too familiar with the thread management but this looks straightforward enough for me to at least give a concept ACK / tentative utACK https://github.com/bitcoin/bitcoin/pull/12266/commits/082a61c69d7a539b5a48c4376a657f1c5aa92d81laanwj merged this on Jan 30, 2018laanwj closed this on Jan 30, 2018
laanwj referenced this in commit 3448907a68 on Jan 30, 2018morcos commented at 2:48 pm on January 30, 2018: memberposthumous utACKPastaPastaPasta referenced this in commit 3eff18c572 on Jan 17, 2020PastaPastaPasta referenced this in commit 96e0837b3c on Jan 17, 2020PastaPastaPasta referenced this in commit 3835feecd6 on Feb 12, 2020PastaPastaPasta referenced this in commit 78a45b45df on Feb 12, 2020codablock referenced this in commit bac693df27 on Mar 23, 2020codablock referenced this in commit c01e39d610 on Mar 23, 2020codablock referenced this in commit 4e8f4ea202 on Mar 24, 2020ckti referenced this in commit 63adf464f0 on Mar 28, 2021gades referenced this in commit 540432932e on Jun 30, 2021DrahtBot locked this on Sep 8, 2021
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 09:12 UTC
More mirrored repositories can be found on mirror.b10c.me