Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  sys:get_status kills gen_servers registered globally with so

Guest
Posted: Fri Apr 30, 2010 7:13 am Reply with quote
Guest
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) ->
pid_to_list(Name);
is_atom(Name) ->
Name
end,
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...

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum