You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Dirk Verbeeck <di...@pandora.be> on 2001/10/02 21:16:14 UTC

Re: Slide in multi-thread environment

Hi

Sorry for the late reply but I wanted to try the test myself.
Are you getting an error in the "get" part of your test ?
I don't have oracle installed but have modified your example
can you try this with use_transaction set to true and also with false ?


Dirk



Ting Ning wrote:

> Hi,
>
> I write a small test program to test slide in
> multi-threads env. I enclose my test program here.
> Please take look at it. The NamespaceAccessToken is
> initialized in the main program. Then it is passed to
> the different thread. Each thread just puts the files
> into Slide, and gets it back into file. Each thread
> works on different file.
>
> I run the test program with Slide 1.0.14 with Oracle
> database as descriptor and content stores. I get the
> error like the transaction is not consistent, for
> example, the Oracle error is "fetch out of sequence".
> It is because that connection is shared between the
> two thread.
>
> After doing some debug, I found out there is only one
> database connection in this Slide test. This is why my
> test fails.
>
> Do I do the right thing in this test?
> If not, how can I do it?
>
> Any suggestions are welcome!
>
> Thanks in Advance.
>
> Ting

Re: Slide in multi-thread environment

Posted by Dirk Verbeeck <di...@pandora.be>.
If you want, you can create a bug report for this on
http://nagoya.apache.org/bugzilla/


Dirk

Re: Slide in multi-thread environment

Posted by Ting Ning <ti...@yahoo.com>.
I enclose the OracleContentStore in this mail.

I use Slide 1.0.14, not the latest from CVS.

When the Slide is initialized, there is only one
database connection initialized. This is what I saw in
my test. The Slide code caches the sore in memory.
Please see Namespace.getUri(uri). Each Uri has store.
But each store is coned from the original one and does
re-connect if it is already connected.

In the test, multiple threads do the different
transactions on the same database connection. It will
returns error. The Oracle error is one of them.

It looks like this problem is related to "Slide
connection pool" problem. If we at least have one
database connection for each transaction, we are OK.
Or we need to implement the XA store.

Ting
--- Dirk Verbeeck <di...@pandora.be> wrote:
> Is it possible to send me your OracleContentStore ?
> Are you using the latest CVS version ?
> 
> When a thread starts a transaction with begin(), it
> reserves the store
> for private use.
> The other threads have to wait, they sleep 20x 50ms.
> (that code is in
> AbstractStore)
> If they can't reserve a store they get a
> ServiceAccessException.
> Below is what I get with cloudscape, with
> transactions enabled for the
> read.
> Thread 0 is able to grab the store and store
> /ORACLE0
> Thread 1 tries to get a store but is put to sleep.
> Thread 0 continues to put /ORACLE1, ...
> Thread 1 gets an ServiceAccessException and cannot
> store /IBM0 and tries
> to store /IBM1
> Thread 0 after putting /ORACLE9, start getting
> /ORACLE0 (inside a
> transaction and thus locking the store)
> Thread 1 gets an ServiceAccessException and cannot
> store /IBM1 and tries
> to store /IBM2
> Thread 0 is finished getting /ORACLE9
> Thread 1 can use the store to put /IBM2, ... (It
> receives
> ObjectNotFoundException for /IBM0 and /IBM1, they
> are not stored)
> 
> When that ORA-22990 is solved everything should be
> OK.
> 
> Some work is needed on the "read" methods, they
> should be synchronized
> on the DB connection I think.
> 
> 
> Regards
> Dirk
> 
> 
>
=========================================================
> 03 Oct 2001 23:15:15 -
> org.apache.slide.common.Domain - INFO - Domain
> initialization complete
> 
> Thread-0: Put uri = /ORACLE0
> 
> Thread-1: Put uri = /IBM0
> 
> Thread-0: Put uri = /ORACLE1
> 
> Thread-0: Put uri = /ORACLE2
> 
> Thread-0: Put uri = /ORACLE3
> 
> Thread-0: Put uri = /ORACLE4
> 
> Thread-0: Put uri = /ORACLE5
> 
> Thread-0: Put uri = /ORACLE6
> 
> Thread-0: Put uri = /ORACLE7
> 
> Thread-0: Put uri = /ORACLE8
> 
> Thread-0: Put uri = /ORACLE9
> 
> 03 Oct 2001 23:15:17 -
> org.apache.slide.common.Domain - WARNING -
> Service jdbc(org.apache.slide.store.StandardStore)
> access error : Failed
> to enlist service
>
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189
> in active
> transaction
> 
> >>>> org.apache.slide.common.ServiceAccessException:
> Service jdbc(org.apache.slide.store.StandardStore)
> access error : Failed to enlist service
>
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189
> in active transaction
> 
> Thread-1: Put uri = /IBM1
> 
> Thread-0: Get uri = /ORACLE0
> 
> Thread-0: Get uri = /ORACLE1
> 
> Thread-0: Get uri = /ORACLE2
> 
> Thread-0: Get uri = /ORACLE3
> 
> Thread-0: Get uri = /ORACLE4
> 
> Thread-0: Get uri = /ORACLE5
> 
> Thread-0: Get uri = /ORACLE6
> 
> Thread-0: Get uri = /ORACLE7
> 
> Thread-0: Get uri = /ORACLE8
> 
> Thread-0: Get uri = /ORACLE9
> 
> 03 Oct 2001 23:15:18 -
> org.apache.slide.common.Domain - WARNING -
> Service jdbc(org.apache.slide.store.StandardStore)
> access error : Failed
> to enlist service
>
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189
> in active
> transaction
> 
> >>>> org.apache.slide.common.ServiceAccessException:
> Service jdbc(org.apache.slide.store.StandardStore)
> access error : Failed to enlist service
>
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189
> in active transaction
> 
> Thread-1: Put uri = /IBM2
> 
> Thread-1: Put uri = /IBM3
> 
> Thread-1: Put uri = /IBM4
> 
> Thread-1: Put uri = /IBM5
> 
> Thread-1: Put uri = /IBM6
> 
> Thread-1: Put uri = /IBM7
> 
> Thread-1: Put uri = /IBM8
> 
> Thread-1: Put uri = /IBM9
> 
> Thread-1: Get uri = /IBM0
> 
> >>>>
> org.apache.slide.structure.ObjectNotFoundException:
> No object found at /IBM0
> 
> Thread-1: Get uri = /IBM1
> 
> >>>>
> org.apache.slide.structure.ObjectNotFoundException:
> No object found at /IBM1
> 
> Thread-1: Get uri = /IBM2
> 
> Thread-1: Get uri = /IBM3
> 
> Thread-1: Get uri = /IBM4
> 
> Thread-1: Get uri = /IBM5
> 
> Thread-1: Get uri = /IBM6
> 
> Thread-1: Get uri = /IBM7
> 
> Thread-1: Get uri = /IBM8
> 
> Thread-1: Get uri = /IBM9


