Skip to content
Permalink
Browse files

Fix hang in Channel subscribe/close/drain

When we polled a Channel, we forgot to re-insert the CLOSE or FAIL
message. This meant that under certain use patterns, such as when we
had a subscription to a Channel, closed it, and then tried to drain it
with a `for` loop, we could get a hang, since the draining loop never
saw the CLOSE message.
  • Loading branch information...
jnthn committed Jan 14, 2019
1 parent 5fcba5b commit 9b77459b8d7d94e446607e13880202f3fb7ca236
Showing with 3 additions and 0 deletions.
  1. +2 −0 src/core/Channel.pm6
  2. +1 −0 t/spectest.data
@@ -78,12 +78,14 @@ my class Channel does Awaitable {
nqp::istype(msg, CHANNEL_CLOSE),
nqp::stmts(
$!closed_promise_vow.keep(Nil),
nqp::push($!queue, msg),
Nil
),
nqp::if(
nqp::istype(msg, CHANNEL_FAIL),
nqp::stmts(
$!closed_promise_vow.break(msg.error),
nqp::push($!queue, msg),
Nil
),
msg
@@ -836,6 +836,7 @@ S16-io/words.t
S16-unfiled/rebindstdhandles.t
S17-channel/basic.t
S17-channel/stress.t # stress slow
S17-channel/subscription-drain-in-react.t
S17-lowlevel/atomic.t # moar
S17-lowlevel/atomic-ops.t # moar
S17-lowlevel/cas.t

0 comments on commit 9b77459

Please sign in to comment.
You can’t perform that action at this time.