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 "Oyvind Bakksjo (JIRA)" <de...@db.apache.org> on 2005/09/20 15:51:28 UTC

[jira] Created: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Query timeout set for one statement may affect other statements with the same SQL string
----------------------------------------------------------------------------------------

         Key: DERBY-579
         URL: http://issues.apache.org/jira/browse/DERBY-579
     Project: Derby
        Type: Bug
  Components: SQL  
    Reporter: Oyvind Bakksjo
 Assigned to: Oyvind Bakksjo 
    Priority: Minor
     Fix For: 10.2.0.0


The timeout is being set on the class GenericPreparedStatement, but this
represents a statement plan and can be shared across multiple
connections (through the statement cache). Thus if two connections
execute the same statement with different timeouts, they will interfere
with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-579?page=comments#action_12329996 ] 

Daniel John Debrunner commented on DERBY-579:
---------------------------------------------

I also entered DERBY-574 for this issue. Can you make one a dup of the other.

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0

>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-579.
------------------------------------


> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-579
>                 URL: https://issues.apache.org/jira/browse/DERBY-579
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Oyvind Bakksjo
>         Assigned To: Oyvind Bakksjo
>            Priority: Minor
>             Fix For: 10.2.1.6
>
>         Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment: DERBY-579.svn.status

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-579?page=comments#action_12331188 ] 

Oyvind Bakksjo commented on DERBY-579:
--------------------------------------

Last attached diff relates to svn repository version 293374.

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment:     (was: DERBY-579.svn.diff)

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
Yes, you are right about conflicting requests.... but I am sure you will
figure out how to do more in less time! :-)

Thanks for signing up to add a test case!

Satheesh

Oyvind.Bakksjo@Sun.COM wrote:

> You realize that you are making conflicting requests, don't you? ;-)
> More tests in less time!
>
> I ran the test in 15 minutes, which is less than what you are
> experiencing, but I still think it is too much. I'll look into making
> the test run faster. The problem is that it's hard to tune the size of
> the tables so you're "guaranteed" that the fetching of some rows will
> take longer than the timeout value.
>
> I'll also look at adding a testcase for the bug that this patch
> addresses.
>


Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Oy...@Sun.COM.
Kathey Marsden wrote:
> Perhaps this is a silly idea, but would using a function in the query
> that had a sleep in it make this more predictable?  10 rows each with a
> sleep of 3  seconds guaranteed to take 30 seconds.

It's not silly at all, it's in fact a very good idea. I have tried this 
approach and it works perfectly.

Using this technique, I don't have to rely on big data volumes, so I 
should be able to squeeze the test's running time down to less than a 
minute, at the same time making it completely predictable on any 
hardware, fast or slow. Thanks for the great idea!

-- 
Oyvind Bakksjo
Sun Microsystems, Database Technology Group
Trondheim, Norway
http://weblogs.java.net/blog/bakksjo/

Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Kathey Marsden <km...@sbcglobal.net>.
Oyvind.Bakksjo@Sun.COM wrote:

>
> You realize that you are making conflicting requests, don't you? ;-)
> More tests in less time!
>
> I ran the test in 15 minutes, which is less than what you are
> experiencing, but I still think it is too much. I'll look into making
> the test run faster. The problem is that it's hard to tune the size of
> the tables so you're "guaranteed" that the fetching of some rows will
> take longer than the timeout value.
>
> I'll also look at adding a testcase for the bug that this patch
> addresses.
>

Perhaps this is a silly idea, but would using a function in the query
that had a sleep in it make this more predictable?  10 rows each with a
sleep of 3  seconds guaranteed to take 30 seconds.


Kathey




Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Oy...@Sun.COM.
Satheesh Bandaram wrote:
> I am not exactly objecting  :-) , but it would be nice to add a test
> case to show the problem the fix is attempting to fix. I suspect the
> original issue is easy to introduce, but hard to catch.
> 
> While we are on this topic, I noticed SetQueryTimeoutTest test takes
> around 30-40 minutes on my laptop. On one of our build machines, it
> actually runs for longer than 2 hours when the test harness actually
> kills the test. (causing the test to fail everytime) Though this is more
> of our test machine problem (it is really sloooow), taking 30-40 minutes
> for one functional test seems too long. Is there anyway the test can be
> made to run faster?

You realize that you are making conflicting requests, don't you? ;-) 
More tests in less time!

I ran the test in 15 minutes, which is less than what you are 
experiencing, but I still think it is too much. I'll look into making 
the test run faster. The problem is that it's hard to tune the size of 
the tables so you're "guaranteed" that the fetching of some rows will 
take longer than the timeout value.

I'll also look at adding a testcase for the bug that this patch addresses.

-- 
Oyvind Bakksjo
Sun Microsystems, Database Technology Group
Trondheim, Norway
http://weblogs.java.net/blog/bakksjo/

Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.

Oyvind.Bakksjo@Sun.COM wrote:

> I have made an attempt, but it is very hard to make a consistent
> reproduction of the issue. The reason is that when a statement is
> executed, the timeout value is immediately propagated (through the
> GenericPreparedStatement) to the StatementContext and the ResultSet.
> Therefore, the time window where this bug could affect other
> statements is very small. Also, this bug may only affect statements on
> different connections, since statements on the same connection may not
> execute simultaneously. As a result, in order to reproduce this issue,
> one needs to have the same statement executed simultaneously on many
> connections on a multi-cpu machine, and even then you'd probably
> hardly ever see it. By inserting a time-consuming no-op at the right
> spot in the engine I was able to reproduce it more frequently, but we
> cannot do that in testing.

