[erlang-questions] [gen_server] time out error when handle_call returns {noreply, State}

Marcin Maciukiewicz ciukes2@REDACTED
Wed May 28 09:37:37 CEST 2008


Thank both of you guys for help. So far I understand what you say, but
I'm not sure how it may help.
In the following code, last executed line is #14. After that VM hangs
for 5 sec thus I don't see a reasonable place to put
gen_server:reply/2. call.
http://pastebin.com/f590f0e00

I feel I need an extra push to understand. The reason why I play with
{noreply, State} is because I want to understand how to deal with this
case.

Regards,
Marcin.

On Wed, May 28, 2008 at 12:58 AM, Taavi Talvik <taavi@REDACTED> wrote:
>
> On May 28, 2008, at 1:14 AM, Marcin Maciukiewicz wrote:
>
>> Hi,
>>
>> This are my first steps in Erlang World. So far I'm stuck with
>> gen_server:Module:handle_call/3.
>> I get time out every time when {noreply, State} is returned. Following
>> are code snippets:
>> * Server module: http://pastebin.com/f590f0e00
>
> alloc(Pid) -> gen_server:call(?MODULE, {alloc, Pid}, infinity).
>
> handle_call({alloc, Pid}, From, State) ->
>   ... some logic to save caller information From..
>   {noreply, State}.
>
> and somwhere else in code
>
> gen_server:reply(From, finally_my_answer_is_ready).
>
>
> or
>
> handle_call({alloc, Pid}, From, State) ->
>   {reply, my_answer_is_allready_available, State}.
>
> if you can answer immediately.
>
> best regards,
> taavi
>



More information about the erlang-questions mailing list