Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

Scott Marlow
Often when running a NoSQL unit test, I'm seeing a NPE in
org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved().  I
understand that we should never allow a NullPointerException to be
thrown, however, does anyone know what the correct course of action
should be?  Ensuring that ejbComponent.getCache() never returns null
could be one approach.  Or perhaps callers to ejbComponent.getCache()
should check for null being returned.  Could there be a missing
application dependency on the cache?

StatefulSessionObjectReferenceImpl currently contains:

@Override
public boolean isRemoved() {
   if (!removed) {
     return !ejbComponent.getCache().contains(id);
   }
   return true;
}

Thanks,
Scott

[1] https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

James Perkins
I think you need to look at why the cache is null. In the org.jboss.as.ejb3.component.stateful.StatefulSessionComponent it's only null if the start of the component hasn't been invoked or the done method was invoked.

On Thu, Jul 7, 2016 at 9:23 AM, Scott Marlow <[hidden email]> wrote:
Often when running a NoSQL unit test, I'm seeing a NPE in
org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved().  I
understand that we should never allow a NullPointerException to be
thrown, however, does anyone know what the correct course of action
should be?  Ensuring that ejbComponent.getCache() never returns null
could be one approach.  Or perhaps callers to ejbComponent.getCache()
should check for null being returned.  Could there be a missing
application dependency on the cache?

StatefulSessionObjectReferenceImpl currently contains:

@Override
public boolean isRemoved() {
   if (!removed) {
     return !ejbComponent.getCache().contains(id);
   }
   return true;
}

Thanks,
Scott

[1] https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev



--
James R. Perkins
JBoss by Red Hat

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

Scott Marlow


On 07/07/2016 01:13 PM, James Perkins wrote:
> I think you need to look at why the cache is null. In
> the org.jboss.as.ejb3.component.stateful.StatefulSessionComponent it's
> only null if the start of the component hasn't been invoked or the done
> method was invoked.

 From the call stack, we must of called "done" already, as the cache
would of been used previously during the test (implying that it was
non-null previously).


[1]
https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9#file-gistfile1-txt-L41

>
> On Thu, Jul 7, 2016 at 9:23 AM, Scott Marlow <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Often when running a NoSQL unit test, I'm seeing a NPE in
>     org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved().  I
>     understand that we should never allow a NullPointerException to be
>     thrown, however, does anyone know what the correct course of action
>     should be?  Ensuring that ejbComponent.getCache() never returns null
>     could be one approach.  Or perhaps callers to ejbComponent.getCache()
>     should check for null being returned.  Could there be a missing
>     application dependency on the cache?
>
>     StatefulSessionObjectReferenceImpl currently contains:
>
>     @Override
>     public boolean isRemoved() {
>        if (!removed) {
>          return !ejbComponent.getCache().contains(id);
>        }
>        return true;
>     }
>
>     Thanks,
>     Scott
>
>     [1] https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9
>     _______________________________________________
>     wildfly-dev mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
>
>
>
> --
> James R. Perkins
> JBoss by Red Hat
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

Scott Marlow
https://issues.jboss.org/browse/WFLY-5208 seems to be related and
mention that we can't fix the NPE and if we did fix it, there would be
other errors, caused by "deployment is being torn down while the app is
still processing requests".

On 07/07/2016 01:27 PM, Scott Marlow wrote:

>
>
> On 07/07/2016 01:13 PM, James Perkins wrote:
>> I think you need to look at why the cache is null. In
>> the org.jboss.as.ejb3.component.stateful.StatefulSessionComponent it's
>> only null if the start of the component hasn't been invoked or the done
>> method was invoked.
>
>  From the call stack, we must of called "done" already, as the cache
> would of been used previously during the test (implying that it was
> non-null previously).
>
>
> [1]
> https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9#file-gistfile1-txt-L41
>>
>> On Thu, Jul 7, 2016 at 9:23 AM, Scott Marlow <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Often when running a NoSQL unit test, I'm seeing a NPE in
>>     org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved().  I
>>     understand that we should never allow a NullPointerException to be
>>     thrown, however, does anyone know what the correct course of action
>>     should be?  Ensuring that ejbComponent.getCache() never returns null
>>     could be one approach.  Or perhaps callers to ejbComponent.getCache()
>>     should check for null being returned.  Could there be a missing
>>     application dependency on the cache?
>>
>>     StatefulSessionObjectReferenceImpl currently contains:
>>
>>     @Override
>>     public boolean isRemoved() {
>>        if (!removed) {
>>          return !ejbComponent.getCache().contains(id);
>>        }
>>        return true;
>>     }
>>
>>     Thanks,
>>     Scott
>>
>>     [1] https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9
>>     _______________________________________________
>>     wildfly-dev mailing list
>>     [hidden email] <mailto:[hidden email]>
>>     https://lists.jboss.org/mailman/listinfo/wildfly-dev
>>
>>
>>
>>
>> --
>> James R. Perkins
>> JBoss by Red Hat
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Seeing NPE in org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved() during NoSQL testing, how to fix?

James Perkins
Yes I think that makes sense. 

On Thu, Jul 7, 2016 at 12:50 PM, Scott Marlow <[hidden email]> wrote:
https://issues.jboss.org/browse/WFLY-5208 seems to be related and mention that we can't fix the NPE and if we did fix it, there would be other errors, caused by "deployment is being torn down while the app is still processing requests".


On 07/07/2016 01:27 PM, Scott Marlow wrote:


On 07/07/2016 01:13 PM, James Perkins wrote:
I think you need to look at why the cache is null. In
the org.jboss.as.ejb3.component.stateful.StatefulSessionComponent it's
only null if the start of the component hasn't been invoked or the done
method was invoked.

 From the call stack, we must of called "done" already, as the cache
would of been used previously during the test (implying that it was
non-null previously).


[1]
https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9#file-gistfile1-txt-L41

On Thu, Jul 7, 2016 at 9:23 AM, Scott Marlow <[hidden email]
<mailto:[hidden email]>> wrote:

    Often when running a NoSQL unit test, I'm seeing a NPE in
    org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.isRemoved().  I
    understand that we should never allow a NullPointerException to be
    thrown, however, does anyone know what the correct course of action
    should be?  Ensuring that ejbComponent.getCache() never returns null
    could be one approach.  Or perhaps callers to ejbComponent.getCache()
    should check for null being returned.  Could there be a missing
    application dependency on the cache?

    StatefulSessionObjectReferenceImpl currently contains:

    @Override
    public boolean isRemoved() {
       if (!removed) {
         return !ejbComponent.getCache().contains(id);
       }
       return true;
    }

    Thanks,
    Scott

    [1] https://gist.github.com/scottmarlow/9f9822e9d4609850d49099c3c5234ed9
    _______________________________________________
    wildfly-dev mailing list
    [hidden email] <mailto:[hidden email]>
    https://lists.jboss.org/mailman/listinfo/wildfly-dev




--
James R. Perkins
JBoss by Red Hat
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev




--
James R. Perkins
JBoss by Red Hat

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev