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

Paul Fisher pfisher@REDACTED
Wed May 28 14:37:47 CEST 2008


On Wed, 2008-05-28 at 14:07 +0200, Marcin Maciukiewicz wrote:
> At the end of the day I want to learn the answers to following questions:
>  - Why/When use {noreply, State} in handle_call

When you want to either: 1) not respond to the caller, forcing a timeout
(usually in the case of a bad request); or 2) respond asynchronously
from the return from the handle_call in order to allow the general
server to continue to process requests while some other process is
processing and generating the reply to the call (which it will respond
to with gen_server:reply)


>  - How to write proper code for this value returned - you gave me a
> lot of input on that, thank you.

>From the caller side, if the server is responding according to option #1
above, then you cannot do much more than you are doing now... the
timeout will occur.  If the server is responding according to option #2
above then you *may* just need to give it more time to respond, in which
case you use the gen_server:call variety that allows you to specify a
timeout.


>  - Why the heck psql:handle_call({allocate,Pid}... ) from
> erlang-psql-driver is not working.

Maybe taking a long time?  Someone familiar with the code will have to
comment.


--
paul




More information about the erlang-questions mailing list