erlang - gen_server:call causes server to crash with a noproc -


i have simple server (below). can create server cell_tracer:start_link() , works; know because when repeat same call, already_started error. problem after server created, using cell_tracker:get_cells() (or doing gen_server:call(...)) on causes server exit exception this:

** exception exit: {noproc,{gen_server,call,[cell_tracker,get_cells]}}      in function  gen_server:call/2 (gen_server.erl, line 180) 

i can call handle_call(get_cells...) directly, , expected result.

i'm not sure what's happening here. doesn't give me information work with, , don't see problem. how can dig further?

-module(cell_tracker). -behavior(gen_server). -export([start_link/0, stop/0]). -export([add_cell/1, del_cell/1, get_cells/0]). -export([init/1,          handle_cast/2,          handle_call/3,          terminate/2,          handle_info/2,          code_change/3]).  %% operational api start_link() ->   gen_server:start_link({global, ?module}, ?module, [], []).  stop() ->   gen_server:cast(?module, stop).  %% traking api  add_cell(cell) ->   gen_server:call(?module, { add_cell, cell }).  del_cell(cell) ->   gen_server:call(?module, { del_cell, cell }).  get_cells() ->   gen_server:call(?module, get_cells).  %% gen_server callbacks  init(coords) ->   {ok, coords}.  handle_cast(stop, coords) ->   {stop, normal, coords}.  handle_call({add_cell, cell}, _from, cells) ->   {reply, ok, [cell|cells]}; handle_call({del_cell, cell}, _from, cells) ->   {reply, ok, cells -- cell}; handle_call(get_cells, _from, cells) ->   {reply, cells, cells}.  terminate(unnormal, _state) -> ok.  handle_info(_,_) -> ok. code_change(_,state,_) -> {ok, state}. 

register server locally

start_link() ->   gen_server:start_link({local, ?module}, ?module, [], []). 

or if register {global, ?module} cast, call {global, ?module}

see gen_server


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -