Issue Details (XML | Word | Printable)

Key: JDO-324
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Michelle Caisse
Reporter: Jörg von Frantzius
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

Derby "ERROR 40XL1" in multithreaded test "RefreshAllNoParameterSideEffects"

Created: 02/Mar/06 02:21 AM   Updated: 20/Oct/06 03:57 AM
Return to search
Component/s: tck2
Affects Version/s: JDO 2 rc1
Fix Version/s: JDO 2 maintenance release 1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works derby-dsid-pm-junit.txt 2006-03-02 02:22 AM Jörg von Frantzius 17 kB
Java Source File Licensed for inclusion in ASF works RefreshAllNoParameterSideEffects.java 2006-10-19 08:08 PM Michelle Caisse 6 kB
Java Source File Licensed for inclusion in ASF works RefreshAllNoParameterSideEffects.java 2006-10-19 05:02 PM Michelle Caisse 6 kB

Resolution Date: 20/Oct/06 03:57 AM


 Description  « Hide
When using latest JPOX nightly (01-Mar-2006 04:21), I get a "ERROR 40XL1: A lock could not be obtained within the time requested" Derby error (see next attachment for log file). This happens while running RefreshAllNoParameterSideEffects, which is multithreaded, and it happens for both threads.

This is with Windows XP SP2 and JDK 1.4.2_09 on a dual core machine. Maybe the fact that it is dual core leads to different timing than single core?


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig Russell added a comment - 02/Mar/06 04:23 AM
I looked at the test, and it appears that the test is not correct. It is too complex for what it's testing, and doesn't even test what the assertion says.

For now, I propose adding the three test cases to the exclude list and fix this later.

Michael Bouschen added a comment - 02/Mar/06 05:29 AM
I agree, the test is not correct.

I think we do not need multiple threads to test the assertion. Here is what I think the test should do:
- Setup creates a new instance, commit the trsnaction and stores the oid in an instance variable.
- Create a pm, start an optimistic transaction and read the object with pm.getObjectById using the stored oid.
- Create another pm, start a new transaction, read the same object, update it and commit the second transaction.
- The first transaction calls pm.refresh for the object, updates it and commits the transaction.
The above should not result in an exception because the refresh call synchronizes the cache with the current state of the datastore, so there is no parallel update.

Michelle Caisse added a comment - 19/Oct/06 05:02 PM
The attached file is a rewrite of the test per Michael's specification. Please review.

Craig Russell added a comment - 19/Oct/06 06:24 PM
Looks good. Just a couple of comments.

1. The failOnError should be outside the try...finally block, to make sure you see the error messages.

2. The indentation of " if (pntVerify.getX() != 33 " block is off.

3. I think you need to verify the values when doRefresh is false. You might not catch an exception but commit the change. I'd put the retrieval of the value outside the if(doRefresh) and check the values:

if (doRefresh) {
pntVerify == 33, 33
} else {
pntVerify == 22, 22
}

Michelle Caisse added a comment - 19/Oct/06 08:08 PM
How's this?

Craig Russell added a comment - 20/Oct/06 01:15 AM
Looks good.

Michelle Caisse added a comment - 20/Oct/06 03:57 AM
Checked in fix with revision: 465971