Skip to content
This repository

What could be the reason for this crash? #15

Closed
burinov opened this Issue · 1 comment

2 participants

Max Burinov Ulf Wiger
Max Burinov

In code I very often call gproc like this:

handle_cast({msg, To, Message}, State) ->
    spawn(fun() -> 
            % Trying to lookup Pid from gproc
            case gproc:lookup_local_name(To) of
                undefined ->
                    % player is not loaded, loading the player
                    player:start(To, Message);
                Pid ->
                    % player is here, passing the message to him
                    gen_server:cast(Pid, Message)
            end 
        end),
    {noreply, State};
handle_cast(_Msg, State) ->
    {noreply, State}.

In module player I work with grpoc like this:

init([Name]) ->
    % Registering in gproc
    ?LOG("Creating new process", Name),
    gproc:add_local_name(Name),
    {ok, #state{name = Name, ready = 0}}.

From time to time I see something like this in my logs:

=CRASH REPORT==== 8-Jan-2012::01:50:52 ===
  crasher:
    initial call: player:init/1
    pid: <0.19872.4>
    registered_name: []
    exception exit: {badarg,[{gproc,chk_reply,
                                    {reg,{n,l,"player560"},undefined}},
                             {player,init,1},
                             {gen_server,init_it,6},
                             {proc_lib,init_p_do_apply,3}]}
      in function  gen_server:init_it/6
    ancestors: [<0.19870.4>]
    messages: []
    links: []
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 377
    stack_size: 24
    reductions: 164
  neighbours:

What could be the reason for this? Is this because of gproc of my code?

Ulf Wiger
Owner
Ulf Wiger uwiger closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.