FAQ
Reviewers: golang-dev1,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://dvyukov%40google.com@code.google.com/p/go/


Description:
runtime: fix deadlock in network poller
The invariant is that there must be at least one running P or a thread
polling network.
It was broken.
Fixes issue 5216.

Please review this at https://codereview.appspot.com/8459043/

Affected files:
M src/pkg/runtime/proc.c


Index: src/pkg/runtime/proc.c
===================================================================
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -875,6 +875,13 @@
startm(p, false);
return;
}
+ // If this is the last running P and nobody is polling network,
+ // need to wakeup another M to poll network.
+ if(runtime·sched.npidle == runtime·gomaxprocs-1 &&
runtime·atomicload64(&runtime·sched.lastpoll) != 0) {
+ runtime·unlock(&runtime·sched);
+ startm(p, false);
+ return;
+ }
pidleput(p);
runtime·unlock(&runtime·sched);
}


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Bradfitz at Apr 7, 2013 at 3:49 am
    https://codereview.appspot.com/8459043/diff/3/src/pkg/runtime/proc.c
    File src/pkg/runtime/proc.c (right):

    https://codereview.appspot.com/8459043/diff/3/src/pkg/runtime/proc.c#newcode881
    src/pkg/runtime/proc.c:881: runtime·unlock(&runtime·sched);
    same block of code as the one above, if you wanted to combine them.
    it's probably fine for documentation purposes to have them separate,
    though.

    https://codereview.appspot.com/8459043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dvyukov at Apr 7, 2013 at 4:02 am
    https://codereview.appspot.com/8459043/diff/3/src/pkg/runtime/proc.c
    File src/pkg/runtime/proc.c (right):

    https://codereview.appspot.com/8459043/diff/3/src/pkg/runtime/proc.c#newcode881
    src/pkg/runtime/proc.c:881: runtime·unlock(&runtime·sched);
    Yes, that was the intent.
    The conditions and the comment are more important than the 3 trivial
    lines of code.
    And if I combine them and add comments in between, it will be ugly.

    https://codereview.appspot.com/8459043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • R at Apr 7, 2013 at 5:10 am
    LGTM

    https://codereview.appspot.com/8459043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dvyukov at Apr 7, 2013 at 5:28 am
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=34f14e209a2e ***

    runtime: fix deadlock in network poller
    The invariant is that there must be at least one running P or a thread
    polling network.
    It was broken.
    Fixes issue 5216.

    R=golang-dev, bradfitz, r
    CC=golang-dev
    https://codereview.appspot.com/8459043


    https://codereview.appspot.com/8459043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedApr 7, '13 at 3:41a
activeApr 7, '13 at 5:28a
posts5
users3
websitegolang.org

3 users in discussion

Dvyukov: 3 posts Bradfitz: 1 post R: 1 post

People

Translate

site design / logo © 2022 Grokbase