Task.async_stream, timeout: :infinity and 1.5.0

Hi,

Under 1.4.5 this works:

Interactive Elixir (1.4.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Task.async_stream([1], fn _ -> :ok end, timeout: :infinity) |> Enum.to_list
[ok: :ok]

Under 1.5 it’s throwing an error:

Interactive Elixir (1.5.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Task.async_stream([1], fn _ -> :ok end, timeout: :infinity) |> Enum.to_list
** (EXIT from #PID<0.88.0>) evaluator process exited with reason: an exception was raised:
    ** (ArgumentError) argument error
        :erlang.send_after(:infinity, #PID<0.90.0>, {:timeout, {#Reference<0.2253183411.927727617.70572>, #Reference<0.2253183411.927727617.70577>}})
        (elixir) lib/task/supervised.ex:408: Task.Supervised.stream_monitor_loop/2


23:05:13.491 [error] Process #PID<0.90.0> raised an exception
** (ArgumentError) argument error
    :erlang.send_after(:infinity, #PID<0.90.0>, {:timeout, {#Reference<0.2253183411.927727617.70572>, #Reference<0.2253183411.927727617.70577>}})
    (elixir) lib/task/supervised.ex:408: Task.Supervised.stream_monitor_loop/2
2 Likes

A regression indeed, and looking at the code in 1.5 it is obvious why :slight_smile: Will submit a PR …

https://github.com/elixir-lang/elixir/pull/6382

edit: aaaaaaaand fixed. ~13 seconds after the PR was picked up for the automated checks, @josevalim merged it into master. Faster than a speeding bullet.

2 Likes

Yep just ran into this. awesome how fast it’s fixed :slight_smile: