usually, this sort of thing happens because the server has a recv timeout
set. I see that thrift_socket_server sets a recv timeout, but I can't tell
if thrift_server is doing so. One possibility might be to put some debugging
code in thrift_processor to determine if it is terminating and closing the
connection.
I'm not sure if thrift_server is supposed to be deprecated in favor of
thrift_socket_server. Chris Piro or Todd Lipcon might know.
--David
On 08/12/2010 10:22 PM, Anthony Molinaro wrote:
> Hi,
>
> I'm trying to use pg2 to cache several thrift client connections so I
> can spread load across them. This seems to work great however, the
> connections seem to go stale, I think the server is dropping them, however
> looking through the thrift code is seems like keepalive is true, so I'm
> not sure why this would be the case.
>
> I start my server with
>
> thrift_server:start_link/3
>
> and the client processes are started with
>
> thrift_client:start_link/3
>
> The process stays alive fine on the client, but goes away after about
> 30 seconds or so on the server (probably less they seem to go away
> quick). Since the client is alive, when I do a call I get this
> exception.
>
> {{case_clause,{error,closed}},
> [{thrift_client,read_result,3},
> {thrift_client,catch_function_exceptions,2},
> {thrift_client,handle_call,3},
> {gen_server,handle_msg,5},
> {proc_lib,init_p_do_apply,3}]}
>
> Is there anyway to keep this from happening?
>
> Thanks,
>
> -Anthony
>