Elixir: Exception message reported by Task is mixing up PID of task and PID of caller

Created on 8 May 2020  路  2Comments  路  Source: elixir-lang/elixir

Exception message reported by Task is mixing up PID of task and PID of caller in 1.10:

Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> self()                            
#PID<0.108.0>
iex(2)> Task.start(fn -> raise "boom" end)
{:ok, #PID<0.111.0>}
iex(3)> 
18:29:09.767 [error] Task #PID<0.108.0> started from #PID<0.111.0> terminating
** (RuntimeError) boom
    (stdlib 3.10) erl_eval.erl:678: :erl_eval.do_apply/6
    (elixir 1.10.1) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (stdlib 3.10) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Function: #Function<21.126501267/0 in :erl_eval.expr/5>
    Args: []
 ```
This should read: `[error] Task #PID<0.111.0> started from #PID<0.108.0> terminating`

This works correctly on 1.9:
```Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.9.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> self()                            
#PID<0.108.0>
iex(2)> Task.start(fn -> raise "boom" end)
{:ok, #PID<0.111.0>}
iex(3)> 
18:32:09.383 [error] Task #PID<0.111.0> started from #PID<0.108.0> terminating
** (RuntimeError) boom
    (stdlib) erl_eval.erl:678: :erl_eval.do_apply/6
    (elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Function: #Function<21.126501267/0 in :erl_eval.expr/5>
    Args: []
Elixir Bug Intermediate

All 2 comments

Hey, I would gladly open up a pull-request and take care of it !

Please do! Also please include a test if possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josevalim picture josevalim  路  33Comments

josevalim picture josevalim  路  41Comments

michalmuskala picture michalmuskala  路  35Comments

josevalim picture josevalim  路  27Comments

josevalim picture josevalim  路  41Comments