OK. Thanks for trying.

>
>> While we are on this topic, I noticed SetQueryTimeoutTest test takes
>> around 30-40 minutes on my laptop. On one of our build machines, it
>> actually runs for longer than 2 hours when the test harness actually
>> kills the test. (causing the test to fail everytime) Though this is more
>> of our test machine problem (it is really sloooow), taking 30-40 minutes
>> for one functional test seems too long. Is there anyway the test can be
>> made to run faster?
>
>
> It now runs in 29 seconds on my machine, I hope that's satisfactory. :)

I knew you would find a way... Thanks!

Satheesh

>
>> Satheesh
>
>


Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Oy...@Sun.COM.
Satheesh Bandaram wrote:
> I am not exactly objecting  :-) , but it would be nice to add a test
> case to show the problem the fix is attempting to fix. I suspect the
> original issue is easy to introduce, but hard to catch.

I have made an attempt, but it is very hard to make a consistent 
reproduction of the issue. The reason is that when a statement is 
executed, the timeout value is immediately propagated (through the 
GenericPreparedStatement) to the StatementContext and the ResultSet. 
Therefore, the time window where this bug could affect other statements 
is very small. Also, this bug may only affect statements on different 
connections, since statements on the same connection may not execute 
simultaneously. As a result, in order to reproduce this issue, one needs 
to have the same statement executed simultaneously on many connections 
on a multi-cpu machine, and even then you'd probably hardly ever see it. 
By inserting a time-consuming no-op at the right spot in the engine I 
was able to reproduce it more frequently, but we cannot do that in testing.

> While we are on this topic, I noticed SetQueryTimeoutTest test takes
> around 30-40 minutes on my laptop. On one of our build machines, it
> actually runs for longer than 2 hours when the test harness actually
> kills the test. (causing the test to fail everytime) Though this is more
> of our test machine problem (it is really sloooow), taking 30-40 minutes
> for one functional test seems too long. Is there anyway the test can be
> made to run faster?

It now runs in 29 seconds on my machine, I hope that's satisfactory. :)

> Satheesh

-- 
Oyvind Bakksjo
Sun Microsystems, Database Technology Group
Trondheim, Norway
http://weblogs.java.net/blog/bakksjo/

Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
I am not exactly objecting  :-) , but it would be nice to add a test
case to show the problem the fix is attempting to fix. I suspect the
original issue is easy to introduce, but hard to catch.

While we are on this topic, I noticed SetQueryTimeoutTest test takes
around 30-40 minutes on my laptop. On one of our build machines, it
actually runs for longer than 2 hours when the test harness actually
kills the test. (causing the test to fail everytime) Though this is more
of our test machine problem (it is really sloooow), taking 30-40 minutes
for one functional test seems too long. Is there anyway the test can be
made to run faster?

Satheesh

Oyvind.Bakksjo@Sun.COM wrote:

> Oyvind Bakksjo (JIRA) wrote:
>
>>      [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]
>>
>> Oyvind Bakksjo updated DERBY-579:
>> ---------------------------------
>>
>>     Attachment: DERBY-579.svn.diff
>
>
> If nobody objects by end of business today (any timezone), I will
> commit this patch.
>

Re: [jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by Oy...@Sun.COM.
Oyvind Bakksjo (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]
> 
> Oyvind Bakksjo updated DERBY-579:
> ---------------------------------
> 
>     Attachment: DERBY-579.svn.diff

If nobody objects by end of business today (any timezone), I will commit 
this patch.

-- 
Oyvind Bakksjo
Sun Microsystems, Database Technology Group
Trondheim, Norway
http://weblogs.java.net/blog/bakksjo/

[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment: DERBY-579.svn.diff

This patch fixes the bug as proposed by Dan Debrunner ("pass the timeout into the execute method of
org.apache.derby.iapi.sql.PreparedStatement, not store it as a field in
GenericPreparedStatement.").

jdbcapi test has been run without errors. Currently running derbyall.

svn diff executed on revision 290453.

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment:     (was: DERBY-579.svn.status)

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment: DERBY-579.svn.diff

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]

Oyvind Bakksjo updated DERBY-579:
---------------------------------

    Attachment: DERBY-579.svn.status

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-579) Query timeout set for one statement may affect other statements with the same SQL string

Posted by "Oyvind Bakksjo (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-579?page=all ]
     
Oyvind Bakksjo resolved DERBY-579:
----------------------------------

    Resolution: Fixed

> Query timeout set for one statement may affect other statements with the same SQL string
> ----------------------------------------------------------------------------------------
>
>          Key: DERBY-579
>          URL: http://issues.apache.org/jira/browse/DERBY-579
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Reporter: Oyvind Bakksjo
>     Assignee: Oyvind Bakksjo
>     Priority: Minor
>      Fix For: 10.2.0.0
>  Attachments: DERBY-579.svn.diff, DERBY-579.svn.status
>
> The timeout is being set on the class GenericPreparedStatement, but this
> represents a statement plan and can be shared across multiple
> connections (through the statement cache). Thus if two connections
> execute the same statement with different timeouts, they will interfere
> with each other with the timeout values.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira