Why does pg:which_groups() fail with bad_arg when no groups exist?
Minimal example:
Eshell V13.0 (abort with ^G)
1> pg:which_groups().
** exception error: bad argument
in function ets:match/2
called as ets:match(pg,{'$1','_','_'})
*** argument 1: the table identifier does not refer to an existing ETS table
in call from pg:which_groups/1 (pg.erl, line 186)
2>
start_link() -> {ok, pid()} | {error, any()}
Starts the default pg scope within supervision tree. Kernel may be configured to do it automatically, see kernel(6) configuration manual.
I know that I must start pg scope, but I’m asking why… I’m asking for a difference between pg groups and groups used by erts because that confuses me… Even if pg is not started, you can ask for group_leader for your process which handles your IO. So what is the difference between those groups and is there any documentation on this subject?
There is no specific reason, it’s just my oversight.
I agree that the error makes no sense, essentially leaking internal implementation (ETS used to speed up/make more concurrent access). Correct error should be something like “scope is not started”. Thanks for reporting, let me some time to fix it.