You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Vic Ricker <vi...@ricker.us> on 2008/04/08 17:16:47 UTC
A network protocol error was encountered and the connection has been
terminated
Can anyone give me any suggestions on how to debug this issue? A user
is randomly seeing the following exception while connected to a Derby
network server. I'm not sure what the exception means. It sounds like
there may have been a network error? The user is connected locally to
the server over a LAN. I don't think it's likely that the network
connection was interrupted. Unfortunately, he can't reproduce it
consistently.
The exception does not always occur at the same location in our code.
The only common denominator seems to be a call to Derby's
Connection.prepareStatement() method.
We've tried enabling tracing on the client but didn't see anything
useful in the log.
I gave the user the Derby debug libs and had him work with the software
until he cause the error again. The query being prepared in this
instance is very simple, "SELECT * FROM strategylots WHERE objectid=?"
java.sql.SQLException: A network protocol error was encountered and the
connection has been terminated: the requested command encountered an
unarchitected and implementation-specific condition for which there was
no architected message
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:46)
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
org.apache.derby.client.am.Connection.prepareStatement(Connection.java:426)
com.scs.database.sql.MoneyDatabaseSQLType.prepareStatement(MoneyDatabaseSQLType.java:2235)
com.scs.database.sql.MoneyDatabaseSQLType.getEntry(MoneyDatabaseSQLType.java:2382)
com.scs.money.transaction.InvestmentTransaction.getExplicitSlot(InvestmentTransaction.java:828)
com.scs.money.transaction.InvestmentTransaction.getStrategyLot(InvestmentTransaction.java:515)
com.scs.money.holding.Holding.recalculateStrategies(Holding.java:341)
com.scs.money.holding.Holding.doRecalulate(Holding.java:1260)
com.scs.money.holding.Holding.recalculateQuantity(Holding.java:851)
com.scs.money.holding.Holding.addByTransaction(Holding.java:1408)
com.scs.money.data.OptionTradeEntry.post(OptionTradeEntry.java:155)
com.scs.money.data.DataImportEntry.post(DataImportEntry.java:147)
com.scs.money.data.DataProcessPanel.doImport(DataProcessPanel.java:245)
com.scs.money.data.DataProcessPanel.access$000(DataProcessPanel.java:19)
com.scs.money.data.DataProcessPanel$1.process(DataProcessPanel.java:52)
com.scs.money.TaskedJob.process(TaskedJob.java:19)
com.scs.money.TaskedJob$1.processTask(TaskedJob.java:33)
com.scs.taskmanager.TaskManager.cycle(TaskManager.java:71)
com.scs.taskmanager.TaskManager.run(TaskManager.java:23)
Any help would be appreciated.
-Vic
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Øystein Grøvlen <Oy...@Sun.COM>.
Vic Ricker wrote:
> Sorry about that. I added something to dump follow getNextException()
> and getCause(). I got the following exception from getCause(), I
> believe. I don't think getNextException() returned anything.
>
> org.apache.derby.client.am.DisconnectException: A network protocol error
> was encountered and the connection has been terminated: the requested
> command encountered an unarchitected and implementation-specific
> condition for which there was no architected message
> org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(NetConnectionReply.java:888)
Have you checked the derby.log file? If the server has detected any
error, it should be reported in this file.
--
Øystein
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Vic Ricker <vi...@ricker.us>.
I want to thank everyone for their help. We believe we've found the
problem. I suspect that our previous attempt to trace was corrupt (It
had about 350M of nulls at the end.) since the error sticks out like a
sore thumb.
I assume increasing the number of file handles will solve the problem.
Here's the relevant part of the trace:
[derby]
[net][time:1207921858092][thread:AWT-EventQueue-0][tracepoint:2][Reply.fill]
[derby] RECEIVE BUFFER: CMDCHKRM (ASCII)
(EBCDIC)
[derby] 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0123456789ABCDEF
[derby] 0000 0010D0520001000A 1254000611490080 ...R.....T...I..
..}.............
[derby]
[derby] RECEIVE BUFFER: SQLCARD (ASCII)
(EBCDIC)
[derby] 0000 0134D0030001012E 240800FFFFFFFF58 .4......$......X
..}.............
[derby] 0010 5344473343535331 3030333000000000 SDG3CSS10030....
................
[derby] 0020 0000000000000000 0000000000000000 ................
................
[derby] 0030 0000000000202020 2020202020202020 .....
................
[derby] 0040 000000ED4D657461 2D6461746120666F ....Meta-data fo
....(../.././..?
[derby] 0050 7220436F6E746169 6E6572206F72672E r Container org.
...?>./.>...?...
[derby] 0060 6170616368652E64 657262792E696D70 apache.derby.imp
/./........`.._.
[derby] 0070 6C2E73746F72652E 7261772E64617461 l.store.raw.data
%...?..../..././
[derby] 0080 2E524146436F6E74 61696E6572344066 .RAFContainer4@f
.....?>./.>... .
[derby] 0090 313263353320636F 756C64206E6F7420 12c53 could not
.......?.%..>?..
[derby] 00A0 6265206163636573 7365643A3A53514C be accessed::SQL
.../...........<
[derby] 00B0 53544154453A2058 4A3030314A617661 STATE: XJ001Java
............././
[derby] 00C0 2065786365707469 6F6E3A20272F686F exception: '/ho
........?>.....?
[derby] 00D0 6D652F7064736572 7665722F50445365 me/pdserver/PDSe
_...........&...
[derby] 00E0 727665722F6F7269 6F6E44422F736567 rver/orionDB/seg
.....?..?>......
[derby] 00F0 302F636436312E64 61742028546F6F20 0/cd61.dat (Too
......../....??.
[derby] 0100 6D616E79206F7065 6E2066696C657329 many open files)
_/>`.?..>...%...
[derby] 0110 3A206A6176612E69 6F2E46696C654E6F : java.io.FileNo
..|/./..?...%.+?
[derby] 0120 74466F756E644578 63657074696F6E27 tFoundException'
..?.>........?>.
[derby] 0130 2E0000FF ....
....
[derby]
[derby] BEGIN TRACE_DIAGNOSTICS
[derby][SQLException@520fa4] java.sql.SQLException
[derby][SQLException@520fa4] SQL state = 08006
[derby][SQLException@520fa4] Error code = 40000
[derby][SQLException@520fa4] Message = A network protocol error was
encountered and the connection has been terminated: the requested
command encountered an unarchitected and implementation-specific
condition for which there was no architected message
[derby][SQLException@520fa4] Stack trace follows
org.apache.derby.client.am.DisconnectException: A network protocol error
was encountered and the connection has been terminated: the requested
command encountered an unarchitected and implementation-specific
condition for which there was no architected message
at
org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(NetConnectionReply.java:888)
at
org.apache.derby.client.net.NetStatementReply.parsePrepareError(NetStatementReply.java:527)
at
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(NetStatementReply.java:143)
at
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(NetStatementReply.java:52)
at
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(StatementReply.java:40)
at
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(NetStatement.java:139)
at
org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Statement.java:1341)
at
org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(PreparedStatement.java:1874)
at
org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(PreparedStatement.java:1952)
at
org.apache.derby.client.am.PreparedStatement.prepare(PreparedStatement.java:309)
at
org.apache.derby.client.am.Connection.prepareStatementX(Connection.java:1646)
at
org.apache.derby.client.am.Connection.prepareStatement(Connection.java:413)
Dyre.Tjeldvoll@Sun.COM wrote:
> Thanks you did exactly the right thing. I should have mentioned
> getCause() as well. (Both are currently in use, I believe).
>
> I agree with Bryan's conclusions in another email; this sounds like a
> Derby bug.
>
> Based on the call stack I'd say what you're seeing is a "meta
> error" (for lack of a better word). I think that what is happening is
> that the client sends a request to prepare a statement to the server,
> but something goes wrong and an error is returned. As the client tries
> to parse the reply it detects that an error has occured
> (parsePrepareError(NetStatementReply.java:527)), but the error handling
> appears not to be able to handle the returned error correctly, and so you
> end up with a generic (and rather unhelpful) error message.
>
> If my analysis is correct, you may get around this if you can guess or
> trace what the root cause on the server is, and avoid it
> altogether.
>
> The best thing, obviously would be if you could come up with
> a small(er) example which reproduces the problem, which you can share with
> us (include in a Jira issue). Without being able to reproduce the
> problem, it will be nearly impossible for someone else to fix it, I'm
> afraid.
>
>
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Dy...@Sun.COM.
Vic Ricker <vi...@ricker.us> writes:
> Sorry about that. I added something to dump follow getNextException()
> and getCause(). I got the following exception from getCause(), I
> believe. I don't think getNextException() returned anything.
Thanks you did exactly the right thing. I should have mentioned
getCause() as well. (Both are currently in use, I believe).
I agree with Bryan's conclusions in another email; this sounds like a
Derby bug.
Based on the call stack I'd say what you're seeing is a "meta
error" (for lack of a better word). I think that what is happening is
that the client sends a request to prepare a statement to the server,
but something goes wrong and an error is returned. As the client tries
to parse the reply it detects that an error has occured
(parsePrepareError(NetStatementReply.java:527)), but the error handling
appears not to be able to handle the returned error correctly, and so you
end up with a generic (and rather unhelpful) error message.
If my analysis is correct, you may get around this if you can guess or
trace what the root cause on the server is, and avoid it
altogether.
The best thing, obviously would be if you could come up with
a small(er) example which reproduces the problem, which you can share with
us (include in a Jira issue). Without being able to reproduce the
problem, it will be nearly impossible for someone else to fix it, I'm
afraid.
> org.apache.derby.client.am.DisconnectException: A network protocol
> error was encountered and the connection has been terminated: the
> requested command encountered an unarchitected and
> implementation-specific condition for which there was no architected
> message
> org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(NetConnectionReply.java:888)
> org.apache.derby.client.net.NetStatementReply.parsePrepareError(NetStatementReply.java:527)
> org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(NetStatementReply.java:143)
> org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(NetStatementReply.java:52)
> org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(StatementReply.java:40)
> org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(NetStatement.java:139)
> org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Statement.java:1341)
> org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(PreparedStatement.java:1874)
> org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(PreparedStatement.java:1952)
> org.apache.derby.client.am.PreparedStatement.prepare(PreparedStatement.java:309)
> org.apache.derby.client.am.Connection.prepareStatementX(Connection.java:1646)
> org.apache.derby.client.am.Connection.prepareStatement(Connection.java:413)
> com.scs.database.sql.MoneyDatabaseSQLType.prepareStatement(MoneyDatabaseSQLType.java:2235)
> com.scs.database.sql.MoneyDatabaseSQLType.getTransactionByReferenceNumber(MoneyDatabaseSQLType.java:3393)
> com.scs.money.transaction.TransactionTable.getByReferenceNumber(TransactionTable.java:43)
> com.scs.money.data.TransactionImportEntry.isDuplicateReference(TransactionImportEntry.java:334)
> com.scs.money.data.TransactionImportEntry.setReferenceNumber(TransactionImportEntry.java:178)
> com.scs.money.data.MoneyImportFile.processMoneyImportFile(MoneyImportFile.java:750)
> com.scs.money.data.DataProcessPanel.doImport(DataProcessPanel.java:201)
> com.scs.money.data.DataProcessPanel.access$000(DataProcessPanel.java:19)
> com.scs.money.data.DataProcessPanel$1.process(DataProcessPanel.java:52)
> com.scs.money.TaskedJob.process(TaskedJob.java:19)
> com.scs.money.TaskedJob$1.processTask(TaskedJob.java:33)
> com.scs.taskmanager.TaskManager.cycle(TaskManager.java:71)
> com.scs.taskmanager.TaskManager.run(TaskManager.java:23)
--
dt
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Bryan Pendleton <bp...@amberpoint.com>.
> org.apache.derby.client.am.DisconnectException: A network protocol error
> was encountered
These can be a bit complicated to diagnose, but there is a wealth
of information about how to do so online at:
http://wiki.apache.org/db-derby/ProtocolDebuggingTips
Please try to pursue this problem and gather more information.
It's starting to sound like you might have found a new bug in Derby,
so we may need to move this discussion over to the developer list
at some point and see what help we can get there.
thanks,
bryan
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Vic Ricker <vi...@ricker.us>.
Sorry about that. I added something to dump follow getNextException()
and getCause(). I got the following exception from getCause(), I
believe. I don't think getNextException() returned anything.
org.apache.derby.client.am.DisconnectException: A network protocol error
was encountered and the connection has been terminated: the requested
command encountered an unarchitected and implementation-specific
condition for which there was no architected message
org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(NetConnectionReply.java:888)
org.apache.derby.client.net.NetStatementReply.parsePrepareError(NetStatementReply.java:527)
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(NetStatementReply.java:143)
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(NetStatementReply.java:52)
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(StatementReply.java:40)
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(NetStatement.java:139)
org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Statement.java:1341)
org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(PreparedStatement.java:1874)
org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(PreparedStatement.java:1952)
org.apache.derby.client.am.PreparedStatement.prepare(PreparedStatement.java:309)
org.apache.derby.client.am.Connection.prepareStatementX(Connection.java:1646)
org.apache.derby.client.am.Connection.prepareStatement(Connection.java:413)
com.scs.database.sql.MoneyDatabaseSQLType.prepareStatement(MoneyDatabaseSQLType.java:2235)
com.scs.database.sql.MoneyDatabaseSQLType.getTransactionByReferenceNumber(MoneyDatabaseSQLType.java:3393)
com.scs.money.transaction.TransactionTable.getByReferenceNumber(TransactionTable.java:43)
com.scs.money.data.TransactionImportEntry.isDuplicateReference(TransactionImportEntry.java:334)
com.scs.money.data.TransactionImportEntry.setReferenceNumber(TransactionImportEntry.java:178)
com.scs.money.data.MoneyImportFile.processMoneyImportFile(MoneyImportFile.java:750)
com.scs.money.data.DataProcessPanel.doImport(DataProcessPanel.java:201)
com.scs.money.data.DataProcessPanel.access$000(DataProcessPanel.java:19)
com.scs.money.data.DataProcessPanel$1.process(DataProcessPanel.java:52)
com.scs.money.TaskedJob.process(TaskedJob.java:19)
com.scs.money.TaskedJob$1.processTask(TaskedJob.java:33)
com.scs.taskmanager.TaskManager.cycle(TaskManager.java:71)
com.scs.taskmanager.TaskManager.run(TaskManager.java:23)
Dyre.Tjeldvoll@Sun.COM wrote:
> Vic Ricker <vi...@ricker.us> writes:
>
>
>> Can anyone give me any suggestions on how to debug this issue?
>>
>
> Derby uses exception chaining. The call stack you posted only show the
> place where an SqlException was caught and transformed to an
> SQLException which was then thrown. To see the full stack trace you need
> to do traverse the chain of exceptions using
> SQLException.getNextException(). With that we should at least be able to
> tell where in driver the network problem is detected...
>
>
Re: A network protocol error was encountered and the connection has
been terminated
Posted by Dy...@Sun.COM.
Vic Ricker <vi...@ricker.us> writes:
> Can anyone give me any suggestions on how to debug this issue?
Derby uses exception chaining. The call stack you posted only show the
place where an SqlException was caught and transformed to an
SQLException which was then thrown. To see the full stack trace you need
to do traverse the chain of exceptions using
SQLException.getNextException(). With that we should at least be able to
tell where in driver the network problem is detected...
--
dt