__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

Re: Slide in multi-thread environment

Posted by Dirk Verbeeck <di...@pandora.be>.
Is it possible to send me your OracleContentStore ?
Are you using the latest CVS version ?

When a thread starts a transaction with begin(), it reserves the store
for private use.
The other threads have to wait, they sleep 20x 50ms. (that code is in
AbstractStore)
If they can't reserve a store they get a ServiceAccessException.
Below is what I get with cloudscape, with transactions enabled for the
read.
Thread 0 is able to grab the store and store /ORACLE0
Thread 1 tries to get a store but is put to sleep.
Thread 0 continues to put /ORACLE1, ...
Thread 1 gets an ServiceAccessException and cannot store /IBM0 and tries
to store /IBM1
Thread 0 after putting /ORACLE9, start getting /ORACLE0 (inside a
transaction and thus locking the store)
Thread 1 gets an ServiceAccessException and cannot store /IBM1 and tries
to store /IBM2
Thread 0 is finished getting /ORACLE9
Thread 1 can use the store to put /IBM2, ... (It receives
ObjectNotFoundException for /IBM0 and /IBM1, they are not stored)

When that ORA-22990 is solved everything should be OK.

Some work is needed on the "read" methods, they should be synchronized
on the DB connection I think.


Regards
Dirk


=========================================================
03 Oct 2001 23:15:15 - org.apache.slide.common.Domain - INFO - Domain
initialization complete

Thread-0: Put uri = /ORACLE0

Thread-1: Put uri = /IBM0

Thread-0: Put uri = /ORACLE1

Thread-0: Put uri = /ORACLE2

Thread-0: Put uri = /ORACLE3

Thread-0: Put uri = /ORACLE4

Thread-0: Put uri = /ORACLE5

Thread-0: Put uri = /ORACLE6

Thread-0: Put uri = /ORACLE7

Thread-0: Put uri = /ORACLE8

Thread-0: Put uri = /ORACLE9

03 Oct 2001 23:15:17 - org.apache.slide.common.Domain - WARNING -
Service jdbc(org.apache.slide.store.StandardStore) access error : Failed
to enlist service
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189 in active
transaction

>>>> org.apache.slide.common.ServiceAccessException: Service jdbc(org.apache.slide.store.StandardStore) access error : Failed to enlist service slidestore.cloudscape.CloudscapeDescriptorsStore@18d189 in active transaction

Thread-1: Put uri = /IBM1

Thread-0: Get uri = /ORACLE0

Thread-0: Get uri = /ORACLE1

Thread-0: Get uri = /ORACLE2

Thread-0: Get uri = /ORACLE3

Thread-0: Get uri = /ORACLE4

Thread-0: Get uri = /ORACLE5

Thread-0: Get uri = /ORACLE6

Thread-0: Get uri = /ORACLE7

Thread-0: Get uri = /ORACLE8

Thread-0: Get uri = /ORACLE9

03 Oct 2001 23:15:18 - org.apache.slide.common.Domain - WARNING -
Service jdbc(org.apache.slide.store.StandardStore) access error : Failed
to enlist service
slidestore.cloudscape.CloudscapeDescriptorsStore@18d189 in active
transaction

