sys:get_status kills gen_servers registered globally with something other than an atom

Paul Hampson <>
Fri Apr 30 08:13:05 CEST 2010

Using Erlang R13B04, I'm creating gen_servers with gen_server:start( { global, "Name" } ). This is valid according to the gen_server manpage, which states GlobalName is term().

However, if I call sys:get_status({global, "Name"}) (or sys_get:status( global:whereis_name( "Name" ) ) to rule out the name lookup as an issue) the gen_server dies, with:

    exception error: no true branch found when evaluating an if expression
      in function  gen_server:format_status/2
      in call from sys:get_status/5
      in call from sys:do_cmd/6
      in call from sys:handle_system_msg/8

This is because of the following code in gen_server:format_status:

    NameTag = if is_pid(Name) ->
         is_atom(Name) ->
    Header = lists:concat(["Status for generic server ", NameTag]),

Which fails to handle that Name (which is stripped of {global,} in gen_server:name/1 or gen_server:get_proc_name/1) may be something other than an atom or pid.

Interestingly, the comment above gen_server:start/3 indicates that the supplied server name is { global, atom() }, not { global, term() } as per the documentation.

So either the documentation is wrong, or the gen_server implementation/comment is wrong.

Bizarrely, I'm sure I was able to use sys:get_status against these same gen_servers a month ago, which would have been R13B03 or maybe an B13B03, but erlang/otp on github doesn't indicate any relevant changes.

Paul "TBBle" Hampson
Project: Find out what makes things tick
Plan: Stop the ticking...

More information about the erlang-bugs mailing list