Issue Details (XML | Word | Printable)

Key: JDO-13
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael Watzek
Reporter: Michelle Caisse
Votes: 0
Watchers: 0
Operations

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

TCK test hangs

Created: 14/Apr/05 04:46 AM   Updated: 23/Apr/06 01:56 AM
Return to search
Component/s: tck2
Affects Version/s: None
Fix Version/s: JDO 2 beta

Time Tracking:
Not Specified

Resolution Date: 23/Apr/06 01:56 AM


 Description  « Hide
org.apache.jdo.tck.lifecycle.PMsCanSharePCClassesButNotPCInstances hangs. It is curently commented out in test/conf/alltests.list so that the TCK will run to completion.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Watzek added a comment - 10/Jun/05 01:51 AM
That TCK test starts 5 concurrent threads. Each thread makes an object of class "org.apache.jdo.tck.pc.lifecycle.StateTransitionObj" persistent in a separate transaction. Afterwards, each thread waits for the other threads to finish their transactions. After each threads has finished its transaction, all threads continue execution.

When such a thread makes an object persistent, it increases a counter. After its transaction has finished, it checks that counter and sleeps until the counter equals 5.

Unfortunately, the code is not prepared for exceptions thrown while transactions are executing. In such cases, the counter is not increased and all threads wait forever.

The the exception is a SQL exception indicating that a database table is missing:

ERROR 42X05: Table 'STATETRANSITIONOBJ' does not exist.

In addition, the .orm files are missing for datastore identity and application identity. Furthermore, the .jdo file for application identity is buggy.

These are the changes of the fix:

0) schema1.sql, schema2.sql
0.1) Database tables are added.

1) PMsCanSharePCClassesButNotPCInstances.java
1.1) Method "test" is split into two methods "testSharedPC()" and "testNonSharedPC()".
1.2) A check for uncaught exceptions is added causing a test to fail or throw a JDOFatalException in case of failures or errors. Without this check both tests would always succeed, even if there are failures and/or errors.
1.3) The call for increasing the counter for thread synchronization is moved into a finally block.
1.4) The call "pm.getExtent" is executed inside a transaction due to non-transactional read exception.

2) StateTransitionObj.java
2.1) A private static field "counter" is added.
2.2) A private field "id" is added. This is the PK field in case of application identity.
2.3) The no-arg constructor sets field "id to "++counter".
2.4) The second constructor calls "this()";
2.5) Getter/setter for field "id" are added.
2.6) A public static class "Oid" is added. This class is the object id class in case of application identity.

3) alltests.list
3.1) Class "PMsCanSharePCClassesButNotPCInstances" is added.

4) StateTransitionObj.jdo (for application identity)
4.1) An attribute "objectid-class" is added to class "StateTransitionObj".
4.2) The identity type is changed to application identity.

Michael Bouschen added a comment - 23/Apr/06 01:53 AM
Reopened to set the Fix Version/s field to JDO 2 beta.