>>>> org.apache.slide.common.ServiceAccessException: Service jdbc(org.apache.slide.store.StandardStore) access error : Failed to enlist service slidestore.cloudscape.CloudscapeDescriptorsStore@18d189 in active transaction

Thread-1: Put uri = /IBM2

Thread-1: Put uri = /IBM3

Thread-1: Put uri = /IBM4

Thread-1: Put uri = /IBM5

Thread-1: Put uri = /IBM6

Thread-1: Put uri = /IBM7

Thread-1: Put uri = /IBM8

Thread-1: Put uri = /IBM9

Thread-1: Get uri = /IBM0

>>>> org.apache.slide.structure.ObjectNotFoundException: No object found at /IBM0

Thread-1: Get uri = /IBM1

>>>> org.apache.slide.structure.ObjectNotFoundException: No object found at /IBM1

Thread-1: Get uri = /IBM2

Thread-1: Get uri = /IBM3

Thread-1: Get uri = /IBM4

Thread-1: Get uri = /IBM5

Thread-1: Get uri = /IBM6

Thread-1: Get uri = /IBM7

Thread-1: Get uri = /IBM8

Thread-1: Get uri = /IBM9

Re: Slide in multi-thread environment

Posted by Ting Ning <ti...@yahoo.com>.
Hi, Dirk,

Thanks for the reply!

I get the error in "put" part of my test.

I try test with your modifications. I get the same
error as before. It fails at "put" when two threads
try to put the different contents into Slide. The
Oracle error is:
02 Oct 2001 17:27:54 -
slidestore.reference.OracleContentStore - ERROR -
java.io.IOException: ORA-22990: LOB locators cannot
span transactions
ORA-06512: at "SYS.DBMS_LOB", line 700
ORA-06512: at line 1
I will enlcose the stack trace in the end of email.

The above error is caused by the two threads use the
same database connection to do the transaciton on
Oracle database.

I look at your modifications. You create two tokens, 
token and token2. They are related to same namespace.
There is only one copy of namespace in the JVM. There
is only one database connection in this test. It
causes the problem.

Please advise.

Thanks in advance.

Ting

PS. For large LOB inserting into Oracle, the simple
insert statement does not work. I modify the
JDBCContentStore for Oracle and make it
OracleContentStore.

Here are the stack trace:

java.io.IOException: ORA-22990: LOB locators cannot
span transactions
ORA-06512: at "SYS.DBMS_LOB", line 700
ORA-06512: at line 1

        at
oracle.jdbc.dbaccess.DBError.SQLToIOExceptio
(DBError.java:531)
        at
oracle.jdbc.driver.OracleBlobOutputStream.flushBuffer(OracleBlobOutpu
tStream.java:179)
        at
oracle.jdbc.driver.OracleBlobOutputStream.write(OracleBlobOutputStrea
m.java:125)
        at
slidestore.reference.OracleContentStore.storeContent(OracleContentSto
re.java:619)
        at
slidestore.reference.OracleContentStore.createRevisionContent(OracleC
ontentStore.java:471)
        at
org.apache.slide.store.AbstractStore.createRevisionContent(AbstractSt
ore.java:1205)
        at
org.apache.slide.store.StandardStore.createRevisionContent(StandardSt
ore.java:654)
        at
org.apache.slide.content.ContentImpl.create(ContentImpl.java:483)
        at TestThread.run(TestThread.java:75)
        at java.lang.Thread.run(Thread.java:484)

--- Dirk Verbeeck <di...@pandora.be> wrote:
> Hi
> 
> Sorry for the late reply but I wanted to try the
> test myself.
> Are you getting an error in the "get" part of your
> test ?
> I don't have oracle installed but have modified your
> example
> can you try this with use_transaction set to true
> and also with false ?
> 
> 
> Dirk
> 
> 
> 
> Ting Ning wrote:
> 
> > Hi,
> >
> > I write a small test program to test slide in
> > multi-threads env. I enclose my test program here.
> > Please take look at it. The NamespaceAccessToken
> is
> > initialized in the main program. Then it is passed
> to
> > the different thread. Each thread just puts the
> files
> > into Slide, and gets it back into file. Each
> thread
> > works on different file.
> >
> > I run the test program with Slide 1.0.14 with
> Oracle
> > database as descriptor and content stores. I get
> the
> > error like the transaction is not consistent, for
> > example, the Oracle error is "fetch out of
> sequence".
> > It is because that connection is shared between
> the
> > two thread.
> >
> > After doing some debug, I found out there is only
> one
> > database connection in this Slide test. This is
> why my
> > test fails.
> >
> > Do I do the right thing in this test?
> > If not, how can I do it?
> >
> > Any suggestions are welcome!
> >
> > Thanks in Advance.
> >
> > Ting
> 

> ATTACHMENT part 2
application/x-unknown-content-type-javafile
name=TestThread.java


> ATTACHMENT part 3
application/x-unknown-content-type-javafile
name=Test2.java



__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com