Skip to content
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

Inconsistent error message from is_process_alive #8559

Closed
nathanl opened this issue Jun 10, 2024 · 3 comments · Fixed by #8560
Closed

Inconsistent error message from is_process_alive #8559

nathanl opened this issue Jun 10, 2024 · 3 comments · Fixed by #8560
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Milestone

Comments

@nathanl
Copy link
Contributor

nathanl commented Jun 10, 2024

Describe the bug

is_process_alive/1 can raise the error "not a pid" for a value for which is_pid/1 returns true.
This happens when the pid is not local.

To Reproduce

  1. Start two nodes:
erl -sname one@localhost -setcookie hello

and

erl -sname two@localhost -setcookie hello
  1. Spawn a process on the other node to get a valid remote pid.
(one@localhost)1> Pid = spawn('two@localhost', fun() -> 'hi' end).
<10531.109.0>
  1. Attempt to work with that pid.
(one@localhost)2> is_pid(Pid).
true
(one@localhost)3> is_process_alive(Pid).
** exception error: bad argument
     in function  is_process_alive/1
        called as is_process_alive(<10531.109.0>)
        *** argument 1: not a pid

Expected behavior

The error message should say "not a local pid", or "is a remote pid", or something else that explains why it's not possible to check whether it's alive. "not a pid" is untrue and is inconsistent with the return value from is_pid/1.

Affected versions
Tested with OTP 27.0

@nathanl nathanl added the bug Issue is reported as a bug label Jun 10, 2024
@garazdawi
Copy link
Contributor

The code that prints that value is located here. A PR improving it would be most welcome!

@juhlig
Copy link
Contributor

juhlig commented Jun 12, 2024

Somewhat related, I noticed many wrong error messages in io:format and friends lately, I'll open a separate ticket for those.

@garazdawi garazdawi added this to the OTP-27.1 milestone Jun 18, 2024
@garazdawi
Copy link
Contributor

Fix merged for release in 27.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants