Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors from sql-server #4827

Closed
ericmock opened this issue Nov 18, 2022 · 9 comments
Closed

Errors from sql-server #4827

ericmock opened this issue Nov 18, 2022 · 9 comments
Labels
bug Something isn't working integrations Issues with tools connecting to/querying Dolt sql server Issues related to the built in SQL server

Comments

@ericmock
Copy link

ericmock commented Nov 18, 2022

This may just be the particular Java connection layer I'm using, but when I do:

select homepage_url, count(*) as cnt from hospitals h where chargemaster_indirect_url is null group by homepage_url;

everything is fine. However, when I do

select homepage_url, count(*) as cnt from hospitals h where chargemaster_indirect_url is null group by homepage_url order by cnt;

I get "Socket error"

@fulghum
Copy link
Contributor

fulghum commented Nov 18, 2022

Thanks for reporting this one @ericmock. Can you share any more details about the Java connection layer you're using? Is it just over the standard MySQL ConnectorJ JDBC library, or is there another library/tool in there somewhere?

@jennifersp – could you try to repro this one today? Adding it to the client integration tests could be an easy way to run it over a JDBC connection.

@ericmock
Copy link
Author

ericmock commented Nov 18, 2022

I'm just using DBeaver (on Manjaro). The error log is below if it's useful. Since updating to the latest version, I'm seeing this quite often (but seemingly randomly). This was one case where I could reliably reproduce.

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [08000]: (conn=114) Socket error
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:578)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:487)
	at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:173)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:494)
	at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:913)
	at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3726)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:123)
	at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:173)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:121)
	at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4982)
	at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLNonTransientConnectionException: (conn=114) Socket error
	at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:291)
	at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:357)
	at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:856)
	at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:772)
	at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:691)
	at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:634)
	at org.mariadb.jdbc.Statement.executeInternal(Statement.java:935)
	at org.mariadb.jdbc.Statement.execute(Statement.java:1061)
	at org.mariadb.jdbc.Statement.execute(Statement.java:452)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:329)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.lambda$0(JDBCStatementImpl.java:131)
	at org.jkiss.dbeaver.utils.SecurityManagerUtils.wrapDriverActions(SecurityManagerUtils.java:96)
	at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
	... 12 more
Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
	at org.mariadb.jdbc.client.socket.impl.PacketReader.readPacket(PacketReader.java:78)
	at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:118)
	at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:833)
	... 22 more

@timsehn timsehn added bug Something isn't working integrations Issues with tools connecting to/querying Dolt sql server Issues related to the built in SQL server labels Nov 18, 2022
@fulghum
Copy link
Contributor

fulghum commented Nov 18, 2022

Perfect! This is super helpful; thank you! We'll try to repro with DBeaver. I also notice that DBeaver is using the MariaDB JDBC driver. We have Java tests with the MySQL ConnectorJ driver, but I'm not sure that we have tests for the MariaDB driver. We'll look into adding that as well.

@ericmock
Copy link
Author

FYI...

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [08S01]: Communications link failure

The last packet successfully received from the server was 6 milliseconds ago. The last packet sent successfully to the server was 7 milliseconds ago.
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:578)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:487)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:173)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:494)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:913)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3726)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:123)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:173)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:121)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4982)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet successfully received from the server was 6 milliseconds ago. The last packet sent successfully to the server was 7 milliseconds ago.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:763)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:329)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.lambda$0(JDBCStatementImpl.java:131)
at org.jkiss.dbeaver.utils.SecurityManagerUtils.wrapDriverActions(SecurityManagerUtils.java:96)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
... 12 more
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet successfully received from the server was 6 milliseconds ago. The last packet sent successfully to the server was 7 milliseconds ago.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:581)
at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:761)
at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:700)
at com.mysql.cj.protocol.a.NativeProtocol.sendQueryPacket(NativeProtocol.java:1051)
at com.mysql.cj.protocol.a.NativeProtocol.sendQueryString(NativeProtocol.java:997)
at com.mysql.cj.NativeSession.execSQL(NativeSession.java:663)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:723)
... 17 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67)
at com.mysql.cj.protocol.a.SimplePacketReader.readHeaderLocal(SimplePacketReader.java:81)
at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63)
at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45)
at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:52)
at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:41)
at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:54)
at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:44)
at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:575)
... 23 more

@ericmock
Copy link
Author

Same issue. Works without the order by but not with it.

@jennifersp
Copy link
Contributor

Hi @ericmock, thank you for issuing this bug! I found where the issue is coming from and will get the fix in as soon as I can.

@jennifersp
Copy link
Contributor

jennifersp commented Nov 18, 2022

The fix will be merged into dolt very soon, and it will be out in the next Dolt release. A workaround for this bug is that you can set arbitrary limit (that is bigger than the number of query result) without offset for the query; for example,

select homepage_url, count(*) as cnt from hospitals h where chargemaster_indirect_url is null group by homepage_url order by cnt limit 5000;

@ericmock
Copy link
Author

Great work!

@jennifersp
Copy link
Contributor

Fixed by dolthub/go-mysql-server#1414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integrations Issues with tools connecting to/querying Dolt sql server Issues related to the built in SQL server
Projects
None yet
Development

No branches or pull requests

4 participants