-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix checkout stacktrace when noproc #94
base: master
Are you sure you want to change the base?
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/2
can set the last stacktrace as it will catch thebadarg
if a locally named process is not registered.