You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Bram Pouwelse <br...@pouwelse.com> on 2016/06/10 12:45:41 UTC

BlobStore#clearContainer never returns after closing BlobStoreContext

Hi,

I'm running into some never ending integration tests in my prohect after
upgrading jcouds to 1.9.2, this seems to be caused by calling
BlobStore#clearContainer after the BlobStoreContext has been closed. I've
attached a patch to demonstrate this issue using the
org.jclouds.blobstore.integration.TransientServiceIntegrationTest at the
end of this mail.

After figuring out the root cause of my problem I did some more tests and I
don't really get what the close method is supposed to do, If I try the same
using the filesystem provider there is no issue? How is it possible the
BlobStoreContext (and BlobStore instances created from that context) are
still usable after closing the context?

Regards,
Bram

Patch (tested on the 1.9.x branch):

diff --git
a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
index eeaaf96..e63cef6 100644
---
a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
+++
b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
@@ -16,6 +16,8 @@
  */
 package org.jclouds.blobstore.integration;

+import org.jclouds.blobstore.BlobStore;
+
 import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
 import org.testng.annotations.Test;

@@ -24,4 +26,13 @@ public class TransientBlobIntegrationTest extends
BaseBlobIntegrationTest {
    public TransientBlobIntegrationTest() {
       provider = "transient";
    }
+
+   @Test(groups = { "integration"})
+   public void testClearContainerAfterCloseNeverEnds() throws Exception {
+        BlobStore blobStore = view.getBlobStore();
+        blobStore.createContainerInLocation(null, "test");
+        blobStore.putBlob("test",
blobStore.blobBuilder("dummy").payload("test".getBytes()).build());
+    view.close();
+        blobStore.clearContainer("test");
+   }
 }

Re: BlobStore#clearContainer never returns after closing BlobStoreContext

Posted by Andrew Gaul <ga...@apache.org>.
Agreed.  Would you like to submit a pull request via GitHub?  You can
find instructions here:

https://www.openhub.net/accounts/khc

On Mon, Jun 13, 2016 at 10:26:07AM +0000, Bram Pouwelse wrote:
> Thanks for the quick response Andrew!
> 
> If I understand correctly closing the context destroys the ExecutorService
> but after that is is still possible to use the context for operations that
> don't need this Executor service? That feels a bit weird, I get that I
> shouldn't use the context after closing but in case I made a mistake and do
> use it after closing I'd personally prefer to get something like a
> ContextClosedException instead of a method call that never returns.
> 
> Regards,
> Bram
> 
> 
> On Fri, Jun 10, 2016 at 6:34 PM Andrew Gaul <ga...@apache.org> wrote:
> 
> > Bram, you cannot use the BlobStoreContext or BlobStore view after
> > closing it.  Closing destroys the ExecutorService that clearContainer
> > uses to issue asynchronous operations.
> 
> The filesystem provider does not
> > use asynchronous operations and thus does not have this issue.  In the
> > future jclouds will remove its ExecutorService and require that callers
> > provide an external one for asynchronous calls like clearContainer.
> >
> > On Fri, Jun 10, 2016 at 12:45:41PM +0000, Bram Pouwelse wrote:
> > > Hi,
> > >
> > > I'm running into some never ending integration tests in my prohect after
> > > upgrading jcouds to 1.9.2, this seems to be caused by calling
> > > BlobStore#clearContainer after the BlobStoreContext has been closed. I've
> > > attached a patch to demonstrate this issue using the
> > > org.jclouds.blobstore.integration.TransientServiceIntegrationTest at the
> > > end of this mail.
> > >
> > > After figuring out the root cause of my problem I did some more tests
> > and I
> > > don't really get what the close method is supposed to do, If I try the
> > same
> > > using the filesystem provider there is no issue? How is it possible the
> > > BlobStoreContext (and BlobStore instances created from that context) are
> > > still usable after closing the context?
> > >
> > > Regards,
> > > Bram
> > >
> > > Patch (tested on the 1.9.x branch):
> > >
> > > diff --git
> > >
> > a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > >
> > b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > > index eeaaf96..e63cef6 100644
> > > ---
> > >
> > a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > > +++
> > >
> > b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > > @@ -16,6 +16,8 @@
> > >   */
> > >  package org.jclouds.blobstore.integration;
> > >
> > > +import org.jclouds.blobstore.BlobStore;
> > > +
> > >  import
> > org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
> > >  import org.testng.annotations.Test;
> > >
> > > @@ -24,4 +26,13 @@ public class TransientBlobIntegrationTest extends
> > > BaseBlobIntegrationTest {
> > >     public TransientBlobIntegrationTest() {
> > >        provider = "transient";
> > >     }
> > > +
> > > +   @Test(groups = { "integration"})
> > > +   public void testClearContainerAfterCloseNeverEnds() throws Exception
> > {
> > > +        BlobStore blobStore = view.getBlobStore();
> > > +        blobStore.createContainerInLocation(null, "test");
> > > +        blobStore.putBlob("test",
> > > blobStore.blobBuilder("dummy").payload("test".getBytes()).build());
> > > +    view.close();
> > > +        blobStore.clearContainer("test");
> > > +   }
> > >  }
> >
> > --
> > Andrew Gaul
> > http://gaul.org/
> >

-- 
Andrew Gaul
http://gaul.org/

