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 Stefan Fromm <sf...@inf.tu-dresden.de> on 2004/08/13 14:03:55 UTC

getting content stream

Hello,

I try to get the content stream of a resource. This happens NOT inside a transaction with these statements:

	String uri = ...;
	NodeRevisionDescriptors revisions = content.retrieve(slideToken, uri);
	NodeRevisionDescriptor revision = content.retrieve(slideToken, revisions);
	NodeRevisionContent revisionContent = content.retrieve(slideToken, revisions, revision);
	return revisionContent.streamContent();

This delivers the content stream as expected. It can be read successfully. After having used the InputStream it is closed by calling its close() method. Then there follows a Macro.remove(...) inside a transaction which includes the resource to be deleted. I receive the error attached at the end after - as it seems - a timeout.

It seems to me that Slide cannot acquire a lock on a resource to delete. Does getting the input stream lock the resource? And how to release the lock? If this is the problem...

I use Slide 2.1b1 storing content and metadata in the file system. All features are switched on in slide.properties. When I ran the same test against Slide 2.0 it worked. Has something changed?

Very pleased about hints
Stefan


Re: getting content stream

Posted by Stefan Fromm <sf...@inf.tu-dresden.de>.
Ok, I started over with a plain Java class which implemented these tests. As you expected: no error! I tested my piece of code in the future production environment: no error! So I don't know where to search. Obviously it's not Slide. Good news :)

I'm writing a content adapter for a VFS based on the NetBeans FileSystems which accesses a Slide repository. I ran the tests for this adapter with JUnit. The creation and deletion of the test repository happens in the setUp() and tearDown() methods. The content stream is opened and closed in the testXXX() method. Maybe there are some interferences whether with JUnit or with the NetBeans FileSystems. I guess JUnit because I had no problems in the production environment.

So have nice holidays!
Regards, Stefan



Am Fri, 13 Aug 2004 16:44:33 +0200 schrieb Oliver Zeigermann <ol...@zeigermann.de>:

> Are you sure the exeception, really, really is the same? I can not believe this... Could you please give the error for all cases?
>
> Anyway, could you provide the full code fragment that leads to this problem? Just to make sure there are no extra calls done?
>
> Oliver
>
> Stefan Fromm wrote:
>
>> Hej,
>>
>> I've found out that it doesn't depend on the way how transactions are used (retrieval and delete in own transactions, retrieval in no transaction, retrieval and deletion in same transaction). The problem is the following. I've got this resource tree in the Slide repository:
>>
>> files/
>>   + editorial/
>>       + test.txt
>>
>> I read the content stream of "test.txt". When I delete "test.txt" right afterwards with the Macro helper, then this deletion can be performed. But removal of the parent collection "editorial" produces the error (independent of if "test.txt" still exists or was removed by the Macro.remove() before).
>>
>> Stefan
>>
>>
>>
>> Am Fri, 13 Aug 2004 14:17:36 +0200 schrieb Oliver Zeigermann <ol...@zeigermann.de>:
>>
>>> Stefan Fromm wrote:
>>>
>>>> Hello,
>>>>
>>>> I try to get the content stream of a resource. This happens NOT inside a transaction with these statements:
>>>>
>>>>     String uri = ...;
>>>>     NodeRevisionDescriptors revisions = content.retrieve(slideToken, uri);
>>>>     NodeRevisionDescriptor revision = content.retrieve(slideToken, revisions);
>>>>     NodeRevisionContent revisionContent = content.retrieve(slideToken, revisions, revision);
>>>>     return revisionContent.streamContent();
>>>>
>>>> This delivers the content stream as expected. It can be read successfully. After having used the InputStream it is closed by calling its close() method. Then there follows a Macro.remove(...) inside a transaction which includes the resource to be deleted. I receive the error attached at the end after - as it seems - a timeout.
>>>>
>>>> It seems to me that Slide cannot acquire a lock on a resource to delete. Does getting the input stream lock the resource? And how to release the lock? If this is the problem...
>>>
>>>
>>> Retrieving the revision content acquires a lock on the resource. It should be released when the input stream gets closed. Judging from the stack trace I'd say the read lock has not been released. Are you very sure that you actually close the input stream? If so, maybe it might be a bug in Slide. This, however, would surprise me as the stuff above is done all the time.
>>>
>>> Try running the above retrieval either in a transaction of its own or inside the same transaction as the remove. You should observe a different problem or none at all...
>>>
>>> Please report back,
>>>
>>> Oliver
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: getting content stream

Posted by Oliver Zeigermann <ol...@zeigermann.de>.
Are you sure the exeception, really, really is the same? I can not 
believe this... Could you please give the error for all cases?

Anyway, could you provide the full code fragment that leads to this 
problem? Just to make sure there are no extra calls done?

Oliver

Stefan Fromm wrote:

