Thought inc.

The Dynamic O/R Mapping Company
     

CocoBase Technical Support Forums
For access to developer site with software download and doc's, please request CocoBase download and password
will be emailed to you. Response to posts will appear when answered by THOUGHT Support team.
NOTE:You must register separately with forum in order to post your questions, please click on register icon below.
Home   Frequently Asked Questions   Search   Edit your profile   Registration is free!  
Email This Page to Someone!
Show a Printable Version
CocoBase Enterprise O/R Forums > CocoBase Bug Reports
Infinite loop in Transaction.close
< Previous Thread     Next Thread >
Author
Thread    Post New Thread     Post A Reply
steve
Member

Registered: May 2001
Posts: 16

If multiple (non-nested) transactions are open and Transaction.close is called on one of the transactions, the program will go into an infinite loop in the close method.

05-10-2001 09:57 AM
Click Here to See the Profile for steve    Find more posts by steve        Edit/Delete Message    Reply w/Quote    IP: Logged
support
Super Moderator

Registered: Apr 2001
Posts: 1

We'll have someone look at this. Are you using threads to
program with, or is there only a single thread in operation?

We haven't had this issue reported, so we'd like to receive
more information to better diagnose the potential issue.

Also are you sure it's an infinite loop and not a
synchronization issue? You can enable debug on the Transaction
object with cocoTxn.setDebug(true); to see if in fact the
Transaction is hanging or looping... One of the updates we've
done in the latest Transaction object is to create a pure
local Transaction that doesn't make itself registered with
the 'static' Transaction system. This local model means that
multiple Transactions don't actually share any static
information, and shouldn't produce any synchronization issues.
If you have Service Release 9, this feature is included...

To enable this feature create your Transaction object with
a boolean value in your constructor. Either use:
cocoTxn = new Transaction(false);
or
cocoTxn = new Transaction(myBase, false);

If you send us more specifics of your tests we can also better
replicate your particulars.

Hope that helps!

THOUGHT Support

05-11-2001 11:34 AM
Click Here to See the Profile for support    Find more posts by support        Edit/Delete Message    Reply w/Quote    IP: Logged
steve
Member

Registered: May 2001
Posts: 16

It's a single threaded application. It appears that if close is called on a transaction when multiple transactions are open, the transaction being closed will be removed from the transaction stack but the close operation loops forever. It's definitely a loop and not a synchronization problem. The Task Manager under Win2000 shows the CPU is loaded at 100% until the program is killed.

05-12-2001 02:29 PM
Click Here to See the Profile for steve    Find more posts by steve        Edit/Delete Message    Reply w/Quote    IP: Logged
support
Super Moderator

Registered: Apr 2001
Posts: 1

If there's any way you can send the table ddls, export the
repository as XML and send it with the test classes, we'll
be happy to confirm more quickly if/how the problem exists.