Re: BlobStore#clearContainer never returns after closing BlobStoreContext

Posted by Bram Pouwelse <br...@pouwelse.com>.
Thanks for the quick response Andrew!

If I understand correctly closing the context destroys the ExecutorService
but after that is is still possible to use the context for operations that
don't need this Executor service? That feels a bit weird, I get that I
shouldn't use the context after closing but in case I made a mistake and do
use it after closing I'd personally prefer to get something like a
ContextClosedException instead of a method call that never returns.

Regards,
Bram


On Fri, Jun 10, 2016 at 6:34 PM Andrew Gaul <ga...@apache.org> wrote:

> Bram, you cannot use the BlobStoreContext or BlobStore view after
> closing it.  Closing destroys the ExecutorService that clearContainer
> uses to issue asynchronous operations.

The filesystem provider does not
> use asynchronous operations and thus does not have this issue.  In the
> future jclouds will remove its ExecutorService and require that callers
> provide an external one for asynchronous calls like clearContainer.
>
> On Fri, Jun 10, 2016 at 12:45:41PM +0000, Bram Pouwelse wrote:
> > Hi,
> >
> > I'm running into some never ending integration tests in my prohect after
> > upgrading jcouds to 1.9.2, this seems to be caused by calling
> > BlobStore#clearContainer after the BlobStoreContext has been closed. I've
> > attached a patch to demonstrate this issue using the
> > org.jclouds.blobstore.integration.TransientServiceIntegrationTest at the
> > end of this mail.
> >
> > After figuring out the root cause of my problem I did some more tests
> and I
> > don't really get what the close method is supposed to do, If I try the
> same
> > using the filesystem provider there is no issue? How is it possible the
> > BlobStoreContext (and BlobStore instances created from that context) are
> > still usable after closing the context?
> >
> > Regards,
> > Bram
> >
> > Patch (tested on the 1.9.x branch):
> >
> > diff --git
> >
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> >
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > index eeaaf96..e63cef6 100644
> > ---
> >
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > +++
> >
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> > @@ -16,6 +16,8 @@
> >   */
> >  package org.jclouds.blobstore.integration;
> >
> > +import org.jclouds.blobstore.BlobStore;
> > +
> >  import
> org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
> >  import org.testng.annotations.Test;
> >
> > @@ -24,4 +26,13 @@ public class TransientBlobIntegrationTest extends
> > BaseBlobIntegrationTest {
> >     public TransientBlobIntegrationTest() {
> >        provider = "transient";
> >     }
> > +
> > +   @Test(groups = { "integration"})
> > +   public void testClearContainerAfterCloseNeverEnds() throws Exception
> {
> > +        BlobStore blobStore = view.getBlobStore();
> > +        blobStore.createContainerInLocation(null, "test");
> > +        blobStore.putBlob("test",
> > blobStore.blobBuilder("dummy").payload("test".getBytes()).build());
> > +    view.close();
> > +        blobStore.clearContainer("test");
> > +   }
> >  }
>
> --
> Andrew Gaul
> http://gaul.org/
>

Re: BlobStore#clearContainer never returns after closing BlobStoreContext

Posted by Andrew Gaul <ga...@apache.org>.
Bram, you cannot use the BlobStoreContext or BlobStore view after
closing it.  Closing destroys the ExecutorService that clearContainer
uses to issue asynchronous operations.  The filesystem provider does not
use asynchronous operations and thus does not have this issue.  In the
future jclouds will remove its ExecutorService and require that callers
provide an external one for asynchronous calls like clearContainer.

On Fri, Jun 10, 2016 at 12:45:41PM +0000, Bram Pouwelse wrote:
> Hi,
> 
> I'm running into some never ending integration tests in my prohect after
> upgrading jcouds to 1.9.2, this seems to be caused by calling
> BlobStore#clearContainer after the BlobStoreContext has been closed. I've
> attached a patch to demonstrate this issue using the
> org.jclouds.blobstore.integration.TransientServiceIntegrationTest at the
> end of this mail.
> 
> After figuring out the root cause of my problem I did some more tests and I
> don't really get what the close method is supposed to do, If I try the same
> using the filesystem provider there is no issue? How is it possible the
> BlobStoreContext (and BlobStore instances created from that context) are
> still usable after closing the context?
> 
> Regards,
> Bram
> 
> Patch (tested on the 1.9.x branch):
> 
> diff --git
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> index eeaaf96..e63cef6 100644
> ---
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> +++
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> @@ -16,6 +16,8 @@
>   */
>  package org.jclouds.blobstore.integration;
> 
> +import org.jclouds.blobstore.BlobStore;
> +
>  import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
>  import org.testng.annotations.Test;
> 
> @@ -24,4 +26,13 @@ public class TransientBlobIntegrationTest extends
> BaseBlobIntegrationTest {
>     public TransientBlobIntegrationTest() {
>        provider = "transient";
>     }
> +
> +   @Test(groups = { "integration"})
> +   public void testClearContainerAfterCloseNeverEnds() throws Exception {
> +        BlobStore blobStore = view.getBlobStore();
> +        blobStore.createContainerInLocation(null, "test");
> +        blobStore.putBlob("test",
> blobStore.blobBuilder("dummy").payload("test".getBytes()).build());
> +    view.close();
> +        blobStore.clearContainer("test");
> +   }
>  }

-- 
Andrew Gaul
http://gaul.org/