Skip to content

Infinite hang when channel incompletely read #144

Closed
@jyasskin

Description

@jyasskin

The following program hangs forever in trying to destroy the to_child chan, because it's waiting for the queue to be emptied by the child, which has completed and will never do so.

io fn incomplete_read(chan[chan[str]] for_incoming_chan) {
  let port[str] incoming = port();
  for_incoming_chan <| chan(incoming);
  auto read_one <- incoming;
  // Never read the second string.
}

io fn main() {
  let port[chan[str]] get_to_child = port();
  auto child = spawn incomplete_read(chan(get_to_child));
  let chan[str] to_child <- get_to_child;
  to_child <| "str 1";
  to_child <| "never read";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions