[CONJ-348] Could not read resultset: unexpected end of stream, read 0 bytes from 4 Created: 2016-09-13  Updated: 2017-01-29  Resolved: 2016-12-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.7, 1.4.6, 1.5.2
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Juraj Wagner Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Client: OS X 10.11.6 with Oracle Java 1.8.0_102
Server: Oracle Linux 6.8 (x64) running MariaDB 10.1.16


Attachments: File UnexpectedEndOfStreamError.java    
Issue Links:
Blocks
is blocked by MDEV-11935 Queries in stored procedures with and... Closed
Problem/Incident
is caused by MDEV-7691 Assertion `outer_context || !*from_fi... Closed

 Description   

Observed behavior:
The attached UnexpectedEndOfStreamError class fails with following:

Exception in thread "main" java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
Query is: SELECT a.AID FROM A a WHERE EXISTS (SELECT 1 FROM V v WHERE a.AID = v.AID)
at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:123)
at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69)
at org.mariadb.jdbc.MariaDbStatement.executeQueryEpilog(MariaDbStatement.java:226)
at org.mariadb.jdbc.MariaDbServerPreparedStatement.executeInternal(MariaDbServerPreparedStatement.java:376)
at org.mariadb.jdbc.MariaDbServerPreparedStatement.execute(MariaDbServerPreparedStatement.java:323)
at org.mariadb.jdbc.MariaDbServerPreparedStatement.executeQuery(MariaDbServerPreparedStatement.java:304)
at UnexpectedEndOfStreamError.executeTestQuery(UnexpectedEndOfStreamError.java:56)
at UnexpectedEndOfStreamError.runTest(UnexpectedEndOfStreamError.java:49)
at UnexpectedEndOfStreamError.main(UnexpectedEndOfStreamError.java:28)
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not read resultset: unexpected end of stream, read 0 bytes from 4
Query is: SELECT a.AID FROM A a WHERE EXISTS (SELECT 1 FROM V v WHERE a.AID = v.AID)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1054)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.prepareAndExecute(AbstractQueryProtocol.java:544)
at org.mariadb.jdbc.MariaDbServerPreparedStatement.executeInternal(MariaDbServerPreparedStatement.java:365)
... 5 more
Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4
at org.mariadb.jdbc.internal.packet.read.ReadPacketFetcher.getReusableBuffer(ReadPacketFetcher.java:164)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1045)
... 7 more

The code runs without issues when using MySQL Connector/J 5.1.39 and MariaDB Connector/J version 1.2.3 and 1.1.9.



 Comments   
Comment by Diego Dupin [ 2016-09-14 ]

Issue confirmed.
This is a server issue. I'll create an issue about this problem.
(reproduced too with mysql driver when using binary protocol (option useServerPrepStmts=true&cacheCallableStmts=true) which is default on mariadb driver)

Comment by Diego Dupin [ 2016-09-14 ]

this occur when using view in a subquery on second execution for a preparedStatement. see link MDEV-7691 issue.
This can be avoided setting option useServerPrepStmts=false.
Thanks for reporting !

Comment by Juraj Wagner [ 2016-09-14 ]

Thought that I tried setting useServerPrepStmts=false but probably mis-typed the URL. Thanks for the information!

Comment by Ruslanas [ 2016-09-26 ]

Hi,

Is there separate ticket for that in MariaDB server JIRA to watch? We also have same issue and obviously this is server issue.

Comment by Diego Dupin [ 2016-12-21 ]

closed, since issue MDEV-7691 is closed

Comment by Juraj Wagner [ 2016-12-23 ]

Hi Diego,

see you marked this as not a bug. This is to say that the defect is not in the CONJ component but on the server side (i.e. MDEV-7691), correct?

Looking at MDEV-7691 I see that this bug is going to be resolved in 5.5.54. But what about the other versions (e.g. current stable version 10.1)?

regards,
Juraj

Comment by Diego Dupin [ 2016-12-23 ]

Hi, you are right : it's not a bug for this task, but it is server side.
It will be merge with next 10.1 release, (10.1.21 so).

Generated at Thu Feb 08 03:15:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.