Conversation
gen_server:cast/2 can set the last stacktrace as it will catch the badarg if a locally named process is not registered.
|
The erlang:get_stacktrace/0 function keeps the latest error stacktrace info, no matter what code place it is in. You can try it in the shell, and you can still get the same error info after several code operations, until you make another error in the shell. |
|
@getong I think you misunderstand the issue. |
|
Ther The result is |
|
Thats correct but we want the stacktrace from |
|
To put this in a similar way to your code example, the issue here is that try
gen_server:call(Pool, {checkout, CRef, Block}, Timeout)
catch
Class:Reason ->
A = erlang:get_stacktrace(),
gen_server:cast(Pool, {cancel_waiting, CRef}),
B = erlang:get_stacktrace(),
A == B
end |
|
If |
|
The So any exception raised is caughted, the stacktrace replaced for that process and flow continues. Therefore |
|
Ok, I think you are right, and this pr can be merged. |
|
@fishcakez |
gen_server:cast/2can set the last stacktrace as it will catch thebadargif a locally named process is not registered.