Skip to content

Commit

Permalink
Merge branch 'dgud/runtime_tools/observer-port-crash/erlangGH-7735/OT…
Browse files Browse the repository at this point in the history
…P-18868' into maint

* dgud/runtime_tools/observer-port-crash/erlangGH-7735/OTP-18868:
  Fix port crash
  • Loading branch information
dgud committed Nov 20, 2023
2 parents a2d31b7 + abafcba commit c31eabd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/runtime_tools/src/observer_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,21 @@ get_mnesia_loop(Parent, {Match, Cont}) ->

get_port_list() ->
ExtraItems = [monitors,monitored_by,parallelism,locking,queue_size,memory],
[begin
[{port_id,P}|erlang:port_info(P)] ++
port_info(P,ExtraItems) ++
inet_port_extra(erlang:port_info(P, name), P)
end || P <- erlang:ports()].
PortInfo =
fun(P, Acc) ->
case erlang:port_info(P) of
undefined ->
Acc;
Info ->
[
[{port_id,P}|Info] ++
port_info(P,ExtraItems) ++
inet_port_extra(erlang:port_info(P, name), P)
| Acc ]
end
end,
PIs = lists:foldl(PortInfo, [], erlang:ports()),
lists:reverse(PIs).

port_info(P,[Item|Items]) ->
case erlang:port_info(P,Item) of
Expand Down

0 comments on commit c31eabd

Please sign in to comment.