thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dedipyaman Das (Jira)" <>
Subject [jira] [Commented] (THRIFT-4958) TSocket: timed out reading 4 bytes from server:port
Date Thu, 19 Sep 2019 16:47:00 GMT


Dedipyaman Das commented on THRIFT-4958:

Okay, this is completely my fault and it took a while for me to figure it out.

I tried fixing the PHP client and the server side which deals with thrift again and again
and didn't suspect my application logic at all while trying to solve this.

Here's where the problem occurred:

In my model layer, specifically in my repository implementation, I was using JPA entity manager
with C3P0 as my data mapper. I set the max connections to 20 in C3P0.

I forgot to commit the transaction before closing the connection to entitymanager and C3P0
never closed that db connection.

Each of the requests contained 2 queries, so after 10 attempts- I had 2 * 10 = 20 connections
spawned and open. That's when my server stopped responding.

Lesson learned! Always commit your transactions or fallback. Thrift didn't have anything to
do with it. Just the lack of exceptions being thrown at my face.

> TSocket: timed out reading 4 bytes from server:port 
> ----------------------------------------------------
>                 Key: THRIFT-4958
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.12.0
>         Environment: Thrift 0.12: PHP 7.3 with Apache 2.4 on Ubuntu 18.04 , Oracle JDK
>            Reporter: Dedipyaman Das
>            Priority: Critical
>              Labels: bug
>         Attachments: e.bmp
> I have come this error across on my development server while working on a PHP 7.3 client
and Java 8 Server.
> *TSocket: timed out reading 4 bytes from server*:port
> The PHP client is using TFramedTransport with Binary Protocol and the Java server is
using TThreadSelectorServer. The error appeared all of a sudden and doesn't go away unless
I restart the server, and it comes back after a while.
> This issue seems to have been raised at:
and fixed for version 0.6, but it seems to occur for me on version 0.12 - for reasons I don't

This message was sent by Atlassian Jira

View raw message