> Hej,
> 
> I've found out that it doesn't depend on the way how transactions are 
> used (retrieval and delete in own transactions, retrieval in no 
> transaction, retrieval and deletion in same transaction). The problem is 
> the following. I've got this resource tree in the Slide repository:
> 
> files/
>   + editorial/
>       + test.txt
> 
> I read the content stream of "test.txt". When I delete "test.txt" right 
> afterwards with the Macro helper, then this deletion can be performed. 
> But removal of the parent collection "editorial" produces the error 
> (independent of if "test.txt" still exists or was removed by the 
> Macro.remove() before).
> 
> Stefan
> 
> 
> 
> Am Fri, 13 Aug 2004 14:17:36 +0200 schrieb Oliver Zeigermann 
> <ol...@zeigermann.de>:
> 
>> Stefan Fromm wrote:
>>
>>> Hello,
>>>
>>> I try to get the content stream of a resource. This happens NOT 
>>> inside a transaction with these statements:
>>>
>>>     String uri = ...;
>>>     NodeRevisionDescriptors revisions = content.retrieve(slideToken, 
>>> uri);
>>>     NodeRevisionDescriptor revision = content.retrieve(slideToken, 
>>> revisions);
>>>     NodeRevisionContent revisionContent = 
>>> content.retrieve(slideToken, revisions, revision);
>>>     return revisionContent.streamContent();
>>>
>>> This delivers the content stream as expected. It can be read 
>>> successfully. After having used the InputStream it is closed by 
>>> calling its close() method. Then there follows a Macro.remove(...) 
>>> inside a transaction which includes the resource to be deleted. I 
>>> receive the error attached at the end after - as it seems - a timeout.
>>>
>>> It seems to me that Slide cannot acquire a lock on a resource to 
>>> delete. Does getting the input stream lock the resource? And how to 
>>> release the lock? If this is the problem...
>>
>>
>> Retrieving the revision content acquires a lock on the resource. It 
>> should be released when the input stream gets closed. Judging from the 
>> stack trace I'd say the read lock has not been released. Are you very 
>> sure that you actually close the input stream? If so, maybe it might 
>> be a bug in Slide. This, however, would surprise me as the stuff above 
>> is done all the time.
>>
>> Try running the above retrieval either in a transaction of its own or 
>> inside the same transaction as the remove. You should observe a 
>> different problem or none at all...
>>
>> Please report back,
>>
>> Oliver
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: getting content stream

Posted by Stefan Fromm <sf...@inf.tu-dresden.de>.
Hej,

I've found out that it doesn't depend on the way how transactions are used (retrieval and delete in own transactions, retrieval in no transaction, retrieval and deletion in same transaction). The problem is the following. I've got this resource tree in the Slide repository:

files/
   + editorial/
       + test.txt

I read the content stream of "test.txt". When I delete "test.txt" right afterwards with the Macro helper, then this deletion can be performed. But removal of the parent collection "editorial" produces the error (independent of if "test.txt" still exists or was removed by the Macro.remove() before).

Stefan



Am Fri, 13 Aug 2004 14:17:36 +0200 schrieb Oliver Zeigermann <ol...@zeigermann.de>:

> Stefan Fromm wrote:
>
>> Hello,
>>
>> I try to get the content stream of a resource. This happens NOT inside a transaction with these statements:
>>
>>     String uri = ...;
>>     NodeRevisionDescriptors revisions = content.retrieve(slideToken, uri);
>>     NodeRevisionDescriptor revision = content.retrieve(slideToken, revisions);
>>     NodeRevisionContent revisionContent = content.retrieve(slideToken, revisions, revision);
>>     return revisionContent.streamContent();
>>
>> This delivers the content stream as expected. It can be read successfully. After having used the InputStream it is closed by calling its close() method. Then there follows a Macro.remove(...) inside a transaction which includes the resource to be deleted. I receive the error attached at the end after - as it seems - a timeout.
>>
>> It seems to me that Slide cannot acquire a lock on a resource to delete. Does getting the input stream lock the resource? And how to release the lock? If this is the problem...
>
> Retrieving the revision content acquires a lock on the resource. It should be released when the input stream gets closed. Judging from the stack trace I'd say the read lock has not been released. Are you very sure that you actually close the input stream? If so, maybe it might be a bug in Slide. This, however, would surprise me as the stuff above is done all the time.
>
> Try running the above retrieval either in a transaction of its own or inside the same transaction as the remove. You should observe a different problem or none at all...
>
> Please report back,
>
> Oliver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: getting content stream

Posted by Oliver Zeigermann <ol...@zeigermann.de>.
Stefan Fromm wrote:

> Hello,
> 
> I try to get the content stream of a resource. This happens NOT inside a 
> transaction with these statements:
> 
>     String uri = ...;
>     NodeRevisionDescriptors revisions = content.retrieve(slideToken, uri);
>     NodeRevisionDescriptor revision = content.retrieve(slideToken, 
> revisions);
>     NodeRevisionContent revisionContent = content.retrieve(slideToken, 
> revisions, revision);
>     return revisionContent.streamContent();
> 
> This delivers the content stream as expected. It can be read 
> successfully. After having used the InputStream it is closed by calling 
> its close() method. Then there follows a Macro.remove(...) inside a 
> transaction which includes the resource to be deleted. I receive the 
> error attached at the end after - as it seems - a timeout.
> 
> It seems to me that Slide cannot acquire a lock on a resource to delete. 
> Does getting the input stream lock the resource? And how to release the 
> lock? If this is the problem...

Retrieving the revision content acquires a lock on the resource. It 
should be released when the input stream gets closed. Judging from the 
stack trace I'd say the read lock has not been released. Are you very 
sure that you actually close the input stream? If so, maybe it might be 
a bug in Slide. This, however, would surprise me as the stuff above is 
done all the time.

Try running the above retrieval either in a transaction of its own or 
inside the same transaction as the remove. You should observe a 
different problem or none at all...

Please report back,

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org