You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "David W. Van Couvering" <Da...@Sun.COM> on 2006/01/18 02:47:50 UTC
Tests hanging - any hints?
Hi, all. I've been running tests with the new i18n framework, which
included having all public methods throw SQLException instead of
org.apache.derby.client.am.SqlException.
For reasons that are mystifying me, in tests that prepare a statement
which deal with stored procedures/functions (either to create or to
drop), the client hangs waiting for a description of the input
parameters. Here's the stack trace. It's the same for
derbynet/callable.java and DerbyJunitTest.dropSchemaObject(). Meanwhile
the network server is completely idle.
These same tests pass for JCC and for the trunk. Can anyone give me any
tips how I might go about tracking this down? I am mystified how I
could have caused this problem simply by changing what exception is
thrown. I'm not expecting you to figure this out, but if you have any
"did you check this" kind of hints it would be very much appreciated.
Thanks,
David
[1] java.net.SocketInputStream.socketRead0 (native method)
[2] java.net.SocketInputStream.read (SocketInputStream.java:129)
[3] org.apache.derby.client.net.Reply.fill (Reply.java:169)
[4] org.apache.derby.client.net.Reply.ensureALayerDataInBuffer
(Reply.java:212
)
[5] org.apache.derby.client.net.Reply.readDssHeader (Reply.java:319)
[6] org.apache.derby.client.net.Reply.startSameIdChainParse
(Reply.java:1,143)
[7] org.apache.derby.client.net.NetStatementReply.readDescribeInput
(NetStatem
entReply.java:84)
[8] org.apache.derby.client.net.StatementReply.readDescribeInput
(StatementRep
ly.java:64)
[9]
org.apache.derby.client.net.NetPreparedStatement.readDescribeInput_ (NetPr
eparedStatement.java:148)
[10] org.apache.derby.client.am.PreparedStatement.readDescribeInput
(PreparedS
tatement.java:1,374)
[11]
org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutp
ut (PreparedStatement.java:1,432)
[12]
org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutp
ut (PreparedStatement.java:1,509)
[13] org.apache.derby.client.am.PreparedStatement.prepare
(PreparedStatement.j
ava:243)
[14] org.apache.derby.client.am.Connection.prepareStatementX
(Connection.java:
1,489)
[15] org.apache.derby.client.am.Connection.prepareStatement
(Connection.java:3
64)
[16]
org.apache.derbyTesting.functionTests.util.DerbyJUnitTest.prepare (DerbyJ
UnitTest.java:429)
Re: Tests hanging - any hints?
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Thanks, great tips, I'll check this out.
David
Bryan Pendleton wrote:
> David W. Van Couvering wrote:
>
>> For reasons that are mystifying me, in tests that prepare a statement
>> which deal with stored procedures/functions (either to create or to
>> drop), the client hangs waiting for a description of the input
>> parameters.
>
>
> This seems fairly unlikely, but the symptoms you describe match bug 492
> http://issues.apache.org/jira/browse/DERBY-492 quite closely. When that
> bug occurs, one of its manifestations is for the server to truncate the
> internal buffer holding the messages that it's sending back to the client,
> and the result is a hang on the client side since the server doesn't send
> all the data that it's promised it would send.
>
> I don't know how your changes would have made this bug more likely to
> appear.
> Still, to rule it out, you could apply, in your client, the patches
> that I've posted for DERBY-492, and see if the symptoms change.
>
> thanks,
>
> bryan
>
>
Re: Tests hanging - any hints?
Posted by Bryan Pendleton <bp...@amberpoint.com>.
David W. Van Couvering wrote:
> For reasons that are mystifying me, in tests that prepare a statement
> which deal with stored procedures/functions (either to create or to
> drop), the client hangs waiting for a description of the input
> parameters.
This seems fairly unlikely, but the symptoms you describe match bug 492
http://issues.apache.org/jira/browse/DERBY-492 quite closely. When that
bug occurs, one of its manifestations is for the server to truncate the
internal buffer holding the messages that it's sending back to the client,
and the result is a hang on the client side since the server doesn't send
all the data that it's promised it would send.
I don't know how your changes would have made this bug more likely to appear.
Still, to rule it out, you could apply, in your client, the patches
that I've posted for DERBY-492, and see if the symptoms change.
thanks,
bryan
Re: Tests hanging - any hints?
Posted by Kathey Marsden <km...@sbcglobal.net>.
David W. Van Couvering wrote:
>
> Is there any reason why the message text isn't sent over ahead of time
> as part of the original exception message sent from the server? I
> don't see the value in saving network traffic when you are in an
> exception path. Is it because many exceptions get ignored/handled
> without being reported to the user? Anybody know the
> history/motivation behind this?
The stored procedure error message model causes all sorts of troubles.
Eliminating the need for that would be a meaty, high value DRDA
project for someone with interest. Of course we would need to make sure
the old clients still work.
There are a few serious problems in the DRDA protocol and/or Derby
that I know of related to this and probably more if you were to look
into it deeper. A few issues off the top of my head ..
1) There is limited length* *message info sent to the client. JCC and
DerbyClient cheat a bit. ODBC does not.
2) There is no communication of client locale but we could work around
that with an EXCSQLSET.
3) There are issues returning multiple exceptions to the client.
I think in SQLAM level 7 some things were improved. If interested look
for SQLCAXGRP in the DRDA manual. The info is really spread out.
Kathey
Re: Tests hanging - any hints?
Posted by Francois Orsini <fr...@gmail.com>.
I don't know but I have been looking at this for another fix - I don't
understand why the whole exception (with chained esceptions) is *not* built
on the client-side when the original exception is raised, rather than going
and fetch corresponding server information on demand as a SQLException is
being accessed - seems to me not that optimal but there might be a good
reason for this - we don't really need to save network traffic in some
exception code path - it is not the most common case for sure but again
there could be some other reasons for this...I think the original exception
with its chained exceptions should be generated on the client side when the
exception is detected in the first place...I believe this is the same for
(chained) SQLWarnings...
--francois
On 1/19/06, David W. Van Couvering <Da...@sun.com> wrote:
>
> It seems odd (and somewhat dangerous) to me to be doing network I/O as
> part of exception processing. Easy to get an error within an error (I
> even saw some gnarly code in the log tracing code on the client to make
> sure that stuff wasn't pulled over to avoid just such an error within an
> error scenario).
>
> What was worse is I didn't even get an error -- just a hang. Seems like
> a pretty sensitive protocol to me :(
>
> Is there any reason why the message text isn't sent over ahead of time
> as part of the original exception message sent from the server? I don't
> see the value in saving network traffic when you are in an exception
> path. Is it because many exceptions get ignored/handled without being
> reported to the user? Anybody know the history/motivation behind this?
>
> Thanks,
>
> David
>
> Bryan Pendleton wrote:
> > David W. Van Couvering wrote:
> >
> >> Thanks to both Brian and Dyre for their tips. The patch for Brian's
> >> bug didn't help, but both your emails got me thinking and I discovered
> >> I was getting info out of the SQLCA structure earlier than the code
> >> used to do, and I think this was incorrectly trying to pull
> >> information over the server.
> >
> >
> > This makes sense. The exception processing in the client/server case is
> > interesting, because the client-side SQLException classes have methods
> in
> > them which go across the network to fetch server information.
> >
> > For example, calling "getMessage" on a SQL Exception in the client may
> > result
> > in network calls to fetch the correctly-localized text from the server.
> It
> > generates a call to a system procedure, I believe. There was some
> > conversation
> > about this on the mailing list a few months back because I was
> > investigating
> > a bug in which the getMessage() result is truncated in client/server
> cases
> > due to a hard limit on the output parameter length in this system
> > procedure.
> >
> > So if you were changing the implementation of the SQL Exception
> handling,
> > you definitely could have interacted with this code.
> >
> > Glad you resolved it.
> >
> > bryan
> >
> >
> >
>
>
>
Re: Tests hanging - any hints?
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
It seems odd (and somewhat dangerous) to me to be doing network I/O as
part of exception processing. Easy to get an error within an error (I
even saw some gnarly code in the log tracing code on the client to make
sure that stuff wasn't pulled over to avoid just such an error within an
error scenario).
What was worse is I didn't even get an error -- just a hang. Seems like
a pretty sensitive protocol to me :(
Is there any reason why the message text isn't sent over ahead of time
as part of the original exception message sent from the server? I don't
see the value in saving network traffic when you are in an exception
path. Is it because many exceptions get ignored/handled without being
reported to the user? Anybody know the history/motivation behind this?
Thanks,
David
Bryan Pendleton wrote:
> David W. Van Couvering wrote:
>
>> Thanks to both Brian and Dyre for their tips. The patch for Brian's
>> bug didn't help, but both your emails got me thinking and I discovered
>> I was getting info out of the SQLCA structure earlier than the code
>> used to do, and I think this was incorrectly trying to pull
>> information over the server.
>
>
> This makes sense. The exception processing in the client/server case is
> interesting, because the client-side SQLException classes have methods in
> them which go across the network to fetch server information.
>
> For example, calling "getMessage" on a SQL Exception in the client may
> result
> in network calls to fetch the correctly-localized text from the server. It
> generates a call to a system procedure, I believe. There was some
> conversation
> about this on the mailing list a few months back because I was
> investigating
> a bug in which the getMessage() result is truncated in client/server cases
> due to a hard limit on the output parameter length in this system
> procedure.
>
> So if you were changing the implementation of the SQL Exception handling,
> you definitely could have interacted with this code.
>
> Glad you resolved it.
>
> bryan
>
>
>
Re: Tests hanging - any hints?
Posted by Bryan Pendleton <bp...@amberpoint.com>.
David W. Van Couvering wrote:
> Thanks to both Brian and Dyre for their tips. The patch for Brian's bug
> didn't help, but both your emails got me thinking and I discovered I was
> getting info out of the SQLCA structure earlier than the code used to
> do, and I think this was incorrectly trying to pull information over the
> server.
This makes sense. The exception processing in the client/server case is
interesting, because the client-side SQLException classes have methods in
them which go across the network to fetch server information.
For example, calling "getMessage" on a SQL Exception in the client may result
in network calls to fetch the correctly-localized text from the server. It
generates a call to a system procedure, I believe. There was some conversation
about this on the mailing list a few months back because I was investigating
a bug in which the getMessage() result is truncated in client/server cases
due to a hard limit on the output parameter length in this system procedure.
So if you were changing the implementation of the SQL Exception handling,
you definitely could have interacted with this code.
Glad you resolved it.
bryan
Re: Tests hanging - any hints?
Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Thanks to both Brian and Dyre for their tips. The patch for Brian's bug
didn't help, but both your emails got me thinking and I discovered I was
getting info out of the SQLCA structure earlier than the code used to
do, and I think this was incorrectly trying to pull information over the
server. This was all based on intuition and I have no proof (I wanted
to avoid debugging the network layer), but it worked! I no longer have
hangs in my tests...
Cheers,
David
Dyre.Tjeldvoll@Sun.COM wrote:
>>>>>>"DWVC" == David W Van Couvering <Da...@Sun.COM> writes:
>
>
> DWVC> Hi, all. I've been running tests with the new i18n framework, which
> DWVC> included having all public methods throw SQLException instead of
> DWVC> org.apache.derby.client.am.SqlException.
>
> DWVC> For reasons that are mystifying me, in tests that prepare a statement
> DWVC> which deal with stored procedures/functions (either to create or to
> DWVC> drop), the client hangs waiting for a description of the input
> DWVC> parameters. Here's the stack trace. It's the same for
> DWVC> derbynet/callable.java and DerbyJunitTest.dropSchemaObject(). Meanwhile
> DWVC> the network server is completely idle.
>
> DWVC> These same tests pass for JCC and for the trunk. Can anyone give me any
> DWVC> tips how I might go about tracking this down? I am mystified how I
> DWVC> could have caused this problem simply by changing what exception is
> DWVC> thrown. I'm not expecting you to figure this out, but if you have any
> DWVC> "did you check this" kind of hints it would be very much appreciated.
>
> I have seen the same behavior when I tried to modify the parsing of
> messages to the NetworkServer. I accidently caused the NetworkServer
> to expect more data than the client was sending. The client waited for
> the reply, while the server waited for more data from the client.
>
> Don't know exactly how your change could trigger this type of behavior
> though...
>
Re: Tests hanging - any hints?
Posted by Dy...@Sun.COM.
>>>>> "DWVC" == David W Van Couvering <Da...@Sun.COM> writes:
DWVC> Hi, all. I've been running tests with the new i18n framework, which
DWVC> included having all public methods throw SQLException instead of
DWVC> org.apache.derby.client.am.SqlException.
DWVC> For reasons that are mystifying me, in tests that prepare a statement
DWVC> which deal with stored procedures/functions (either to create or to
DWVC> drop), the client hangs waiting for a description of the input
DWVC> parameters. Here's the stack trace. It's the same for
DWVC> derbynet/callable.java and DerbyJunitTest.dropSchemaObject(). Meanwhile
DWVC> the network server is completely idle.
DWVC> These same tests pass for JCC and for the trunk. Can anyone give me any
DWVC> tips how I might go about tracking this down? I am mystified how I
DWVC> could have caused this problem simply by changing what exception is
DWVC> thrown. I'm not expecting you to figure this out, but if you have any
DWVC> "did you check this" kind of hints it would be very much appreciated.
I have seen the same behavior when I tried to modify the parsing of
messages to the NetworkServer. I accidently caused the NetworkServer
to expect more data than the client was sending. The client waited for
the reply, while the server waited for more data from the client.
Don't know exactly how your change could trigger this type of behavior
though...
--
dt