title: Timeout error in recursive call of handle_call/3 of behaviour(gen_server), Erlang/OTP
body: <p>I'm trying to make a recursive call to handle_call/3 before replying.
  But it seems to not be possible, because a <code>timeout</code> exit exception is thrown.
  Below you can see the code and the error.</p>
  
  <p>The code:</p>
  
  <pre><code>-module(test).
  -behavior(gen_server).
  
  %% API
  -export([start_link/0,init/1,handle_info/2,first_call/1,second_call/1, handle_call/3, terminate/2]).
  
  -record(state, {whatever}).
  
  start_link() -&gt;
    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  init(_Args) -&gt;
    {ok, #state{}}.
  
  handle_info(Data, State) -&gt;
    {noreply, State}.
  
  % synchronous messages
  handle_call(_Request, _From, State) -&gt;
    case _Request of
      first_call -&gt;
        {reply, data1, State};
      second_call -&gt;
        {reply, {data2, first_call(self())}, State}
    end.
  
  first_call(Pid) -&gt;
    gen_server:call(Pid, first_call).
  
  second_call(Pid) -&gt;
    gen_server:call(Pid, second_call).
  
  terminate(_Reason, _State) -&gt;
    ok.
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>2&gt; {_, PID} = test:start_link().
  {ok,&lt;0.64.0&gt;}
  3&gt; test:second_call(PID).
  ** exception exit: {timeout,{gen_server,call,[&lt;0.64.0&gt;,second_call]}}
       in function  gen_server:call/2 (gen_server.erl, line 204) 
  </code></pre>
  
  <p>A possible reason for this behaviour is that gen_server is not able to handle recursive calls until the first one is done (creating a deadlock). Is this the right reason, and if yes why? 
  Thanks.</p>