[CONJ-538] Could not read resultset: unexpected end of stream, read 0 bytes from 4 Created: 2017-10-12 Updated: 2019-07-06 Resolved: 2017-10-13 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Vladimir Kiselev | Assignee: | Diego Dupin |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Client: Oracle Java 1.8.0_121 |
||
| Issue Links: |
|
||||||||
| Description |
|
java.sql.SQLNonTransientConnectionException: (conn=27949) Could not send query: unexpected end of stream, read 0 bytes from 4 |
| Comments |
| Comment by Vladimir Kiselev [ 2017-10-13 ] |
|
Please close! |
| Comment by Diego Dupin [ 2017-10-13 ] |
|
Hi, I'll not close it, because Error message could be improved with a "connection closed by server". |
| Comment by Diego Dupin [ 2017-10-13 ] |
|
Another task is created to improve error message |
| Comment by Jeffrey N Dyke [ 2018-02-20 ] |
|
Just want to add a comment b/c i ran into this exact error and was confused by it. In my case a connection was opened an initial query , another function ran that took a while and then i tried to use that connection again, but it failed to reach the server b/c of the timeout as stated, so consider what is being done in between your two database calls if you see this. Hope this helps someone that stumbles on this. |
| Comment by Reece [ 2019-07-06 ] |
|
Yip - also going to chime in cause this is the top ranked google result for this error. Kinda feel like a noob for saying this - but for me; I was doing bulk inserts (about 300k); e.g. a bunch of inserts inside a for/while loop; and didn't realize with the MariaDB connector (maybe all JDBC connectors?) you need to close your PreparedStatements and ResultSets after each use before re-assigning them; otherwise it creates a memory leak. I always figured that try, catch, finally (closing in finally) was enough; e.g. like re-assigning any other reference in Java to a variable, that the garbage collector would free things up for you. Ran my app while also running the linux 'top' command in another window, watched MariaDB memory consumption steadily climb to 60% of total memory in a minute or two and then this error popped up. After adding additional close statements throughout my loops, went away immediately; running the same code again, MariaDB memory consumption only climbed as high as 1.5% of total system resources. |