If you could please email those files to the support account
(since the forum doesn't yet take attachments) we can try to
quickly respond to this....

THOUGHT Support

05-14-2001 12:03 PM
Click Here to See the Profile for support    Find more posts by support        Edit/Delete Message    Reply w/Quote    IP: Logged
steve
Member

Registered: May 2001
Posts: 16

This is a general problem independent of DDL or XML. I'm guessing there is a loop in the Transaction close operation that has an incorrect termination condition when multiple simultaneous, non-nested transactions exist.

05-24-2001 01:31 PM
Click Here to See the Profile for steve    Find more posts by steve        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

We'll need to look at this more - do you have a simple test
case we can give to our developers? If so could you email
it to the support@thoughtinc.com account? As of SR9 we
changed the Transaction constructors to give the developer the
option of having a 'Local' Transaction that isn't registed
with the static Transaction manager. The static manager is
probably having a thread blocking condition or other issue
that could be avoided using this option. It sounds like you
are a good candidate for the 'local' transaction facility.

You can create a local instance with
new thought.CocoBase.Transaction(false);
or
new thought.CocoBase.Transaction(myBase, false);

The boolean parameter tells the Transaction object to not
register itself 'globally' and therefore to also have only
local instance storage that will also disappear with the
Transaction instance.

THOUGHT Support

05-24-2001 03:05 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
steve
Member

Registered: May 2001
Posts: 16

//
// the forum software removes leading spaces on lines :-(
//

import thought.CocoBase.*;
import java.util.*;

public class TransactionTest {
public static void main(String[] args) {
Transaction txn1 = new Transaction(new TestConnection());
Transaction txn2 = new Transaction(new TestConnection());
Transaction txn3 = new Transaction(new TestConnection());
txn1.begin();
txn2.begin();
txn3.begin();
txn1.close(); // <-- infinite loop here
}

}

//
// Stubbed CocoDriverInterface
//
class TestConnection implements CocoDriverInterface
{
public String getVersion() {
return "";
}

public void setThis(Object obj) { }

public void setDebug(boolean flag) { }

public void setUseBinding(boolean flag) { }

public void setUseSchemaPrefixes(boolean flag) { }

public boolean getDebug() {
return false;
}

public boolean getUseBinding() {
return false;
}

public boolean getUseSchemaPrefixes() {
return false;
}

public void setConnectDriver(String s) { }

public void setConnectURL(String s) { }

public void setUserId(String s) { }

public void setPassWord(String s) { }

public Object getConnection() {
return new Object();
}

public void commit() { }

public void rollback() { }

public void setAutoCommit(boolean flag) { }

public Vector getColumns(String s) {
return new Vector();
}

public Vector getColumns(Object obj) {
return new Vector();
}

public int connect() {
return 0;
}

public Vector selectAll(Object obj) {
return new Vector();
}

public Vector selectAll(Object obj, String s) {
return new Vector();
}

public Object select(Object obj) {
return new Object();
}

public Object select(Object obj, String s) {
return new Object();
}

public Vector selectBlock(Object obj) {
return new Vector();
}

public Vector selectBlock(Object obj, int i) {
return new Vector();
}

public Vector selectBlock(Object obj, String s) {
return new Vector();
}

public Vector selectBlock(Object obj, String s, int i) {
return new Vector();
}

public Vector selectNext(Vector vector, Object obj) {
return new Vector();
}

public Vector selectNext(Vector vector, Object obj, String s) {
return new Vector();
}

public Vector select(Object obj, String s, int i) {
return new Vector();
}

public Vector callAll(Object obj) {
return new Vector();
}

public Vector callAll(Object obj, String s) {
return new Vector();
}

public Object call(Object obj) {
return new Object();
}

public Vector call(Object obj, String s, int i) {
return new Vector();
}

public int insert(Object obj) {
return 0;
}

public int insert(Object obj, String s) {
return 0;
}

public int delete(Object obj) {
return 0;
}

public int delete(Object obj, String s) {
return 0;
}

public int update(Object obj, Object obj1) {
return 0;
}

public int update(Object obj, Object obj1, String s) {
return 0;
}

public int close() {
return 0;
}

public void clearExceptions() { }

public void setThrowExceptions(boolean flag) { }

public boolean hasExceptions() {
return false;
}

public Enumeration getExceptions() {
return (new Vector()).elements();
}

public void setExceptionListPerCommand(boolean flag) { }
}

05-24-2001 06:48 PM
Click Here to See the Profile for steve    Find more posts by steve        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

We agree that this causes an infinite loop. We'll have
development take a look at this to see if there's a solution
that they're aware of.

Hopefully we can get back to you soon with a solution. What
we can tell you also is that our update that we'll separately
email you as an update to the Transaction system doesn't cause
this problem because it uses 'local instances' of the
Transaction system. We'll also send you the modified code that
works with the new system, and we tested it here and the loop
isn't an issue. So in otherwords we think the nested & static
combination is the source of this problem. There seems to be
a bug in our static transaction handling that will most
certainly get resolved, but we do have a great workaround for
you that we'll be emailing you.

THOUGHT Support

05-24-2001 07:14 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
All times are PST (US)    Post New Thread     Post A Reply
Forum Jump:
< Previous Thread     Next Thread >

Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author. Messages can be deleted by their author.
Posts: HTML code is OFF. Smilies are OFF. vB code is OFF. [IMG] code is OFF.

Admin Options:
Open / Close Thread
Move Thread
Delete Thread
Edit Thread

< Contact Us - THOUGHT Inc. >

Copyright © Jelsoft Enterprises Limited 2000.
Copyright 2001 All Rights Reserved, THOUGHT Inc.