You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ryan Moquin <fr...@gmail.com> on 2008/06/13 22:23:21 UTC

NPE errors in DeliveryChannel

Out of curiosity.. is it possible for the quartz component in servicemix to
"start up too quickly" and fire off a message to a service before it's
ready?  I've been seeing errors like this a lot more during start up and I'm
not sure why.. but it always seems to be related to the delivery channel:

WARN  - DeliveryChannelImpl            - Error calling listener: null
java.lang.NullPointerException
        at
org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
        at
org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
WARN  - DeliveryChannelImpl            - Error calling listener: null
java.lang.NullPointerException
        at
org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
        at
org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Another one is:

ERROR - BeanComponent                  - Error processing exchange InOnly[
  id: ID:192.168.1.2-11a83961a1c-9:1
  status: Active
  role: provider
  service: {urn://myservice}notification-service
  endpoint: endpoint
  in: <?xml version="1.0"
encoding="UTF-8"?><timer><name>{urn://myservice}service-invoker:endpoint</name><group>DEFAULT</group><fullname>DEFAULT.{urn://myservice}service-
invoker:endpoint</fullname><description/><fireTime>Fri Jun 13 16:21:13 EDT
2008</fireTime></timer>
]
java.lang.NullPointerException
        at
org.apache.servicemix.bean.BeanEndpoint.getCorrelationExpression(BeanEndpoint.java:421)
        at
org.apache.servicemix.bean.BeanEndpoint.getCorrelation(BeanEndpoint.java:298)
        at
org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:218)
        at
org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
        at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Any ideas?

Thanks!
Ryan

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
But doesn't that mean it's local to the thread, and any thread that accesses
it, will use the same one?  I'm trying to send the exchange from the same
thread....

On Mon, Jun 23, 2008 at 3:07 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> The currentRequest is a thread local variable, so if another exchange
> is handled it should not damage the processing of another thread.
>
> On Mon, Jun 23, 2008 at 8:45 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Could someone on the servicemix team verify this rationale for me?  I
> think
> > I figured out my problem, which is a race condition in Servicemix (which
> of
> > course is exploited more on a faster machine).  I'm not sure what the
> best
> > solution to work around this problem is, and I am on a short timeframe
> since
> > of course this problem really only plagues our production environment and
> > not our dev or test environment.  Anyhow, I have a servicemix-bean
> component
> > that is taking an input, performing some analysis on it, and then sending
> it
> > back out to a JMS topic.  In order to send it back out, I'm using the
> > DeliveryChannel that is injected into my bean.  This sharing of the
> delivery
> > channel is what is causing the race condition, here is the reason.  The
> > exceptions I've been mentioning are referring to the following line:
> >
> > requests.put(messageExchange.getExchangeId(), currentRequest.get());
> >
> > This line is dependant upon the request I'm building in order to send out
> to
> > the JMS queue (at least I believe so).  The thing is that currentRequest
> is
> > global to the current thread, so when a message comes into my
> > servicemix-bean component, which I believe would be this method snippet:
> >
> > protected void onProviderExchange(MessageExchange exchange) throws
> Exception
> > {
> >        ...
> >        currentRequest.set(req);
> >        synchronized (req) {
> >        ...
> >        }
> >        checkEndOfRequest(req, corId);
> >        currentRequest.set(null);
> >
> > Doesn't this mean that anytime a message is delivered (inside the
> > synchronized block), there is a good chance that when my bean is trying
> to
> > use the delivery channel to send a message, that the "currentRequest"
> member
> > variable is being clobbered?  I get an NPE .. it seems like that's most
> > likely a sideeffect of the currentRequest.set(null).  Such as my send
> inside
> > the bean, clobbers the currentRequest, and then in turn, the BeanEndpoint
> > clobbers my request and makes it null, which causes my send to blow up?
> >
> > It appears as though I maybe should be creating my own deliverychannel or
> > using another method to send out from my bean?  Or is this something that
> > could be fixed, and if so, how soon?  Or is it something I could do with
> > some guidance?  Or is there something else I can do?  I'm going to go
> look
> > through the docs for another option, but I really have to work around
> this,
> > since my app is pretty much dead right now, which is the worst time.
> >
> > Thanks for any help!!
> >
> > Ryan
> >
> > On Sun, Jun 22, 2008 at 7:17 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> >
> >> Just a few details on this.. so servicemix deadlocks every time I
> startup,
> >> where servicemix needs to redeploy all SEs and all SUs... here is the
> >> deadlock trace.. all my threads are sitting like this:
> >>
> >> "pool-flow.seda.servicemix-bean-thread-1" prio=6 tid=0x2879c400
> nid=0x1728
> >> waiting for monitor entry [0x3512f000..0x3512
> >> fb94]
> >>    java.lang.Thread.State: BLOCKED (on object monitor)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.createQueue(SedaFlow.java:189)
> >>         - waiting to lock <0x07db2050> (a
> >> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.enqueuePacket(SedaFlow.java:179)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:162)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:123)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:283)
> >>         at
> >>
> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:88)
> >>         at
> >>
> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
> >>         at
> >>
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
> >>         at
> >>
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431)
> >>         at
> >>
> org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:79)
> >>         at
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:571)
> >>
> >>
> >> then if I force it closed, since it's hanging and unresponsive... I do
> get
> >> a ton of NPE's on startup and then it APPEARS to start behaving
> normally...
> >> so I'm not sure if this latest 13 build has solved the problem enough or
> if
> >> some code changes I made did, which again is here:
> >>
> >> Caused by: java.lang.NullPointerException
> >>         at
> >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >>         at
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >>         at
> >>
> >> and results in some illegal sendSync errors.... is it possible that my
> >> MessageExchangeFactory is giving back a null message or something like
> that
> >> which is causing the NPE?
> >>
> >>
> >> On Sun, Jun 22, 2008 at 5:38 PM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >>
> >>> Hey Bruce,
> >>>
> >>> Out of curiousity.. did you guys do anything with this issue in the
> last
> >>> day or two?  I've been working on some stuff on my end that I was
> hoping may
> >>> have had some effect.. when I run it on the build tagged "12" in the
> nightly
> >>> builds, I have the same issue.  When I try the one tagged "13" all my
> >>> outgoing JMS requests on the DeliveryChannel deadlock the first time I
> start
> >>> up Servicemix.  The second time I start up it, I get a ton of errors
> about
> >>> illegally calling sendSync but my threads don't deadlock that second
> time.
> >>> The deadlock is way down in the bowels of servicemix... I don't see
> that NPE
> >>> anymore on the latest one, so I'm just curious so I know exactly what
> I'm
> >>> trying to solve at this point! :)
> >>>
> >>> Thanks!!
> >>>
> >>> Ryan
> >>>
> >>>
> >>> On Sat, Jun 21, 2008 at 12:48 AM, Ryan Moquin <fr...@gmail.com>
> >>> wrote:
> >>>
> >>>> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
> bad
> >>>> for me and has the same problem :(  It only seems to affect our
> production
> >>>> server and in a few minutes after start up, I start getting the
> >>>> NullPointerException.. slowly all my services start doing it and they
> all
> >>>> stop working.  If I stop and restart servicemix, then servicemix-jms
> >>>> components are no longer routable.  I'm guessing this error causes
> >>>> Servicemix to shut them down and not deploy them anymore (Servicemix
> does
> >>>> the same thing if a service unit starts up, tries to make a Joram
> connection
> >>>> to a server that isn't up, servicemix will shutdown that SU and will
> always
> >>>> shut it down immediately after it starts on any subsequent run).
> >>>>
> >>>> It seems like this problem must be related to a race condition.  When
> >>>> doing development testing, I never see this problem on my laptop even
> under
> >>>> high load.  One our fast test server, I see this error popup once on
> startup
> >>>> and then it doesn't seem to happen again.  On our even faster
> production
> >>>> server, the whole thing looses it's wheels and falls apart after a few
> >>>> minutes.
> >>>>
> >>>> I'm supposed to be deploying this system in a few days and of course
> >>>> that's the only spot where I can't temporarily limp by.  Is it
> possible you
> >>>> could give me some hints on what the problem is and I'll debug it this
> >>>> weekend to see if I can fix it, or at least patch it temporarily?  I
> really
> >>>> need to figure out way to get around this problem.  Other than that,
> 3.2.2
> >>>> seems to work perfectly fine.
> >>>>
> >>>> Here is the caused by error again in case it's any bit different than
> the
> >>>> 3.2.1 one was:
> >>>>
> >>>> Caused by: java.lang.NullPointerException
> >>>>         at
> >>>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >>>>         at
> >>>>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >>>>         at
> >>>>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >>>> ionHandlerImpl.java:80)
> >>>>
> >>>> Also, is the delivery channel component threadsafe?  I'm curious if
> >>>> multiple threads accessing it is a problem or if I should keep access
> to it
> >>>> synchronized?  I'm currently synchronizing, but don't want to if I
> don't
> >>>> need to.
> >>>>
> >>>> Thanks!
> >>>> Ryan
> >>>>
> >>>>
> >>>> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <bruce.snyder@gmail.com
> >
> >>>> wrote:
> >>>>
> >>>>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fragility2.0@gmail.com
> >
> >>>>> wrote:
> >>>>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind
> of
> >>>>> waiting
> >>>>> > until it was released, but this problem is now cropping up on a
> >>>>> regular
> >>>>> > basis on a server so I'll definitely give it a shot.  Hopefully
> this
> >>>>> will
> >>>>> > allow me to get this project done so I can then get that Joram
> write
> >>>>> up done
> >>>>> > since I should have ran across hopefully most of the gotchas for it
> at
> >>>>> that
> >>>>> > point.
> >>>>>
> >>>>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
> >>>>> we can release it this weekend.
> >>>>>
> >>>>> Bruce
> >>>>> --
> >>>>> perl -e 'print
> >>>>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >>>>> );'
> >>>>>
> >>>>> Apache ActiveMQ - http://activemq.org/
> >>>>> Apache Camel - http://activemq.org/camel/
> >>>>> Apache ServiceMix - http://servicemix.org/
> >>>>>
> >>>>> Blog: http://bruceblog.org/
> >>>>>
> >>>>
> >>>>
> >>>
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
The currentRequest is a thread local variable, so if another exchange
is handled it should not damage the processing of another thread.

On Mon, Jun 23, 2008 at 8:45 AM, Ryan Moquin <fr...@gmail.com> wrote:
> Could someone on the servicemix team verify this rationale for me?  I think
> I figured out my problem, which is a race condition in Servicemix (which of
> course is exploited more on a faster machine).  I'm not sure what the best
> solution to work around this problem is, and I am on a short timeframe since
> of course this problem really only plagues our production environment and
> not our dev or test environment.  Anyhow, I have a servicemix-bean component
> that is taking an input, performing some analysis on it, and then sending it
> back out to a JMS topic.  In order to send it back out, I'm using the
> DeliveryChannel that is injected into my bean.  This sharing of the delivery
> channel is what is causing the race condition, here is the reason.  The
> exceptions I've been mentioning are referring to the following line:
>
> requests.put(messageExchange.getExchangeId(), currentRequest.get());
>
> This line is dependant upon the request I'm building in order to send out to
> the JMS queue (at least I believe so).  The thing is that currentRequest is
> global to the current thread, so when a message comes into my
> servicemix-bean component, which I believe would be this method snippet:
>
> protected void onProviderExchange(MessageExchange exchange) throws Exception
> {
>        ...
>        currentRequest.set(req);
>        synchronized (req) {
>        ...
>        }
>        checkEndOfRequest(req, corId);
>        currentRequest.set(null);
>
> Doesn't this mean that anytime a message is delivered (inside the
> synchronized block), there is a good chance that when my bean is trying to
> use the delivery channel to send a message, that the "currentRequest" member
> variable is being clobbered?  I get an NPE .. it seems like that's most
> likely a sideeffect of the currentRequest.set(null).  Such as my send inside
> the bean, clobbers the currentRequest, and then in turn, the BeanEndpoint
> clobbers my request and makes it null, which causes my send to blow up?
>
> It appears as though I maybe should be creating my own deliverychannel or
> using another method to send out from my bean?  Or is this something that
> could be fixed, and if so, how soon?  Or is it something I could do with
> some guidance?  Or is there something else I can do?  I'm going to go look
> through the docs for another option, but I really have to work around this,
> since my app is pretty much dead right now, which is the worst time.
>
> Thanks for any help!!
>
> Ryan
>
> On Sun, Jun 22, 2008 at 7:17 PM, Ryan Moquin <fr...@gmail.com> wrote:
>
>> Just a few details on this.. so servicemix deadlocks every time I startup,
>> where servicemix needs to redeploy all SEs and all SUs... here is the
>> deadlock trace.. all my threads are sitting like this:
>>
>> "pool-flow.seda.servicemix-bean-thread-1" prio=6 tid=0x2879c400 nid=0x1728
>> waiting for monitor entry [0x3512f000..0x3512
>> fb94]
>>    java.lang.Thread.State: BLOCKED (on object monitor)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.createQueue(SedaFlow.java:189)
>>         - waiting to lock <0x07db2050> (a
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.enqueuePacket(SedaFlow.java:179)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:162)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:123)
>>         at
>> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:283)
>>         at
>> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:88)
>>         at
>> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>>         at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
>>         at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431)
>>         at
>> org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:79)
>>         at
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:571)
>>
>>
>> then if I force it closed, since it's hanging and unresponsive... I do get
>> a ton of NPE's on startup and then it APPEARS to start behaving normally...
>> so I'm not sure if this latest 13 build has solved the problem enough or if
>> some code changes I made did, which again is here:
>>
>> Caused by: java.lang.NullPointerException
>>         at
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>>         at
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>>         at
>>
>> and results in some illegal sendSync errors.... is it possible that my
>> MessageExchangeFactory is giving back a null message or something like that
>> which is causing the NPE?
>>
>>
>> On Sun, Jun 22, 2008 at 5:38 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>>
>>> Hey Bruce,
>>>
>>> Out of curiousity.. did you guys do anything with this issue in the last
>>> day or two?  I've been working on some stuff on my end that I was hoping may
>>> have had some effect.. when I run it on the build tagged "12" in the nightly
>>> builds, I have the same issue.  When I try the one tagged "13" all my
>>> outgoing JMS requests on the DeliveryChannel deadlock the first time I start
>>> up Servicemix.  The second time I start up it, I get a ton of errors about
>>> illegally calling sendSync but my threads don't deadlock that second time.
>>> The deadlock is way down in the bowels of servicemix... I don't see that NPE
>>> anymore on the latest one, so I'm just curious so I know exactly what I'm
>>> trying to solve at this point! :)
>>>
>>> Thanks!!
>>>
>>> Ryan
>>>
>>>
>>> On Sat, Jun 21, 2008 at 12:48 AM, Ryan Moquin <fr...@gmail.com>
>>> wrote:
>>>
>>>> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad
>>>> for me and has the same problem :(  It only seems to affect our production
>>>> server and in a few minutes after start up, I start getting the
>>>> NullPointerException.. slowly all my services start doing it and they all
>>>> stop working.  If I stop and restart servicemix, then servicemix-jms
>>>> components are no longer routable.  I'm guessing this error causes
>>>> Servicemix to shut them down and not deploy them anymore (Servicemix does
>>>> the same thing if a service unit starts up, tries to make a Joram connection
>>>> to a server that isn't up, servicemix will shutdown that SU and will always
>>>> shut it down immediately after it starts on any subsequent run).
>>>>
>>>> It seems like this problem must be related to a race condition.  When
>>>> doing development testing, I never see this problem on my laptop even under
>>>> high load.  One our fast test server, I see this error popup once on startup
>>>> and then it doesn't seem to happen again.  On our even faster production
>>>> server, the whole thing looses it's wheels and falls apart after a few
>>>> minutes.
>>>>
>>>> I'm supposed to be deploying this system in a few days and of course
>>>> that's the only spot where I can't temporarily limp by.  Is it possible you
>>>> could give me some hints on what the problem is and I'll debug it this
>>>> weekend to see if I can fix it, or at least patch it temporarily?  I really
>>>> need to figure out way to get around this problem.  Other than that, 3.2.2
>>>> seems to work perfectly fine.
>>>>
>>>> Here is the caused by error again in case it's any bit different than the
>>>> 3.2.1 one was:
>>>>
>>>> Caused by: java.lang.NullPointerException
>>>>         at
>>>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>>>>         at
>>>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>>>>         at
>>>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>>>> ionHandlerImpl.java:80)
>>>>
>>>> Also, is the delivery channel component threadsafe?  I'm curious if
>>>> multiple threads accessing it is a problem or if I should keep access to it
>>>> synchronized?  I'm currently synchronizing, but don't want to if I don't
>>>> need to.
>>>>
>>>> Thanks!
>>>> Ryan
>>>>
>>>>
>>>> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
>>>> wrote:
>>>>
>>>>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>>>>> wrote:
>>>>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>>>>> waiting
>>>>> > until it was released, but this problem is now cropping up on a
>>>>> regular
>>>>> > basis on a server so I'll definitely give it a shot.  Hopefully this
>>>>> will
>>>>> > allow me to get this project done so I can then get that Joram write
>>>>> up done
>>>>> > since I should have ran across hopefully most of the gotchas for it at
>>>>> that
>>>>> > point.
>>>>>
>>>>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>>>>> we can release it this weekend.
>>>>>
>>>>> Bruce
>>>>> --
>>>>> perl -e 'print
>>>>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>>>> );'
>>>>>
>>>>> Apache ActiveMQ - http://activemq.org/
>>>>> Apache Camel - http://activemq.org/camel/
>>>>> Apache ServiceMix - http://servicemix.org/
>>>>>
>>>>> Blog: http://bruceblog.org/
>>>>>
>>>>
>>>>
>>>
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Could someone on the servicemix team verify this rationale for me?  I think
I figured out my problem, which is a race condition in Servicemix (which of
course is exploited more on a faster machine).  I'm not sure what the best
solution to work around this problem is, and I am on a short timeframe since
of course this problem really only plagues our production environment and
not our dev or test environment.  Anyhow, I have a servicemix-bean component
that is taking an input, performing some analysis on it, and then sending it
back out to a JMS topic.  In order to send it back out, I'm using the
DeliveryChannel that is injected into my bean.  This sharing of the delivery
channel is what is causing the race condition, here is the reason.  The
exceptions I've been mentioning are referring to the following line:

requests.put(messageExchange.getExchangeId(), currentRequest.get());

This line is dependant upon the request I'm building in order to send out to
the JMS queue (at least I believe so).  The thing is that currentRequest is
global to the current thread, so when a message comes into my
servicemix-bean component, which I believe would be this method snippet:

protected void onProviderExchange(MessageExchange exchange) throws Exception
{
        ...
        currentRequest.set(req);
        synchronized (req) {
        ...
        }
        checkEndOfRequest(req, corId);
        currentRequest.set(null);

Doesn't this mean that anytime a message is delivered (inside the
synchronized block), there is a good chance that when my bean is trying to
use the delivery channel to send a message, that the "currentRequest" member
variable is being clobbered?  I get an NPE .. it seems like that's most
likely a sideeffect of the currentRequest.set(null).  Such as my send inside
the bean, clobbers the currentRequest, and then in turn, the BeanEndpoint
clobbers my request and makes it null, which causes my send to blow up?

It appears as though I maybe should be creating my own deliverychannel or
using another method to send out from my bean?  Or is this something that
could be fixed, and if so, how soon?  Or is it something I could do with
some guidance?  Or is there something else I can do?  I'm going to go look
through the docs for another option, but I really have to work around this,
since my app is pretty much dead right now, which is the worst time.

Thanks for any help!!

Ryan

On Sun, Jun 22, 2008 at 7:17 PM, Ryan Moquin <fr...@gmail.com> wrote:

> Just a few details on this.. so servicemix deadlocks every time I startup,
> where servicemix needs to redeploy all SEs and all SUs... here is the
> deadlock trace.. all my threads are sitting like this:
>
> "pool-flow.seda.servicemix-bean-thread-1" prio=6 tid=0x2879c400 nid=0x1728
> waiting for monitor entry [0x3512f000..0x3512
> fb94]
>    java.lang.Thread.State: BLOCKED (on object monitor)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.createQueue(SedaFlow.java:189)
>         - waiting to lock <0x07db2050> (a
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.enqueuePacket(SedaFlow.java:179)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:162)
>         at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:123)
>         at
> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:283)
>         at
> org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:88)
>         at
> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431)
>         at
> org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:79)
>         at
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:571)
>
>
> then if I force it closed, since it's hanging and unresponsive... I do get
> a ton of NPE's on startup and then it APPEARS to start behaving normally...
> so I'm not sure if this latest 13 build has solved the problem enough or if
> some code changes I made did, which again is here:
>
> Caused by: java.lang.NullPointerException
>         at
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>         at
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>         at
>
> and results in some illegal sendSync errors.... is it possible that my
> MessageExchangeFactory is giving back a null message or something like that
> which is causing the NPE?
>
>
> On Sun, Jun 22, 2008 at 5:38 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
>
>> Hey Bruce,
>>
>> Out of curiousity.. did you guys do anything with this issue in the last
>> day or two?  I've been working on some stuff on my end that I was hoping may
>> have had some effect.. when I run it on the build tagged "12" in the nightly
>> builds, I have the same issue.  When I try the one tagged "13" all my
>> outgoing JMS requests on the DeliveryChannel deadlock the first time I start
>> up Servicemix.  The second time I start up it, I get a ton of errors about
>> illegally calling sendSync but my threads don't deadlock that second time.
>> The deadlock is way down in the bowels of servicemix... I don't see that NPE
>> anymore on the latest one, so I'm just curious so I know exactly what I'm
>> trying to solve at this point! :)
>>
>> Thanks!!
>>
>> Ryan
>>
>>
>> On Sat, Jun 21, 2008 at 12:48 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>>
>>> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad
>>> for me and has the same problem :(  It only seems to affect our production
>>> server and in a few minutes after start up, I start getting the
>>> NullPointerException.. slowly all my services start doing it and they all
>>> stop working.  If I stop and restart servicemix, then servicemix-jms
>>> components are no longer routable.  I'm guessing this error causes
>>> Servicemix to shut them down and not deploy them anymore (Servicemix does
>>> the same thing if a service unit starts up, tries to make a Joram connection
>>> to a server that isn't up, servicemix will shutdown that SU and will always
>>> shut it down immediately after it starts on any subsequent run).
>>>
>>> It seems like this problem must be related to a race condition.  When
>>> doing development testing, I never see this problem on my laptop even under
>>> high load.  One our fast test server, I see this error popup once on startup
>>> and then it doesn't seem to happen again.  On our even faster production
>>> server, the whole thing looses it's wheels and falls apart after a few
>>> minutes.
>>>
>>> I'm supposed to be deploying this system in a few days and of course
>>> that's the only spot where I can't temporarily limp by.  Is it possible you
>>> could give me some hints on what the problem is and I'll debug it this
>>> weekend to see if I can fix it, or at least patch it temporarily?  I really
>>> need to figure out way to get around this problem.  Other than that, 3.2.2
>>> seems to work perfectly fine.
>>>
>>> Here is the caused by error again in case it's any bit different than the
>>> 3.2.1 one was:
>>>
>>> Caused by: java.lang.NullPointerException
>>>         at
>>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>>>         at
>>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>>>         at
>>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>>> ionHandlerImpl.java:80)
>>>
>>> Also, is the delivery channel component threadsafe?  I'm curious if
>>> multiple threads accessing it is a problem or if I should keep access to it
>>> synchronized?  I'm currently synchronizing, but don't want to if I don't
>>> need to.
>>>
>>> Thanks!
>>> Ryan
>>>
>>>
>>> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
>>> wrote:
>>>
>>>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>>>> wrote:
>>>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>>>> waiting
>>>> > until it was released, but this problem is now cropping up on a
>>>> regular
>>>> > basis on a server so I'll definitely give it a shot.  Hopefully this
>>>> will
>>>> > allow me to get this project done so I can then get that Joram write
>>>> up done
>>>> > since I should have ran across hopefully most of the gotchas for it at
>>>> that
>>>> > point.
>>>>
>>>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>>>> we can release it this weekend.
>>>>
>>>> Bruce
>>>> --
>>>> perl -e 'print
>>>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>>> );'
>>>>
>>>> Apache ActiveMQ - http://activemq.org/
>>>> Apache Camel - http://activemq.org/camel/
>>>> Apache ServiceMix - http://servicemix.org/
>>>>
>>>> Blog: http://bruceblog.org/
>>>>
>>>
>>>
>>
>

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Just a few details on this.. so servicemix deadlocks every time I startup,
where servicemix needs to redeploy all SEs and all SUs... here is the
deadlock trace.. all my threads are sitting like this:

"pool-flow.seda.servicemix-bean-thread-1" prio=6 tid=0x2879c400 nid=0x1728
waiting for monitor entry [0x3512f000..0x3512
fb94]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.createQueue(SedaFlow.java:189)
        - waiting to lock <0x07db2050> (a
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.enqueuePacket(SedaFlow.java:179)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doSend(SedaFlow.java:162)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.send(AbstractFlow.java:123)
        at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:283)
        at
org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:88)
        at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:830)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:395)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:431)
        at
org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:79)
        at
org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:571)


then if I force it closed, since it's hanging and unresponsive... I do get a
ton of NPE's on startup and then it APPEARS to start behaving normally... so
I'm not sure if this latest 13 build has solved the problem enough or if
some code changes I made did, which again is here:

Caused by: java.lang.NullPointerException
        at
java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
        at
org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
        at

and results in some illegal sendSync errors.... is it possible that my
MessageExchangeFactory is giving back a null message or something like that
which is causing the NPE?

On Sun, Jun 22, 2008 at 5:38 PM, Ryan Moquin <fr...@gmail.com> wrote:

> Hey Bruce,
>
> Out of curiousity.. did you guys do anything with this issue in the last
> day or two?  I've been working on some stuff on my end that I was hoping may
> have had some effect.. when I run it on the build tagged "12" in the nightly
> builds, I have the same issue.  When I try the one tagged "13" all my
> outgoing JMS requests on the DeliveryChannel deadlock the first time I start
> up Servicemix.  The second time I start up it, I get a ton of errors about
> illegally calling sendSync but my threads don't deadlock that second time.
> The deadlock is way down in the bowels of servicemix... I don't see that NPE
> anymore on the latest one, so I'm just curious so I know exactly what I'm
> trying to solve at this point! :)
>
> Thanks!!
>
> Ryan
>
>
> On Sat, Jun 21, 2008 at 12:48 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
>
>> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad
>> for me and has the same problem :(  It only seems to affect our production
>> server and in a few minutes after start up, I start getting the
>> NullPointerException.. slowly all my services start doing it and they all
>> stop working.  If I stop and restart servicemix, then servicemix-jms
>> components are no longer routable.  I'm guessing this error causes
>> Servicemix to shut them down and not deploy them anymore (Servicemix does
>> the same thing if a service unit starts up, tries to make a Joram connection
>> to a server that isn't up, servicemix will shutdown that SU and will always
>> shut it down immediately after it starts on any subsequent run).
>>
>> It seems like this problem must be related to a race condition.  When
>> doing development testing, I never see this problem on my laptop even under
>> high load.  One our fast test server, I see this error popup once on startup
>> and then it doesn't seem to happen again.  On our even faster production
>> server, the whole thing looses it's wheels and falls apart after a few
>> minutes.
>>
>> I'm supposed to be deploying this system in a few days and of course
>> that's the only spot where I can't temporarily limp by.  Is it possible you
>> could give me some hints on what the problem is and I'll debug it this
>> weekend to see if I can fix it, or at least patch it temporarily?  I really
>> need to figure out way to get around this problem.  Other than that, 3.2.2
>> seems to work perfectly fine.
>>
>> Here is the caused by error again in case it's any bit different than the
>> 3.2.1 one was:
>>
>> Caused by: java.lang.NullPointerException
>>         at
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>>         at
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>>         at
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> ionHandlerImpl.java:80)
>>
>> Also, is the delivery channel component threadsafe?  I'm curious if
>> multiple threads accessing it is a problem or if I should keep access to it
>> synchronized?  I'm currently synchronizing, but don't want to if I don't
>> need to.
>>
>> Thanks!
>> Ryan
>>
>>
>> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
>> wrote:
>>
>>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>>> wrote:
>>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>>> waiting
>>> > until it was released, but this problem is now cropping up on a regular
>>> > basis on a server so I'll definitely give it a shot.  Hopefully this
>>> will
>>> > allow me to get this project done so I can then get that Joram write up
>>> done
>>> > since I should have ran across hopefully most of the gotchas for it at
>>> that
>>> > point.
>>>
>>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>>> we can release it this weekend.
>>>
>>> Bruce
>>> --
>>> perl -e 'print
>>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>> );'
>>>
>>> Apache ActiveMQ - http://activemq.org/
>>> Apache Camel - http://activemq.org/camel/
>>> Apache ServiceMix - http://servicemix.org/
>>>
>>> Blog: http://bruceblog.org/
>>>
>>
>>
>

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Hey Bruce,

Out of curiousity.. did you guys do anything with this issue in the last day
or two?  I've been working on some stuff on my end that I was hoping may
have had some effect.. when I run it on the build tagged "12" in the nightly
builds, I have the same issue.  When I try the one tagged "13" all my
outgoing JMS requests on the DeliveryChannel deadlock the first time I start
up Servicemix.  The second time I start up it, I get a ton of errors about
illegally calling sendSync but my threads don't deadlock that second time.
The deadlock is way down in the bowels of servicemix... I don't see that NPE
anymore on the latest one, so I'm just curious so I know exactly what I'm
trying to solve at this point! :)

Thanks!!

Ryan

On Sat, Jun 21, 2008 at 12:48 AM, Ryan Moquin <fr...@gmail.com>
wrote:

> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad for
> me and has the same problem :(  It only seems to affect our production
> server and in a few minutes after start up, I start getting the
> NullPointerException.. slowly all my services start doing it and they all
> stop working.  If I stop and restart servicemix, then servicemix-jms
> components are no longer routable.  I'm guessing this error causes
> Servicemix to shut them down and not deploy them anymore (Servicemix does
> the same thing if a service unit starts up, tries to make a Joram connection
> to a server that isn't up, servicemix will shutdown that SU and will always
> shut it down immediately after it starts on any subsequent run).
>
> It seems like this problem must be related to a race condition.  When doing
> development testing, I never see this problem on my laptop even under high
> load.  One our fast test server, I see this error popup once on startup and
> then it doesn't seem to happen again.  On our even faster production server,
> the whole thing looses it's wheels and falls apart after a few minutes.
>
> I'm supposed to be deploying this system in a few days and of course that's
> the only spot where I can't temporarily limp by.  Is it possible you could
> give me some hints on what the problem is and I'll debug it this weekend to
> see if I can fix it, or at least patch it temporarily?  I really need to
> figure out way to get around this problem.  Other than that, 3.2.2 seems to
> work perfectly fine.
>
> Here is the caused by error again in case it's any bit different than the
> 3.2.1 one was:
>
> Caused by: java.lang.NullPointerException
>         at
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>         at
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>         at
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> ionHandlerImpl.java:80)
>
> Also, is the delivery channel component threadsafe?  I'm curious if
> multiple threads accessing it is a problem or if I should keep access to it
> synchronized?  I'm currently synchronizing, but don't want to if I don't
> need to.
>
> Thanks!
> Ryan
>
>
> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
> wrote:
>
>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>> waiting
>> > until it was released, but this problem is now cropping up on a regular
>> > basis on a server so I'll definitely give it a shot.  Hopefully this
>> will
>> > allow me to get this project done so I can then get that Joram write up
>> done
>> > since I should have ran across hopefully most of the gotchas for it at
>> that
>> > point.
>>
>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>> we can release it this weekend.
>>
>> Bruce
>> --
>> perl -e 'print
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>>
>> Apache ActiveMQ - http://activemq.org/
>> Apache Camel - http://activemq.org/camel/
>> Apache ServiceMix - http://servicemix.org/
>>
>> Blog: http://bruceblog.org/
>>
>
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
You can send those at gnodet[at]gmail.com

On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com> wrote:
> Oh right, because the thread obviously would be the one that would go
> through onMessageExchange method and then it would be set to null after...
> (bear with me, long weekend dealing with this problem and it's 4am on a
> workday.. haha).
>
> It's a rather large bean, composed of several classes (it does a lot of
> complicated stuff inside the bean)... but I could probably send you some
> pieces of it... do you mind if I email them privately to you?
>
> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> But the current request is only set to null *after* calling the pojo.
>>  Do you have the full code of you bean ?
>>
>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > Sure, I backed out the changes in my editor.. basically my bean is
>> standard
>> > compared to the servicemix docs (for how to handle the exchange coming
>> in),
>> > then my bean takes the injected deliverychannel and hands it to a class
>> that
>> > creates a message to send out with results of some analysis performed..
>> here
>> > is the code to send out (it's using the DeliveryChannel injected into the
>> > bean by Servicemix):
>> >
>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>> >      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> > Boolean.TRUE);
>> >      notificationMarshaller.marshal(notification, writer);
>> >      if (destinationQname == null) {
>> >        destinationQname = new QName(getDestinationNamespace(),
>> > getDestinationService());
>> >      }
>> >      MessageExchangeFactory exchangeFactory =
>> > deliveryChannel.createExchangeFactory();
>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >      NormalizedMessage message = exchange.createMessage();
>> >      message.setContent(new StringSource(writer.toString()));
>> >      exchange.setInMessage(message);
>> >      exchange.setService(destinationQname);
>> >      deliveryChannel.send(exchange);
>> >
>> > The send is where the ConcurrentHashmap complains about an NPE .. I think
>> > because the BeanComponent sets the CurrentRequest to null around the time
>> my
>> > code is trying to send a request that must get clobbered?  There's no
>> other
>> > explanation for it.. it looks like the NPE is caused by
>> > currentRequest.get(), which is set back to null by the BeanComponent and
>> > since they are in the same thread.... they interfere.
>> >
>> > Ryan
>> >
>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> Is there any way you could paste the code of the bean you're using so
>> >> that i can have a quick look. You can skip any non-jbi related
>> >> processing...
>> >>
>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > No, I'm just simply using the deliverychannel to send out, which is
>> >> > mentioned in the servicemix docs as something that you can do.  I
>> assume
>> >> > that means it's recommended :)  I did see that I can inject a
>> >> > ComponentContext and so I'm currently changing my outbound messages to
>> >> that
>> >> > to see if I can get around this problem.  I think I just can't use the
>> >> > DeliveryContext in the same Pojo (same thread).
>> >> >
>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >> currentRequest.get() is null.
>> >> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> >> should try to remove that, as the component is already able to handle
>> >> >> concurrent requests.
>> >> >>
>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fragility2.0@gmail.com
>> >
>> >> >> wrote:
>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>> >> bad
>> >> >> for
>> >> >> > me and has the same problem :(  It only seems to affect our
>> production
>> >> >> > server and in a few minutes after start up, I start getting the
>> >> >> > NullPointerException.. slowly all my services start doing it and
>> they
>> >> all
>> >> >> > stop working.  If I stop and restart servicemix, then
>> servicemix-jms
>> >> >> > components are no longer routable.  I'm guessing this error causes
>> >> >> > Servicemix to shut them down and not deploy them anymore
>> (Servicemix
>> >> does
>> >> >> > the same thing if a service unit starts up, tries to make a Joram
>> >> >> connection
>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
>> will
>> >> >> always
>> >> >> > shut it down immediately after it starts on any subsequent run).
>> >> >> >
>> >> >> > It seems like this problem must be related to a race condition.
>>  When
>> >> >> doing
>> >> >> > development testing, I never see this problem on my laptop even
>> under
>> >> >> high
>> >> >> > load.  One our fast test server, I see this error popup once on
>> >> startup
>> >> >> and
>> >> >> > then it doesn't seem to happen again.  On our even faster
>> production
>> >> >> server,
>> >> >> > the whole thing looses it's wheels and falls apart after a few
>> >> minutes.
>> >> >> >
>> >> >> > I'm supposed to be deploying this system in a few days and of
>> course
>> >> >> that's
>> >> >> > the only spot where I can't temporarily limp by.  Is it possible
>> you
>> >> >> could
>> >> >> > give me some hints on what the problem is and I'll debug it this
>> >> weekend
>> >> >> to
>> >> >> > see if I can fix it, or at least patch it temporarily?  I really
>> need
>> >> to
>> >> >> > figure out way to get around this problem.  Other than that, 3.2.2
>> >> seems
>> >> >> to
>> >> >> > work perfectly fine.
>> >> >> >
>> >> >> > Here is the caused by error again in case it's any bit different
>> than
>> >> the
>> >> >> > 3.2.1 one was:
>> >> >> >
>> >> >> > Caused by: java.lang.NullPointerException
>> >> >> >        at
>> >> >> >
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >> >        at
>> >> >> >
>> >> >>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >> >        at
>> >> >> >
>> >> >>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >> > ionHandlerImpl.java:80)
>> >> >> >
>> >> >> > Also, is the delivery channel component threadsafe?  I'm curious if
>> >> >> multiple
>> >> >> > threads accessing it is a problem or if I should keep access to it
>> >> >> > synchronized?  I'm currently synchronizing, but don't want to if I
>> >> don't
>> >> >> > need to.
>> >> >> >
>> >> >> > Thanks!
>> >> >> > Ryan
>> >> >> >
>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> bruce.snyder@gmail.com
>> >> >
>> >> >> > wrote:
>> >> >> >
>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> fragility2.0@gmail.com
>> >> >
>> >> >> >> wrote:
>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
>> kind
>> >> of
>> >> >> >> waiting
>> >> >> >> > until it was released, but this problem is now cropping up on a
>> >> >> regular
>> >> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
>> >> this
>> >> >> will
>> >> >> >> > allow me to get this project done so I can then get that Joram
>> >> write
>> >> >> up
>> >> >> >> done
>> >> >> >> > since I should have ran across hopefully most of the gotchas for
>> it
>> >> at
>> >> >> >> that
>> >> >> >> > point.
>> >> >> >>
>> >> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
>> Maybe
>> >> >> >> we can release it this weekend.
>> >> >> >>
>> >> >> >> Bruce
>> >> >> >> --
>> >> >> >> perl -e 'print
>> >> >> >>
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> >> );'
>> >> >> >>
>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >> >>
>> >> >> >> Blog: http://bruceblog.org/
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Cheers,
>> >> >> Guillaume Nodet
>> >> >> ------------------------
>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
I have access in the BeanEndpoint to do that?  I have wondered actually if
messsages were being sent to myself sometimes.. because some of the messages
look strangely like they but it didn't make sense that that would happen...

On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> Could you please test something ?
> In the BeanEndpoint, save the old value for the currentRequest.get()
> in a local variable before setting it to the new value, and instead of
> setting it to null after processing, set it back to the old value.  It
> may fix the problem ...
>
> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> > I'm wondering if for some reason your endpoint sends a request to itself
> ?
> > If this request is handled synchronously, it may happen that the
> > currentRequest is set to null while handling this request, but in the
> > same thread as the first request ?
> > Under high load, this behavior could happen if the thread pool is
> > exhausted, because under such conditions, the work will be executed in
> > the same thread...
> >
> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> >> Oh right, because the thread obviously would be the one that would go
> >> through onMessageExchange method and then it would be set to null
> after...
> >> (bear with me, long weekend dealing with this problem and it's 4am on a
> >> workday.. haha).
> >>
> >> It's a rather large bean, composed of several classes (it does a lot of
> >> complicated stuff inside the bean)... but I could probably send you some
> >> pieces of it... do you mind if I email them privately to you?
> >>
> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >>
> >>> But the current request is only set to null *after* calling the pojo.
> >>>  Do you have the full code of you bean ?
> >>>
> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
> >>> wrote:
> >>> > Sure, I backed out the changes in my editor.. basically my bean is
> >>> standard
> >>> > compared to the servicemix docs (for how to handle the exchange
> coming
> >>> in),
> >>> > then my bean takes the injected deliverychannel and hands it to a
> class
> >>> that
> >>> > creates a message to send out with results of some analysis
> performed..
> >>> here
> >>> > is the code to send out (it's using the DeliveryChannel injected into
> the
> >>> > bean by Servicemix):
> >>> >
> >>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
> >>> >
>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >>> > Boolean.TRUE);
> >>> >      notificationMarshaller.marshal(notification, writer);
> >>> >      if (destinationQname == null) {
> >>> >        destinationQname = new QName(getDestinationNamespace(),
> >>> > getDestinationService());
> >>> >      }
> >>> >      MessageExchangeFactory exchangeFactory =
> >>> > deliveryChannel.createExchangeFactory();
> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >>> >      NormalizedMessage message = exchange.createMessage();
> >>> >      message.setContent(new StringSource(writer.toString()));
> >>> >      exchange.setInMessage(message);
> >>> >      exchange.setService(destinationQname);
> >>> >      deliveryChannel.send(exchange);
> >>> >
> >>> > The send is where the ConcurrentHashmap complains about an NPE .. I
> think
> >>> > because the BeanComponent sets the CurrentRequest to null around the
> time
> >>> my
> >>> > code is trying to send a request that must get clobbered?  There's no
> >>> other
> >>> > explanation for it.. it looks like the NPE is caused by
> >>> > currentRequest.get(), which is set back to null by the BeanComponent
> and
> >>> > since they are in the same thread.... they interfere.
> >>> >
> >>> > Ryan
> >>> >
> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
> >>> wrote:
> >>> >
> >>> >> Is there any way you could paste the code of the bean you're using
> so
> >>> >> that i can have a quick look. You can skip any non-jbi related
> >>> >> processing...
> >>> >>
> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
> fragility2.0@gmail.com>
> >>> >> wrote:
> >>> >> > No, I'm just simply using the deliverychannel to send out, which
> is
> >>> >> > mentioned in the servicemix docs as something that you can do.  I
> >>> assume
> >>> >> > that means it's recommended :)  I did see that I can inject a
> >>> >> > ComponentContext and so I'm currently changing my outbound
> messages to
> >>> >> that
> >>> >> > to see if I can get around this problem.  I think I just can't use
> the
> >>> >> > DeliveryContext in the same Pojo (same thread).
> >>> >> >
> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
> gnodet@gmail.com>
> >>> >> wrote:
> >>> >> >
> >>> >> >> The NPE in the PojoChannel.send() method means that the
> >>> >> >> currentRequest.get() is null.
> >>> >> >> Do you perform any threading operation in the pojo ? If yes, you
> >>> >> >> should try to remove that, as the component is already able to
> handle
> >>> >> >> concurrent requests.
> >>> >> >>
> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> fragility2.0@gmail.com
> >>> >
> >>> >> >> wrote:
> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
> pretty
> >>> >> bad
> >>> >> >> for
> >>> >> >> > me and has the same problem :(  It only seems to affect our
> >>> production
> >>> >> >> > server and in a few minutes after start up, I start getting the
> >>> >> >> > NullPointerException.. slowly all my services start doing it
> and
> >>> they
> >>> >> all
> >>> >> >> > stop working.  If I stop and restart servicemix, then
> >>> servicemix-jms
> >>> >> >> > components are no longer routable.  I'm guessing this error
> causes
> >>> >> >> > Servicemix to shut them down and not deploy them anymore
> >>> (Servicemix
> >>> >> does
> >>> >> >> > the same thing if a service unit starts up, tries to make a
> Joram
> >>> >> >> connection
> >>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
> >>> will
> >>> >> >> always
> >>> >> >> > shut it down immediately after it starts on any subsequent
> run).
> >>> >> >> >
> >>> >> >> > It seems like this problem must be related to a race condition.
> >>>  When
> >>> >> >> doing
> >>> >> >> > development testing, I never see this problem on my laptop even
> >>> under
> >>> >> >> high
> >>> >> >> > load.  One our fast test server, I see this error popup once on
> >>> >> startup
> >>> >> >> and
> >>> >> >> > then it doesn't seem to happen again.  On our even faster
> >>> production
> >>> >> >> server,
> >>> >> >> > the whole thing looses it's wheels and falls apart after a few
> >>> >> minutes.
> >>> >> >> >
> >>> >> >> > I'm supposed to be deploying this system in a few days and of
> >>> course
> >>> >> >> that's
> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
> possible
> >>> you
> >>> >> >> could
> >>> >> >> > give me some hints on what the problem is and I'll debug it
> this
> >>> >> weekend
> >>> >> >> to
> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
> really
> >>> need
> >>> >> to
> >>> >> >> > figure out way to get around this problem.  Other than that,
> 3.2.2
> >>> >> seems
> >>> >> >> to
> >>> >> >> > work perfectly fine.
> >>> >> >> >
> >>> >> >> > Here is the caused by error again in case it's any bit
> different
> >>> than
> >>> >> the
> >>> >> >> > 3.2.1 one was:
> >>> >> >> >
> >>> >> >> > Caused by: java.lang.NullPointerException
> >>> >> >> >        at
> >>> >> >> >
> >>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >>> >> >> >        at
> >>> >> >> >
> >>> >> >>
> >>> >>
> >>>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >>> >> >> >        at
> >>> >> >> >
> >>> >> >>
> >>> >>
> >>>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >>> >> >> > ionHandlerImpl.java:80)
> >>> >> >> >
> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
> curious if
> >>> >> >> multiple
> >>> >> >> > threads accessing it is a problem or if I should keep access to
> it
> >>> >> >> > synchronized?  I'm currently synchronizing, but don't want to
> if I
> >>> >> don't
> >>> >> >> > need to.
> >>> >> >> >
> >>> >> >> > Thanks!
> >>> >> >> > Ryan
> >>> >> >> >
> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >>> bruce.snyder@gmail.com
> >>> >> >
> >>> >> >> > wrote:
> >>> >> >> >
> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >>> fragility2.0@gmail.com
> >>> >> >
> >>> >> >> >> wrote:
> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
> >>> kind
> >>> >> of
> >>> >> >> >> waiting
> >>> >> >> >> > until it was released, but this problem is now cropping up
> on a
> >>> >> >> regular
> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
>  Hopefully
> >>> >> this
> >>> >> >> will
> >>> >> >> >> > allow me to get this project done so I can then get that
> Joram
> >>> >> write
> >>> >> >> up
> >>> >> >> >> done
> >>> >> >> >> > since I should have ran across hopefully most of the gotchas
> for
> >>> it
> >>> >> at
> >>> >> >> >> that
> >>> >> >> >> > point.
> >>> >> >> >>
> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
> stable.
> >>> Maybe
> >>> >> >> >> we can release it this weekend.
> >>> >> >> >>
> >>> >> >> >> Bruce
> >>> >> >> >> --
> >>> >> >> >> perl -e 'print
> >>> >> >> >>
> >>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >>> >> >> >> );'
> >>> >> >> >>
> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
> >>> >> >> >> Apache Camel - http://activemq.org/camel/
> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
> >>> >> >> >>
> >>> >> >> >> Blog: http://bruceblog.org/
> >>> >> >> >>
> >>> >> >> >
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> --
> >>> >> >> Cheers,
> >>> >> >> Guillaume Nodet
> >>> >> >> ------------------------
> >>> >> >> Blog: http://gnodet.blogspot.com/
> >>> >> >>
> >>> >> >
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Cheers,
> >>> >> Guillaume Nodet
> >>> >> ------------------------
> >>> >> Blog: http://gnodet.blogspot.com/
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Cheers,
> >>> Guillaume Nodet
> >>> ------------------------
> >>> Blog: http://gnodet.blogspot.com/
> >>>
> >>
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
Glad you solved your problem ...

On Tue, Jun 24, 2008 at 5:10 PM, Ryan Moquin <fr...@gmail.com> wrote:
> Actually, after your conversation.. I went and upped the threads, which
> seemed like a logical solution (I didn't tell you only 10% of the CPU was
> being used, so it could handle more load).  So I just went and doubled the
> threads in servicemix for the heck of it, and the problem completely went
> away.  So your theory on the problem was correct, it was just easier to up
> the thread count to correct it.
>
> Anyhow, anyone else that has servicemix processing lots of messages, with a
> similar problem, and has CPU room to spare.  That's one solution. :)
>
> Thanks!!!
> Ryan
>
> On Mon, Jun 23, 2008 at 2:48 PM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> No, I don't think your code is a problem at this point.
>> I'm not sure what happens exactly, but the fix I suggested is the only
>> solution i'm seeing right now.
>>
>> On Mon, Jun 23, 2008 at 8:29 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > Oh, so you mean that it's not the bean sending the message to itself,
>> it's
>> > that the jms consumer is sending back a reply, but not allocating a new
>> > thread for it.  I am sending synchronously.. so maybe that's why?  If
>> that's
>> > the case.. then it sounds more like I'm simply not handling the reply
>> > properly then?
>> >
>> > On Mon, Jun 23, 2008 at 12:21 PM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> it may be a little more complicated though.  If all the thread pool
>> >> are exhausted, it could that the jms send back the done status to the
>> >> pojo, and everything could be executed in the same thread.  Not sure
>> >> though ... But this is the only explanation I have so far.
>> >>
>> >> On Mon, Jun 23, 2008 at 5:52 PM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > Ohhhh ok, that was my initial thought, but then I decided it read as
>> >> though
>> >> > I could actually get it from my bean component without modifiying the
>> >> > source.  No problem, now that I follow you.. I'll go ahead and try it.
>> >> >
>> >> > Out of curiosity though, if my bean is sending a message to itself for
>> >> some
>> >> > reason.. isn't that a sign of a bigger problem?  I'm trying to send a
>> >> > message to my jms component....
>> >> >
>> >> > On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
>> >> >> the component and install it instead of the old one.
>> >> >> You can compile 3.2.x branch by checking it out from;
>> >> >>
>> >> http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
>> >> >> Then run:
>> >> >>   mvn install -Pstep1 -Dmaven.test.skip=true
>> >> >>   mvn install -Pstep2 -Dmaven.test.skip=true
>> >> >> You may be able to simply hack the component and recompile it without
>> >> >> compiling the whole tree:
>> >> >>   cd deployables/serviceengines/servicemix-bean
>> >> >>   mvn install
>> >> >>
>> >> >> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fragility2.0@gmail.com
>> >
>> >> >> wrote:
>> >> >> > I feel dumb asking this, but I've been looking at the source code
>> and
>> >> I'm
>> >> >> > not sure how to test out your suggestion?  How am I able to
>> retrieve
>> >> the
>> >> >> > current request?  It looks like it's contained in a parent object
>> that
>> >> >> isn't
>> >> >> > accessible to my bean?
>> >> >> >
>> >> >> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gnodet@gmail.com
>> >
>> >> >> wrote:
>> >> >> >
>> >> >> >> Could you please test something ?
>> >> >> >> In the BeanEndpoint, save the old value for the
>> currentRequest.get()
>> >> >> >> in a local variable before setting it to the new value, and
>> instead
>> >> of
>> >> >> >> setting it to null after processing, set it back to the old value.
>> >>  It
>> >> >> >> may fix the problem ...
>> >> >> >>
>> >> >> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <
>> gnodet@gmail.com>
>> >> >> >> wrote:
>> >> >> >> > I'm wondering if for some reason your endpoint sends a request
>> to
>> >> >> itself
>> >> >> >> ?
>> >> >> >> > If this request is handled synchronously, it may happen that the
>> >> >> >> > currentRequest is set to null while handling this request, but
>> in
>> >> the
>> >> >> >> > same thread as the first request ?
>> >> >> >> > Under high load, this behavior could happen if the thread pool
>> is
>> >> >> >> > exhausted, because under such conditions, the work will be
>> executed
>> >> in
>> >> >> >> > the same thread...
>> >> >> >> >
>> >> >> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <
>> >> fragility2.0@gmail.com>
>> >> >> >> wrote:
>> >> >> >> >> Oh right, because the thread obviously would be the one that
>> would
>> >> go
>> >> >> >> >> through onMessageExchange method and then it would be set to
>> null
>> >> >> >> after...
>> >> >> >> >> (bear with me, long weekend dealing with this problem and it's
>> 4am
>> >> on
>> >> >> a
>> >> >> >> >> workday.. haha).
>> >> >> >> >>
>> >> >> >> >> It's a rather large bean, composed of several classes (it does
>> a
>> >> lot
>> >> >> of
>> >> >> >> >> complicated stuff inside the bean)... but I could probably send
>> >> you
>> >> >> some
>> >> >> >> >> pieces of it... do you mind if I email them privately to you?
>> >> >> >> >>
>> >> >> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <
>> >> gnodet@gmail.com>
>> >> >> >> wrote:
>> >> >> >> >>
>> >> >> >> >>> But the current request is only set to null *after* calling
>> the
>> >> >> pojo.
>> >> >> >> >>>  Do you have the full code of you bean ?
>> >> >> >> >>>
>> >> >> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
>> >> >> fragility2.0@gmail.com>
>> >> >> >> >>> wrote:
>> >> >> >> >>> > Sure, I backed out the changes in my editor.. basically my
>> bean
>> >> is
>> >> >> >> >>> standard
>> >> >> >> >>> > compared to the servicemix docs (for how to handle the
>> exchange
>> >> >> >> coming
>> >> >> >> >>> in),
>> >> >> >> >>> > then my bean takes the injected deliverychannel and hands it
>> to
>> >> a
>> >> >> >> class
>> >> >> >> >>> that
>> >> >> >> >>> > creates a message to send out with results of some analysis
>> >> >> >> performed..
>> >> >> >> >>> here
>> >> >> >> >>> > is the code to send out (it's using the DeliveryChannel
>> >> injected
>> >> >> into
>> >> >> >> the
>> >> >> >> >>> > bean by Servicemix):
>> >> >> >> >>> >
>> >> >> >> >>> > Marshaller notificationMarshaller =
>> >> >> jaxbContext.createMarshaller();
>> >> >> >> >>> >
>> >> >> >>
>>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> >> >> >> >>> > Boolean.TRUE);
>> >> >> >> >>> >      notificationMarshaller.marshal(notification, writer);
>> >> >> >> >>> >      if (destinationQname == null) {
>> >> >> >> >>> >        destinationQname = new
>> QName(getDestinationNamespace(),
>> >> >> >> >>> > getDestinationService());
>> >> >> >> >>> >      }
>> >> >> >> >>> >      MessageExchangeFactory exchangeFactory =
>> >> >> >> >>> > deliveryChannel.createExchangeFactory();
>> >> >> >> >>> >      InOnly exchange =
>> exchangeFactory.createInOnlyExchange();
>> >> >> >> >>> >      NormalizedMessage message = exchange.createMessage();
>> >> >> >> >>> >      message.setContent(new
>> StringSource(writer.toString()));
>> >> >> >> >>> >      exchange.setInMessage(message);
>> >> >> >> >>> >      exchange.setService(destinationQname);
>> >> >> >> >>> >      deliveryChannel.send(exchange);
>> >> >> >> >>> >
>> >> >> >> >>> > The send is where the ConcurrentHashmap complains about an
>> NPE
>> >> ..
>> >> >> I
>> >> >> >> think
>> >> >> >> >>> > because the BeanComponent sets the CurrentRequest to null
>> >> around
>> >> >> the
>> >> >> >> time
>> >> >> >> >>> my
>> >> >> >> >>> > code is trying to send a request that must get clobbered?
>> >>  There's
>> >> >> no
>> >> >> >> >>> other
>> >> >> >> >>> > explanation for it.. it looks like the NPE is caused by
>> >> >> >> >>> > currentRequest.get(), which is set back to null by the
>> >> >> BeanComponent
>> >> >> >> and
>> >> >> >> >>> > since they are in the same thread.... they interfere.
>> >> >> >> >>> >
>> >> >> >> >>> > Ryan
>> >> >> >> >>> >
>> >> >> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
>> >> >> gnodet@gmail.com>
>> >> >> >> >>> wrote:
>> >> >> >> >>> >
>> >> >> >> >>> >> Is there any way you could paste the code of the bean
>> you're
>> >> >> using
>> >> >> >> so
>> >> >> >> >>> >> that i can have a quick look. You can skip any non-jbi
>> related
>> >> >> >> >>> >> processing...
>> >> >> >> >>> >>
>> >> >> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
>> >> >> >> fragility2.0@gmail.com>
>> >> >> >> >>> >> wrote:
>> >> >> >> >>> >> > No, I'm just simply using the deliverychannel to send
>> out,
>> >> >> which
>> >> >> >> is
>> >> >> >> >>> >> > mentioned in the servicemix docs as something that you
>> can
>> >> do.
>> >> >>  I
>> >> >> >> >>> assume
>> >> >> >> >>> >> > that means it's recommended :)  I did see that I can
>> inject
>> >> a
>> >> >> >> >>> >> > ComponentContext and so I'm currently changing my
>> outbound
>> >> >> >> messages to
>> >> >> >> >>> >> that
>> >> >> >> >>> >> > to see if I can get around this problem.  I think I just
>> >> can't
>> >> >> use
>> >> >> >> the
>> >> >> >> >>> >> > DeliveryContext in the same Pojo (same thread).
>> >> >> >> >>> >> >
>> >> >> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
>> >> >> >> gnodet@gmail.com>
>> >> >> >> >>> >> wrote:
>> >> >> >> >>> >> >
>> >> >> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >> >> >>> >> >> currentRequest.get() is null.
>> >> >> >> >>> >> >> Do you perform any threading operation in the pojo ? If
>> >> yes,
>> >> >> you
>> >> >> >> >>> >> >> should try to remove that, as the component is already
>> able
>> >> to
>> >> >> >> handle
>> >> >> >> >>> >> >> concurrent requests.
>> >> >> >> >>> >> >>
>> >> >> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
>> >> >> >> fragility2.0@gmail.com
>> >> >> >> >>> >
>> >> >> >> >>> >> >> wrote:
>> >> >> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is
>> >> working
>> >> >> >> pretty
>> >> >> >> >>> >> bad
>> >> >> >> >>> >> >> for
>> >> >> >> >>> >> >> > me and has the same problem :(  It only seems to
>> affect
>> >> our
>> >> >> >> >>> production
>> >> >> >> >>> >> >> > server and in a few minutes after start up, I start
>> >> getting
>> >> >> the
>> >> >> >> >>> >> >> > NullPointerException.. slowly all my services start
>> doing
>> >> it
>> >> >> >> and
>> >> >> >> >>> they
>> >> >> >> >>> >> all
>> >> >> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
>> >> >> >> >>> servicemix-jms
>> >> >> >> >>> >> >> > components are no longer routable.  I'm guessing this
>> >> error
>> >> >> >> causes
>> >> >> >> >>> >> >> > Servicemix to shut them down and not deploy them
>> anymore
>> >> >> >> >>> (Servicemix
>> >> >> >> >>> >> does
>> >> >> >> >>> >> >> > the same thing if a service unit starts up, tries to
>> make
>> >> a
>> >> >> >> Joram
>> >> >> >> >>> >> >> connection
>> >> >> >> >>> >> >> > to a server that isn't up, servicemix will shutdown
>> that
>> >> SU
>> >> >> and
>> >> >> >> >>> will
>> >> >> >> >>> >> >> always
>> >> >> >> >>> >> >> > shut it down immediately after it starts on any
>> >> subsequent
>> >> >> >> run).
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > It seems like this problem must be related to a race
>> >> >> condition.
>> >> >> >> >>>  When
>> >> >> >> >>> >> >> doing
>> >> >> >> >>> >> >> > development testing, I never see this problem on my
>> >> laptop
>> >> >> even
>> >> >> >> >>> under
>> >> >> >> >>> >> >> high
>> >> >> >> >>> >> >> > load.  One our fast test server, I see this error
>> popup
>> >> once
>> >> >> on
>> >> >> >> >>> >> startup
>> >> >> >> >>> >> >> and
>> >> >> >> >>> >> >> > then it doesn't seem to happen again.  On our even
>> faster
>> >> >> >> >>> production
>> >> >> >> >>> >> >> server,
>> >> >> >> >>> >> >> > the whole thing looses it's wheels and falls apart
>> after
>> >> a
>> >> >> few
>> >> >> >> >>> >> minutes.
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > I'm supposed to be deploying this system in a few days
>> >> and
>> >> >> of
>> >> >> >> >>> course
>> >> >> >> >>> >> >> that's
>> >> >> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is
>> it
>> >> >> >> possible
>> >> >> >> >>> you
>> >> >> >> >>> >> >> could
>> >> >> >> >>> >> >> > give me some hints on what the problem is and I'll
>> debug
>> >> it
>> >> >> >> this
>> >> >> >> >>> >> weekend
>> >> >> >> >>> >> >> to
>> >> >> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?
>>  I
>> >> >> >> really
>> >> >> >> >>> need
>> >> >> >> >>> >> to
>> >> >> >> >>> >> >> > figure out way to get around this problem.  Other than
>> >> that,
>> >> >> >> 3.2.2
>> >> >> >> >>> >> seems
>> >> >> >> >>> >> >> to
>> >> >> >> >>> >> >> > work perfectly fine.
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > Here is the caused by error again in case it's any bit
>> >> >> >> different
>> >> >> >> >>> than
>> >> >> >> >>> >> the
>> >> >> >> >>> >> >> > 3.2.1 one was:
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > Caused by: java.lang.NullPointerException
>> >> >> >> >>> >> >> >        at
>> >> >> >> >>> >> >> >
>> >> >> >> >>>
>> >> >>
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >> >> >>> >> >> >        at
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >>
>> >> >> >> >>> >>
>> >> >> >> >>>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >> >> >>> >> >> >        at
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >>
>> >> >> >> >>> >>
>> >> >> >> >>>
>> >> >> >>
>> >> >>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >> >> >>> >> >> > ionHandlerImpl.java:80)
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > Also, is the delivery channel component threadsafe?
>>  I'm
>> >> >> >> curious if
>> >> >> >> >>> >> >> multiple
>> >> >> >> >>> >> >> > threads accessing it is a problem or if I should keep
>> >> access
>> >> >> to
>> >> >> >> it
>> >> >> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't
>> >> want
>> >> >> to
>> >> >> >> if I
>> >> >> >> >>> >> don't
>> >> >> >> >>> >> >> > need to.
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > Thanks!
>> >> >> >> >>> >> >> > Ryan
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> >> >> >> >>> bruce.snyder@gmail.com
>> >> >> >> >>> >> >
>> >> >> >> >>> >> >> > wrote:
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> >> >> >> >>> fragility2.0@gmail.com
>> >> >> >> >>> >> >
>> >> >> >> >>> >> >> >> wrote:
>> >> >> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a
>> try.
>> >>  I
>> >> >> was
>> >> >> >> >>> kind
>> >> >> >> >>> >> of
>> >> >> >> >>> >> >> >> waiting
>> >> >> >> >>> >> >> >> > until it was released, but this problem is now
>> >> cropping
>> >> >> up
>> >> >> >> on a
>> >> >> >> >>> >> >> regular
>> >> >> >> >>> >> >> >> > basis on a server so I'll definitely give it a
>> shot.
>> >> >> >>  Hopefully
>> >> >> >> >>> >> this
>> >> >> >> >>> >> >> will
>> >> >> >> >>> >> >> >> > allow me to get this project done so I can then get
>> >> that
>> >> >> >> Joram
>> >> >> >> >>> >> write
>> >> >> >> >>> >> >> up
>> >> >> >> >>> >> >> >> done
>> >> >> >> >>> >> >> >> > since I should have ran across hopefully most of
>> the
>> >> >> gotchas
>> >> >> >> for
>> >> >> >> >>> it
>> >> >> >> >>> >> at
>> >> >> >> >>> >> >> >> that
>> >> >> >> >>> >> >> >> > point.
>> >> >> >> >>> >> >> >>
>> >> >> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's
>> pretty
>> >> >> >> stable.
>> >> >> >> >>> Maybe
>> >> >> >> >>> >> >> >> we can release it this weekend.
>> >> >> >> >>> >> >> >>
>> >> >> >> >>> >> >> >> Bruce
>> >> >> >> >>> >> >> >> --
>> >> >> >> >>> >> >> >> perl -e 'print
>> >> >> >> >>> >> >> >>
>> >> >> >> >>>
>> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> >> >>> >> >> >> );'
>> >> >> >> >>> >> >> >>
>> >> >> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >> >> >>> >> >> >>
>> >> >> >> >>> >> >> >> Blog: http://bruceblog.org/
>> >> >> >> >>> >> >> >>
>> >> >> >> >>> >> >> >
>> >> >> >> >>> >> >>
>> >> >> >> >>> >> >>
>> >> >> >> >>> >> >>
>> >> >> >> >>> >> >> --
>> >> >> >> >>> >> >> Cheers,
>> >> >> >> >>> >> >> Guillaume Nodet
>> >> >> >> >>> >> >> ------------------------
>> >> >> >> >>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >> >> >>> >> >>
>> >> >> >> >>> >> >
>> >> >> >> >>> >>
>> >> >> >> >>> >>
>> >> >> >> >>> >>
>> >> >> >> >>> >> --
>> >> >> >> >>> >> Cheers,
>> >> >> >> >>> >> Guillaume Nodet
>> >> >> >> >>> >> ------------------------
>> >> >> >> >>> >> Blog: http://gnodet.blogspot.com/
>> >> >> >> >>> >>
>> >> >> >> >>> >
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>>
>> >> >> >> >>> --
>> >> >> >> >>> Cheers,
>> >> >> >> >>> Guillaume Nodet
>> >> >> >> >>> ------------------------
>> >> >> >> >>> Blog: http://gnodet.blogspot.com/
>> >> >> >> >>>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Cheers,
>> >> >> >> Guillaume Nodet
>> >> >> >> ------------------------
>> >> >> >> Blog: http://gnodet.blogspot.com/
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Cheers,
>> >> >> Guillaume Nodet
>> >> >> ------------------------
>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Actually, after your conversation.. I went and upped the threads, which
seemed like a logical solution (I didn't tell you only 10% of the CPU was
being used, so it could handle more load).  So I just went and doubled the
threads in servicemix for the heck of it, and the problem completely went
away.  So your theory on the problem was correct, it was just easier to up
the thread count to correct it.

Anyhow, anyone else that has servicemix processing lots of messages, with a
similar problem, and has CPU room to spare.  That's one solution. :)

Thanks!!!
Ryan

On Mon, Jun 23, 2008 at 2:48 PM, Guillaume Nodet <gn...@gmail.com> wrote:

> No, I don't think your code is a problem at this point.
> I'm not sure what happens exactly, but the fix I suggested is the only
> solution i'm seeing right now.
>
> On Mon, Jun 23, 2008 at 8:29 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Oh, so you mean that it's not the bean sending the message to itself,
> it's
> > that the jms consumer is sending back a reply, but not allocating a new
> > thread for it.  I am sending synchronously.. so maybe that's why?  If
> that's
> > the case.. then it sounds more like I'm simply not handling the reply
> > properly then?
> >
> > On Mon, Jun 23, 2008 at 12:21 PM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> it may be a little more complicated though.  If all the thread pool
> >> are exhausted, it could that the jms send back the done status to the
> >> pojo, and everything could be executed in the same thread.  Not sure
> >> though ... But this is the only explanation I have so far.
> >>
> >> On Mon, Jun 23, 2008 at 5:52 PM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > Ohhhh ok, that was my initial thought, but then I decided it read as
> >> though
> >> > I could actually get it from my bean component without modifiying the
> >> > source.  No problem, now that I follow you.. I'll go ahead and try it.
> >> >
> >> > Out of curiosity though, if my bean is sending a message to itself for
> >> some
> >> > reason.. isn't that a sign of a bigger problem?  I'm trying to send a
> >> > message to my jms component....
> >> >
> >> > On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> >
> >> >> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
> >> >> the component and install it instead of the old one.
> >> >> You can compile 3.2.x branch by checking it out from;
> >> >>
> >> http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
> >> >> Then run:
> >> >>   mvn install -Pstep1 -Dmaven.test.skip=true
> >> >>   mvn install -Pstep2 -Dmaven.test.skip=true
> >> >> You may be able to simply hack the component and recompile it without
> >> >> compiling the whole tree:
> >> >>   cd deployables/serviceengines/servicemix-bean
> >> >>   mvn install
> >> >>
> >> >> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fragility2.0@gmail.com
> >
> >> >> wrote:
> >> >> > I feel dumb asking this, but I've been looking at the source code
> and
> >> I'm
> >> >> > not sure how to test out your suggestion?  How am I able to
> retrieve
> >> the
> >> >> > current request?  It looks like it's contained in a parent object
> that
> >> >> isn't
> >> >> > accessible to my bean?
> >> >> >
> >> >> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gnodet@gmail.com
> >
> >> >> wrote:
> >> >> >
> >> >> >> Could you please test something ?
> >> >> >> In the BeanEndpoint, save the old value for the
> currentRequest.get()
> >> >> >> in a local variable before setting it to the new value, and
> instead
> >> of
> >> >> >> setting it to null after processing, set it back to the old value.
> >>  It
> >> >> >> may fix the problem ...
> >> >> >>
> >> >> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <
> gnodet@gmail.com>
> >> >> >> wrote:
> >> >> >> > I'm wondering if for some reason your endpoint sends a request
> to
> >> >> itself
> >> >> >> ?
> >> >> >> > If this request is handled synchronously, it may happen that the
> >> >> >> > currentRequest is set to null while handling this request, but
> in
> >> the
> >> >> >> > same thread as the first request ?
> >> >> >> > Under high load, this behavior could happen if the thread pool
> is
> >> >> >> > exhausted, because under such conditions, the work will be
> executed
> >> in
> >> >> >> > the same thread...
> >> >> >> >
> >> >> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <
> >> fragility2.0@gmail.com>
> >> >> >> wrote:
> >> >> >> >> Oh right, because the thread obviously would be the one that
> would
> >> go
> >> >> >> >> through onMessageExchange method and then it would be set to
> null
> >> >> >> after...
> >> >> >> >> (bear with me, long weekend dealing with this problem and it's
> 4am
> >> on
> >> >> a
> >> >> >> >> workday.. haha).
> >> >> >> >>
> >> >> >> >> It's a rather large bean, composed of several classes (it does
> a
> >> lot
> >> >> of
> >> >> >> >> complicated stuff inside the bean)... but I could probably send
> >> you
> >> >> some
> >> >> >> >> pieces of it... do you mind if I email them privately to you?
> >> >> >> >>
> >> >> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <
> >> gnodet@gmail.com>
> >> >> >> wrote:
> >> >> >> >>
> >> >> >> >>> But the current request is only set to null *after* calling
> the
> >> >> pojo.
> >> >> >> >>>  Do you have the full code of you bean ?
> >> >> >> >>>
> >> >> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
> >> >> fragility2.0@gmail.com>
> >> >> >> >>> wrote:
> >> >> >> >>> > Sure, I backed out the changes in my editor.. basically my
> bean
> >> is
> >> >> >> >>> standard
> >> >> >> >>> > compared to the servicemix docs (for how to handle the
> exchange
> >> >> >> coming
> >> >> >> >>> in),
> >> >> >> >>> > then my bean takes the injected deliverychannel and hands it
> to
> >> a
> >> >> >> class
> >> >> >> >>> that
> >> >> >> >>> > creates a message to send out with results of some analysis
> >> >> >> performed..
> >> >> >> >>> here
> >> >> >> >>> > is the code to send out (it's using the DeliveryChannel
> >> injected
> >> >> into
> >> >> >> the
> >> >> >> >>> > bean by Servicemix):
> >> >> >> >>> >
> >> >> >> >>> > Marshaller notificationMarshaller =
> >> >> jaxbContext.createMarshaller();
> >> >> >> >>> >
> >> >> >>
>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >> >> >> >>> > Boolean.TRUE);
> >> >> >> >>> >      notificationMarshaller.marshal(notification, writer);
> >> >> >> >>> >      if (destinationQname == null) {
> >> >> >> >>> >        destinationQname = new
> QName(getDestinationNamespace(),
> >> >> >> >>> > getDestinationService());
> >> >> >> >>> >      }
> >> >> >> >>> >      MessageExchangeFactory exchangeFactory =
> >> >> >> >>> > deliveryChannel.createExchangeFactory();
> >> >> >> >>> >      InOnly exchange =
> exchangeFactory.createInOnlyExchange();
> >> >> >> >>> >      NormalizedMessage message = exchange.createMessage();
> >> >> >> >>> >      message.setContent(new
> StringSource(writer.toString()));
> >> >> >> >>> >      exchange.setInMessage(message);
> >> >> >> >>> >      exchange.setService(destinationQname);
> >> >> >> >>> >      deliveryChannel.send(exchange);
> >> >> >> >>> >
> >> >> >> >>> > The send is where the ConcurrentHashmap complains about an
> NPE
> >> ..
> >> >> I
> >> >> >> think
> >> >> >> >>> > because the BeanComponent sets the CurrentRequest to null
> >> around
> >> >> the
> >> >> >> time
> >> >> >> >>> my
> >> >> >> >>> > code is trying to send a request that must get clobbered?
> >>  There's
> >> >> no
> >> >> >> >>> other
> >> >> >> >>> > explanation for it.. it looks like the NPE is caused by
> >> >> >> >>> > currentRequest.get(), which is set back to null by the
> >> >> BeanComponent
> >> >> >> and
> >> >> >> >>> > since they are in the same thread.... they interfere.
> >> >> >> >>> >
> >> >> >> >>> > Ryan
> >> >> >> >>> >
> >> >> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
> >> >> gnodet@gmail.com>
> >> >> >> >>> wrote:
> >> >> >> >>> >
> >> >> >> >>> >> Is there any way you could paste the code of the bean
> you're
> >> >> using
> >> >> >> so
> >> >> >> >>> >> that i can have a quick look. You can skip any non-jbi
> related
> >> >> >> >>> >> processing...
> >> >> >> >>> >>
> >> >> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
> >> >> >> fragility2.0@gmail.com>
> >> >> >> >>> >> wrote:
> >> >> >> >>> >> > No, I'm just simply using the deliverychannel to send
> out,
> >> >> which
> >> >> >> is
> >> >> >> >>> >> > mentioned in the servicemix docs as something that you
> can
> >> do.
> >> >>  I
> >> >> >> >>> assume
> >> >> >> >>> >> > that means it's recommended :)  I did see that I can
> inject
> >> a
> >> >> >> >>> >> > ComponentContext and so I'm currently changing my
> outbound
> >> >> >> messages to
> >> >> >> >>> >> that
> >> >> >> >>> >> > to see if I can get around this problem.  I think I just
> >> can't
> >> >> use
> >> >> >> the
> >> >> >> >>> >> > DeliveryContext in the same Pojo (same thread).
> >> >> >> >>> >> >
> >> >> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
> >> >> >> gnodet@gmail.com>
> >> >> >> >>> >> wrote:
> >> >> >> >>> >> >
> >> >> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
> >> >> >> >>> >> >> currentRequest.get() is null.
> >> >> >> >>> >> >> Do you perform any threading operation in the pojo ? If
> >> yes,
> >> >> you
> >> >> >> >>> >> >> should try to remove that, as the component is already
> able
> >> to
> >> >> >> handle
> >> >> >> >>> >> >> concurrent requests.
> >> >> >> >>> >> >>
> >> >> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> >> >> >> fragility2.0@gmail.com
> >> >> >> >>> >
> >> >> >> >>> >> >> wrote:
> >> >> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is
> >> working
> >> >> >> pretty
> >> >> >> >>> >> bad
> >> >> >> >>> >> >> for
> >> >> >> >>> >> >> > me and has the same problem :(  It only seems to
> affect
> >> our
> >> >> >> >>> production
> >> >> >> >>> >> >> > server and in a few minutes after start up, I start
> >> getting
> >> >> the
> >> >> >> >>> >> >> > NullPointerException.. slowly all my services start
> doing
> >> it
> >> >> >> and
> >> >> >> >>> they
> >> >> >> >>> >> all
> >> >> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
> >> >> >> >>> servicemix-jms
> >> >> >> >>> >> >> > components are no longer routable.  I'm guessing this
> >> error
> >> >> >> causes
> >> >> >> >>> >> >> > Servicemix to shut them down and not deploy them
> anymore
> >> >> >> >>> (Servicemix
> >> >> >> >>> >> does
> >> >> >> >>> >> >> > the same thing if a service unit starts up, tries to
> make
> >> a
> >> >> >> Joram
> >> >> >> >>> >> >> connection
> >> >> >> >>> >> >> > to a server that isn't up, servicemix will shutdown
> that
> >> SU
> >> >> and
> >> >> >> >>> will
> >> >> >> >>> >> >> always
> >> >> >> >>> >> >> > shut it down immediately after it starts on any
> >> subsequent
> >> >> >> run).
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > It seems like this problem must be related to a race
> >> >> condition.
> >> >> >> >>>  When
> >> >> >> >>> >> >> doing
> >> >> >> >>> >> >> > development testing, I never see this problem on my
> >> laptop
> >> >> even
> >> >> >> >>> under
> >> >> >> >>> >> >> high
> >> >> >> >>> >> >> > load.  One our fast test server, I see this error
> popup
> >> once
> >> >> on
> >> >> >> >>> >> startup
> >> >> >> >>> >> >> and
> >> >> >> >>> >> >> > then it doesn't seem to happen again.  On our even
> faster
> >> >> >> >>> production
> >> >> >> >>> >> >> server,
> >> >> >> >>> >> >> > the whole thing looses it's wheels and falls apart
> after
> >> a
> >> >> few
> >> >> >> >>> >> minutes.
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > I'm supposed to be deploying this system in a few days
> >> and
> >> >> of
> >> >> >> >>> course
> >> >> >> >>> >> >> that's
> >> >> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is
> it
> >> >> >> possible
> >> >> >> >>> you
> >> >> >> >>> >> >> could
> >> >> >> >>> >> >> > give me some hints on what the problem is and I'll
> debug
> >> it
> >> >> >> this
> >> >> >> >>> >> weekend
> >> >> >> >>> >> >> to
> >> >> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?
>  I
> >> >> >> really
> >> >> >> >>> need
> >> >> >> >>> >> to
> >> >> >> >>> >> >> > figure out way to get around this problem.  Other than
> >> that,
> >> >> >> 3.2.2
> >> >> >> >>> >> seems
> >> >> >> >>> >> >> to
> >> >> >> >>> >> >> > work perfectly fine.
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > Here is the caused by error again in case it's any bit
> >> >> >> different
> >> >> >> >>> than
> >> >> >> >>> >> the
> >> >> >> >>> >> >> > 3.2.1 one was:
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > Caused by: java.lang.NullPointerException
> >> >> >> >>> >> >> >        at
> >> >> >> >>> >> >> >
> >> >> >> >>>
> >> >>
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >> >> >>> >> >> >        at
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >>
> >> >> >> >>> >>
> >> >> >> >>>
> >> >> >>
> >> >>
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >> >> >>> >> >> >        at
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >>
> >> >> >> >>> >>
> >> >> >> >>>
> >> >> >>
> >> >>
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> >> >> >>> >> >> > ionHandlerImpl.java:80)
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > Also, is the delivery channel component threadsafe?
>  I'm
> >> >> >> curious if
> >> >> >> >>> >> >> multiple
> >> >> >> >>> >> >> > threads accessing it is a problem or if I should keep
> >> access
> >> >> to
> >> >> >> it
> >> >> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't
> >> want
> >> >> to
> >> >> >> if I
> >> >> >> >>> >> don't
> >> >> >> >>> >> >> > need to.
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > Thanks!
> >> >> >> >>> >> >> > Ryan
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >> >> >> >>> bruce.snyder@gmail.com
> >> >> >> >>> >> >
> >> >> >> >>> >> >> > wrote:
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >> >> >> >>> fragility2.0@gmail.com
> >> >> >> >>> >> >
> >> >> >> >>> >> >> >> wrote:
> >> >> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a
> try.
> >>  I
> >> >> was
> >> >> >> >>> kind
> >> >> >> >>> >> of
> >> >> >> >>> >> >> >> waiting
> >> >> >> >>> >> >> >> > until it was released, but this problem is now
> >> cropping
> >> >> up
> >> >> >> on a
> >> >> >> >>> >> >> regular
> >> >> >> >>> >> >> >> > basis on a server so I'll definitely give it a
> shot.
> >> >> >>  Hopefully
> >> >> >> >>> >> this
> >> >> >> >>> >> >> will
> >> >> >> >>> >> >> >> > allow me to get this project done so I can then get
> >> that
> >> >> >> Joram
> >> >> >> >>> >> write
> >> >> >> >>> >> >> up
> >> >> >> >>> >> >> >> done
> >> >> >> >>> >> >> >> > since I should have ran across hopefully most of
> the
> >> >> gotchas
> >> >> >> for
> >> >> >> >>> it
> >> >> >> >>> >> at
> >> >> >> >>> >> >> >> that
> >> >> >> >>> >> >> >> > point.
> >> >> >> >>> >> >> >>
> >> >> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's
> pretty
> >> >> >> stable.
> >> >> >> >>> Maybe
> >> >> >> >>> >> >> >> we can release it this weekend.
> >> >> >> >>> >> >> >>
> >> >> >> >>> >> >> >> Bruce
> >> >> >> >>> >> >> >> --
> >> >> >> >>> >> >> >> perl -e 'print
> >> >> >> >>> >> >> >>
> >> >> >> >>>
> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >> >> >>> >> >> >> );'
> >> >> >> >>> >> >> >>
> >> >> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
> >> >> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
> >> >> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
> >> >> >> >>> >> >> >>
> >> >> >> >>> >> >> >> Blog: http://bruceblog.org/
> >> >> >> >>> >> >> >>
> >> >> >> >>> >> >> >
> >> >> >> >>> >> >>
> >> >> >> >>> >> >>
> >> >> >> >>> >> >>
> >> >> >> >>> >> >> --
> >> >> >> >>> >> >> Cheers,
> >> >> >> >>> >> >> Guillaume Nodet
> >> >> >> >>> >> >> ------------------------
> >> >> >> >>> >> >> Blog: http://gnodet.blogspot.com/
> >> >> >> >>> >> >>
> >> >> >> >>> >> >
> >> >> >> >>> >>
> >> >> >> >>> >>
> >> >> >> >>> >>
> >> >> >> >>> >> --
> >> >> >> >>> >> Cheers,
> >> >> >> >>> >> Guillaume Nodet
> >> >> >> >>> >> ------------------------
> >> >> >> >>> >> Blog: http://gnodet.blogspot.com/
> >> >> >> >>> >>
> >> >> >> >>> >
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>>
> >> >> >> >>> --
> >> >> >> >>> Cheers,
> >> >> >> >>> Guillaume Nodet
> >> >> >> >>> ------------------------
> >> >> >> >>> Blog: http://gnodet.blogspot.com/
> >> >> >> >>>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Cheers,
> >> >> >> Guillaume Nodet
> >> >> >> ------------------------
> >> >> >> Blog: http://gnodet.blogspot.com/
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Cheers,
> >> >> Guillaume Nodet
> >> >> ------------------------
> >> >> Blog: http://gnodet.blogspot.com/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
No, I don't think your code is a problem at this point.
I'm not sure what happens exactly, but the fix I suggested is the only
solution i'm seeing right now.

On Mon, Jun 23, 2008 at 8:29 PM, Ryan Moquin <fr...@gmail.com> wrote:
> Oh, so you mean that it's not the bean sending the message to itself, it's
> that the jms consumer is sending back a reply, but not allocating a new
> thread for it.  I am sending synchronously.. so maybe that's why?  If that's
> the case.. then it sounds more like I'm simply not handling the reply
> properly then?
>
> On Mon, Jun 23, 2008 at 12:21 PM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> it may be a little more complicated though.  If all the thread pool
>> are exhausted, it could that the jms send back the done status to the
>> pojo, and everything could be executed in the same thread.  Not sure
>> though ... But this is the only explanation I have so far.
>>
>> On Mon, Jun 23, 2008 at 5:52 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > Ohhhh ok, that was my initial thought, but then I decided it read as
>> though
>> > I could actually get it from my bean component without modifiying the
>> > source.  No problem, now that I follow you.. I'll go ahead and try it.
>> >
>> > Out of curiosity though, if my bean is sending a message to itself for
>> some
>> > reason.. isn't that a sign of a bigger problem?  I'm trying to send a
>> > message to my jms component....
>> >
>> > On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
>> >> the component and install it instead of the old one.
>> >> You can compile 3.2.x branch by checking it out from;
>> >>
>> http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
>> >> Then run:
>> >>   mvn install -Pstep1 -Dmaven.test.skip=true
>> >>   mvn install -Pstep2 -Dmaven.test.skip=true
>> >> You may be able to simply hack the component and recompile it without
>> >> compiling the whole tree:
>> >>   cd deployables/serviceengines/servicemix-bean
>> >>   mvn install
>> >>
>> >> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > I feel dumb asking this, but I've been looking at the source code and
>> I'm
>> >> > not sure how to test out your suggestion?  How am I able to retrieve
>> the
>> >> > current request?  It looks like it's contained in a parent object that
>> >> isn't
>> >> > accessible to my bean?
>> >> >
>> >> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> Could you please test something ?
>> >> >> In the BeanEndpoint, save the old value for the currentRequest.get()
>> >> >> in a local variable before setting it to the new value, and instead
>> of
>> >> >> setting it to null after processing, set it back to the old value.
>>  It
>> >> >> may fix the problem ...
>> >> >>
>> >> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
>> >> >> wrote:
>> >> >> > I'm wondering if for some reason your endpoint sends a request to
>> >> itself
>> >> >> ?
>> >> >> > If this request is handled synchronously, it may happen that the
>> >> >> > currentRequest is set to null while handling this request, but in
>> the
>> >> >> > same thread as the first request ?
>> >> >> > Under high load, this behavior could happen if the thread pool is
>> >> >> > exhausted, because under such conditions, the work will be executed
>> in
>> >> >> > the same thread...
>> >> >> >
>> >> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <
>> fragility2.0@gmail.com>
>> >> >> wrote:
>> >> >> >> Oh right, because the thread obviously would be the one that would
>> go
>> >> >> >> through onMessageExchange method and then it would be set to null
>> >> >> after...
>> >> >> >> (bear with me, long weekend dealing with this problem and it's 4am
>> on
>> >> a
>> >> >> >> workday.. haha).
>> >> >> >>
>> >> >> >> It's a rather large bean, composed of several classes (it does a
>> lot
>> >> of
>> >> >> >> complicated stuff inside the bean)... but I could probably send
>> you
>> >> some
>> >> >> >> pieces of it... do you mind if I email them privately to you?
>> >> >> >>
>> >> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <
>> gnodet@gmail.com>
>> >> >> wrote:
>> >> >> >>
>> >> >> >>> But the current request is only set to null *after* calling the
>> >> pojo.
>> >> >> >>>  Do you have the full code of you bean ?
>> >> >> >>>
>> >> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
>> >> fragility2.0@gmail.com>
>> >> >> >>> wrote:
>> >> >> >>> > Sure, I backed out the changes in my editor.. basically my bean
>> is
>> >> >> >>> standard
>> >> >> >>> > compared to the servicemix docs (for how to handle the exchange
>> >> >> coming
>> >> >> >>> in),
>> >> >> >>> > then my bean takes the injected deliverychannel and hands it to
>> a
>> >> >> class
>> >> >> >>> that
>> >> >> >>> > creates a message to send out with results of some analysis
>> >> >> performed..
>> >> >> >>> here
>> >> >> >>> > is the code to send out (it's using the DeliveryChannel
>> injected
>> >> into
>> >> >> the
>> >> >> >>> > bean by Servicemix):
>> >> >> >>> >
>> >> >> >>> > Marshaller notificationMarshaller =
>> >> jaxbContext.createMarshaller();
>> >> >> >>> >
>> >> >>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> >> >> >>> > Boolean.TRUE);
>> >> >> >>> >      notificationMarshaller.marshal(notification, writer);
>> >> >> >>> >      if (destinationQname == null) {
>> >> >> >>> >        destinationQname = new QName(getDestinationNamespace(),
>> >> >> >>> > getDestinationService());
>> >> >> >>> >      }
>> >> >> >>> >      MessageExchangeFactory exchangeFactory =
>> >> >> >>> > deliveryChannel.createExchangeFactory();
>> >> >> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >> >> >>> >      NormalizedMessage message = exchange.createMessage();
>> >> >> >>> >      message.setContent(new StringSource(writer.toString()));
>> >> >> >>> >      exchange.setInMessage(message);
>> >> >> >>> >      exchange.setService(destinationQname);
>> >> >> >>> >      deliveryChannel.send(exchange);
>> >> >> >>> >
>> >> >> >>> > The send is where the ConcurrentHashmap complains about an NPE
>> ..
>> >> I
>> >> >> think
>> >> >> >>> > because the BeanComponent sets the CurrentRequest to null
>> around
>> >> the
>> >> >> time
>> >> >> >>> my
>> >> >> >>> > code is trying to send a request that must get clobbered?
>>  There's
>> >> no
>> >> >> >>> other
>> >> >> >>> > explanation for it.. it looks like the NPE is caused by
>> >> >> >>> > currentRequest.get(), which is set back to null by the
>> >> BeanComponent
>> >> >> and
>> >> >> >>> > since they are in the same thread.... they interfere.
>> >> >> >>> >
>> >> >> >>> > Ryan
>> >> >> >>> >
>> >> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
>> >> gnodet@gmail.com>
>> >> >> >>> wrote:
>> >> >> >>> >
>> >> >> >>> >> Is there any way you could paste the code of the bean you're
>> >> using
>> >> >> so
>> >> >> >>> >> that i can have a quick look. You can skip any non-jbi related
>> >> >> >>> >> processing...
>> >> >> >>> >>
>> >> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
>> >> >> fragility2.0@gmail.com>
>> >> >> >>> >> wrote:
>> >> >> >>> >> > No, I'm just simply using the deliverychannel to send out,
>> >> which
>> >> >> is
>> >> >> >>> >> > mentioned in the servicemix docs as something that you can
>> do.
>> >>  I
>> >> >> >>> assume
>> >> >> >>> >> > that means it's recommended :)  I did see that I can inject
>> a
>> >> >> >>> >> > ComponentContext and so I'm currently changing my outbound
>> >> >> messages to
>> >> >> >>> >> that
>> >> >> >>> >> > to see if I can get around this problem.  I think I just
>> can't
>> >> use
>> >> >> the
>> >> >> >>> >> > DeliveryContext in the same Pojo (same thread).
>> >> >> >>> >> >
>> >> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
>> >> >> gnodet@gmail.com>
>> >> >> >>> >> wrote:
>> >> >> >>> >> >
>> >> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >> >>> >> >> currentRequest.get() is null.
>> >> >> >>> >> >> Do you perform any threading operation in the pojo ? If
>> yes,
>> >> you
>> >> >> >>> >> >> should try to remove that, as the component is already able
>> to
>> >> >> handle
>> >> >> >>> >> >> concurrent requests.
>> >> >> >>> >> >>
>> >> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
>> >> >> fragility2.0@gmail.com
>> >> >> >>> >
>> >> >> >>> >> >> wrote:
>> >> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is
>> working
>> >> >> pretty
>> >> >> >>> >> bad
>> >> >> >>> >> >> for
>> >> >> >>> >> >> > me and has the same problem :(  It only seems to affect
>> our
>> >> >> >>> production
>> >> >> >>> >> >> > server and in a few minutes after start up, I start
>> getting
>> >> the
>> >> >> >>> >> >> > NullPointerException.. slowly all my services start doing
>> it
>> >> >> and
>> >> >> >>> they
>> >> >> >>> >> all
>> >> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
>> >> >> >>> servicemix-jms
>> >> >> >>> >> >> > components are no longer routable.  I'm guessing this
>> error
>> >> >> causes
>> >> >> >>> >> >> > Servicemix to shut them down and not deploy them anymore
>> >> >> >>> (Servicemix
>> >> >> >>> >> does
>> >> >> >>> >> >> > the same thing if a service unit starts up, tries to make
>> a
>> >> >> Joram
>> >> >> >>> >> >> connection
>> >> >> >>> >> >> > to a server that isn't up, servicemix will shutdown that
>> SU
>> >> and
>> >> >> >>> will
>> >> >> >>> >> >> always
>> >> >> >>> >> >> > shut it down immediately after it starts on any
>> subsequent
>> >> >> run).
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > It seems like this problem must be related to a race
>> >> condition.
>> >> >> >>>  When
>> >> >> >>> >> >> doing
>> >> >> >>> >> >> > development testing, I never see this problem on my
>> laptop
>> >> even
>> >> >> >>> under
>> >> >> >>> >> >> high
>> >> >> >>> >> >> > load.  One our fast test server, I see this error popup
>> once
>> >> on
>> >> >> >>> >> startup
>> >> >> >>> >> >> and
>> >> >> >>> >> >> > then it doesn't seem to happen again.  On our even faster
>> >> >> >>> production
>> >> >> >>> >> >> server,
>> >> >> >>> >> >> > the whole thing looses it's wheels and falls apart after
>> a
>> >> few
>> >> >> >>> >> minutes.
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > I'm supposed to be deploying this system in a few days
>> and
>> >> of
>> >> >> >>> course
>> >> >> >>> >> >> that's
>> >> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
>> >> >> possible
>> >> >> >>> you
>> >> >> >>> >> >> could
>> >> >> >>> >> >> > give me some hints on what the problem is and I'll debug
>> it
>> >> >> this
>> >> >> >>> >> weekend
>> >> >> >>> >> >> to
>> >> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
>> >> >> really
>> >> >> >>> need
>> >> >> >>> >> to
>> >> >> >>> >> >> > figure out way to get around this problem.  Other than
>> that,
>> >> >> 3.2.2
>> >> >> >>> >> seems
>> >> >> >>> >> >> to
>> >> >> >>> >> >> > work perfectly fine.
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > Here is the caused by error again in case it's any bit
>> >> >> different
>> >> >> >>> than
>> >> >> >>> >> the
>> >> >> >>> >> >> > 3.2.1 one was:
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > Caused by: java.lang.NullPointerException
>> >> >> >>> >> >> >        at
>> >> >> >>> >> >> >
>> >> >> >>>
>> >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >> >>> >> >> >        at
>> >> >> >>> >> >> >
>> >> >> >>> >> >>
>> >> >> >>> >>
>> >> >> >>>
>> >> >>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >> >>> >> >> >        at
>> >> >> >>> >> >> >
>> >> >> >>> >> >>
>> >> >> >>> >>
>> >> >> >>>
>> >> >>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >> >>> >> >> > ionHandlerImpl.java:80)
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
>> >> >> curious if
>> >> >> >>> >> >> multiple
>> >> >> >>> >> >> > threads accessing it is a problem or if I should keep
>> access
>> >> to
>> >> >> it
>> >> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't
>> want
>> >> to
>> >> >> if I
>> >> >> >>> >> don't
>> >> >> >>> >> >> > need to.
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > Thanks!
>> >> >> >>> >> >> > Ryan
>> >> >> >>> >> >> >
>> >> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> >> >> >>> bruce.snyder@gmail.com
>> >> >> >>> >> >
>> >> >> >>> >> >> > wrote:
>> >> >> >>> >> >> >
>> >> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> >> >> >>> fragility2.0@gmail.com
>> >> >> >>> >> >
>> >> >> >>> >> >> >> wrote:
>> >> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.
>>  I
>> >> was
>> >> >> >>> kind
>> >> >> >>> >> of
>> >> >> >>> >> >> >> waiting
>> >> >> >>> >> >> >> > until it was released, but this problem is now
>> cropping
>> >> up
>> >> >> on a
>> >> >> >>> >> >> regular
>> >> >> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
>> >> >>  Hopefully
>> >> >> >>> >> this
>> >> >> >>> >> >> will
>> >> >> >>> >> >> >> > allow me to get this project done so I can then get
>> that
>> >> >> Joram
>> >> >> >>> >> write
>> >> >> >>> >> >> up
>> >> >> >>> >> >> >> done
>> >> >> >>> >> >> >> > since I should have ran across hopefully most of the
>> >> gotchas
>> >> >> for
>> >> >> >>> it
>> >> >> >>> >> at
>> >> >> >>> >> >> >> that
>> >> >> >>> >> >> >> > point.
>> >> >> >>> >> >> >>
>> >> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
>> >> >> stable.
>> >> >> >>> Maybe
>> >> >> >>> >> >> >> we can release it this weekend.
>> >> >> >>> >> >> >>
>> >> >> >>> >> >> >> Bruce
>> >> >> >>> >> >> >> --
>> >> >> >>> >> >> >> perl -e 'print
>> >> >> >>> >> >> >>
>> >> >> >>>
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> >>> >> >> >> );'
>> >> >> >>> >> >> >>
>> >> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >> >>> >> >> >>
>> >> >> >>> >> >> >> Blog: http://bruceblog.org/
>> >> >> >>> >> >> >>
>> >> >> >>> >> >> >
>> >> >> >>> >> >>
>> >> >> >>> >> >>
>> >> >> >>> >> >>
>> >> >> >>> >> >> --
>> >> >> >>> >> >> Cheers,
>> >> >> >>> >> >> Guillaume Nodet
>> >> >> >>> >> >> ------------------------
>> >> >> >>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >> >>> >> >>
>> >> >> >>> >> >
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >> --
>> >> >> >>> >> Cheers,
>> >> >> >>> >> Guillaume Nodet
>> >> >> >>> >> ------------------------
>> >> >> >>> >> Blog: http://gnodet.blogspot.com/
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> --
>> >> >> >>> Cheers,
>> >> >> >>> Guillaume Nodet
>> >> >> >>> ------------------------
>> >> >> >>> Blog: http://gnodet.blogspot.com/
>> >> >> >>>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Cheers,
>> >> >> Guillaume Nodet
>> >> >> ------------------------
>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Oh, so you mean that it's not the bean sending the message to itself, it's
that the jms consumer is sending back a reply, but not allocating a new
thread for it.  I am sending synchronously.. so maybe that's why?  If that's
the case.. then it sounds more like I'm simply not handling the reply
properly then?

On Mon, Jun 23, 2008 at 12:21 PM, Guillaume Nodet <gn...@gmail.com> wrote:

> it may be a little more complicated though.  If all the thread pool
> are exhausted, it could that the jms send back the done status to the
> pojo, and everything could be executed in the same thread.  Not sure
> though ... But this is the only explanation I have so far.
>
> On Mon, Jun 23, 2008 at 5:52 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Ohhhh ok, that was my initial thought, but then I decided it read as
> though
> > I could actually get it from my bean component without modifiying the
> > source.  No problem, now that I follow you.. I'll go ahead and try it.
> >
> > Out of curiosity though, if my bean is sending a message to itself for
> some
> > reason.. isn't that a sign of a bigger problem?  I'm trying to send a
> > message to my jms component....
> >
> > On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
> >> the component and install it instead of the old one.
> >> You can compile 3.2.x branch by checking it out from;
> >>
> http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
> >> Then run:
> >>   mvn install -Pstep1 -Dmaven.test.skip=true
> >>   mvn install -Pstep2 -Dmaven.test.skip=true
> >> You may be able to simply hack the component and recompile it without
> >> compiling the whole tree:
> >>   cd deployables/serviceengines/servicemix-bean
> >>   mvn install
> >>
> >> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > I feel dumb asking this, but I've been looking at the source code and
> I'm
> >> > not sure how to test out your suggestion?  How am I able to retrieve
> the
> >> > current request?  It looks like it's contained in a parent object that
> >> isn't
> >> > accessible to my bean?
> >> >
> >> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> >
> >> >> Could you please test something ?
> >> >> In the BeanEndpoint, save the old value for the currentRequest.get()
> >> >> in a local variable before setting it to the new value, and instead
> of
> >> >> setting it to null after processing, set it back to the old value.
>  It
> >> >> may fix the problem ...
> >> >>
> >> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
> >> >> wrote:
> >> >> > I'm wondering if for some reason your endpoint sends a request to
> >> itself
> >> >> ?
> >> >> > If this request is handled synchronously, it may happen that the
> >> >> > currentRequest is set to null while handling this request, but in
> the
> >> >> > same thread as the first request ?
> >> >> > Under high load, this behavior could happen if the thread pool is
> >> >> > exhausted, because under such conditions, the work will be executed
> in
> >> >> > the same thread...
> >> >> >
> >> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <
> fragility2.0@gmail.com>
> >> >> wrote:
> >> >> >> Oh right, because the thread obviously would be the one that would
> go
> >> >> >> through onMessageExchange method and then it would be set to null
> >> >> after...
> >> >> >> (bear with me, long weekend dealing with this problem and it's 4am
> on
> >> a
> >> >> >> workday.. haha).
> >> >> >>
> >> >> >> It's a rather large bean, composed of several classes (it does a
> lot
> >> of
> >> >> >> complicated stuff inside the bean)... but I could probably send
> you
> >> some
> >> >> >> pieces of it... do you mind if I email them privately to you?
> >> >> >>
> >> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <
> gnodet@gmail.com>
> >> >> wrote:
> >> >> >>
> >> >> >>> But the current request is only set to null *after* calling the
> >> pojo.
> >> >> >>>  Do you have the full code of you bean ?
> >> >> >>>
> >> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
> >> fragility2.0@gmail.com>
> >> >> >>> wrote:
> >> >> >>> > Sure, I backed out the changes in my editor.. basically my bean
> is
> >> >> >>> standard
> >> >> >>> > compared to the servicemix docs (for how to handle the exchange
> >> >> coming
> >> >> >>> in),
> >> >> >>> > then my bean takes the injected deliverychannel and hands it to
> a
> >> >> class
> >> >> >>> that
> >> >> >>> > creates a message to send out with results of some analysis
> >> >> performed..
> >> >> >>> here
> >> >> >>> > is the code to send out (it's using the DeliveryChannel
> injected
> >> into
> >> >> the
> >> >> >>> > bean by Servicemix):
> >> >> >>> >
> >> >> >>> > Marshaller notificationMarshaller =
> >> jaxbContext.createMarshaller();
> >> >> >>> >
> >> >>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >> >> >>> > Boolean.TRUE);
> >> >> >>> >      notificationMarshaller.marshal(notification, writer);
> >> >> >>> >      if (destinationQname == null) {
> >> >> >>> >        destinationQname = new QName(getDestinationNamespace(),
> >> >> >>> > getDestinationService());
> >> >> >>> >      }
> >> >> >>> >      MessageExchangeFactory exchangeFactory =
> >> >> >>> > deliveryChannel.createExchangeFactory();
> >> >> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >> >> >>> >      NormalizedMessage message = exchange.createMessage();
> >> >> >>> >      message.setContent(new StringSource(writer.toString()));
> >> >> >>> >      exchange.setInMessage(message);
> >> >> >>> >      exchange.setService(destinationQname);
> >> >> >>> >      deliveryChannel.send(exchange);
> >> >> >>> >
> >> >> >>> > The send is where the ConcurrentHashmap complains about an NPE
> ..
> >> I
> >> >> think
> >> >> >>> > because the BeanComponent sets the CurrentRequest to null
> around
> >> the
> >> >> time
> >> >> >>> my
> >> >> >>> > code is trying to send a request that must get clobbered?
>  There's
> >> no
> >> >> >>> other
> >> >> >>> > explanation for it.. it looks like the NPE is caused by
> >> >> >>> > currentRequest.get(), which is set back to null by the
> >> BeanComponent
> >> >> and
> >> >> >>> > since they are in the same thread.... they interfere.
> >> >> >>> >
> >> >> >>> > Ryan
> >> >> >>> >
> >> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
> >> gnodet@gmail.com>
> >> >> >>> wrote:
> >> >> >>> >
> >> >> >>> >> Is there any way you could paste the code of the bean you're
> >> using
> >> >> so
> >> >> >>> >> that i can have a quick look. You can skip any non-jbi related
> >> >> >>> >> processing...
> >> >> >>> >>
> >> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
> >> >> fragility2.0@gmail.com>
> >> >> >>> >> wrote:
> >> >> >>> >> > No, I'm just simply using the deliverychannel to send out,
> >> which
> >> >> is
> >> >> >>> >> > mentioned in the servicemix docs as something that you can
> do.
> >>  I
> >> >> >>> assume
> >> >> >>> >> > that means it's recommended :)  I did see that I can inject
> a
> >> >> >>> >> > ComponentContext and so I'm currently changing my outbound
> >> >> messages to
> >> >> >>> >> that
> >> >> >>> >> > to see if I can get around this problem.  I think I just
> can't
> >> use
> >> >> the
> >> >> >>> >> > DeliveryContext in the same Pojo (same thread).
> >> >> >>> >> >
> >> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
> >> >> gnodet@gmail.com>
> >> >> >>> >> wrote:
> >> >> >>> >> >
> >> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
> >> >> >>> >> >> currentRequest.get() is null.
> >> >> >>> >> >> Do you perform any threading operation in the pojo ? If
> yes,
> >> you
> >> >> >>> >> >> should try to remove that, as the component is already able
> to
> >> >> handle
> >> >> >>> >> >> concurrent requests.
> >> >> >>> >> >>
> >> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> >> >> fragility2.0@gmail.com
> >> >> >>> >
> >> >> >>> >> >> wrote:
> >> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is
> working
> >> >> pretty
> >> >> >>> >> bad
> >> >> >>> >> >> for
> >> >> >>> >> >> > me and has the same problem :(  It only seems to affect
> our
> >> >> >>> production
> >> >> >>> >> >> > server and in a few minutes after start up, I start
> getting
> >> the
> >> >> >>> >> >> > NullPointerException.. slowly all my services start doing
> it
> >> >> and
> >> >> >>> they
> >> >> >>> >> all
> >> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
> >> >> >>> servicemix-jms
> >> >> >>> >> >> > components are no longer routable.  I'm guessing this
> error
> >> >> causes
> >> >> >>> >> >> > Servicemix to shut them down and not deploy them anymore
> >> >> >>> (Servicemix
> >> >> >>> >> does
> >> >> >>> >> >> > the same thing if a service unit starts up, tries to make
> a
> >> >> Joram
> >> >> >>> >> >> connection
> >> >> >>> >> >> > to a server that isn't up, servicemix will shutdown that
> SU
> >> and
> >> >> >>> will
> >> >> >>> >> >> always
> >> >> >>> >> >> > shut it down immediately after it starts on any
> subsequent
> >> >> run).
> >> >> >>> >> >> >
> >> >> >>> >> >> > It seems like this problem must be related to a race
> >> condition.
> >> >> >>>  When
> >> >> >>> >> >> doing
> >> >> >>> >> >> > development testing, I never see this problem on my
> laptop
> >> even
> >> >> >>> under
> >> >> >>> >> >> high
> >> >> >>> >> >> > load.  One our fast test server, I see this error popup
> once
> >> on
> >> >> >>> >> startup
> >> >> >>> >> >> and
> >> >> >>> >> >> > then it doesn't seem to happen again.  On our even faster
> >> >> >>> production
> >> >> >>> >> >> server,
> >> >> >>> >> >> > the whole thing looses it's wheels and falls apart after
> a
> >> few
> >> >> >>> >> minutes.
> >> >> >>> >> >> >
> >> >> >>> >> >> > I'm supposed to be deploying this system in a few days
> and
> >> of
> >> >> >>> course
> >> >> >>> >> >> that's
> >> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
> >> >> possible
> >> >> >>> you
> >> >> >>> >> >> could
> >> >> >>> >> >> > give me some hints on what the problem is and I'll debug
> it
> >> >> this
> >> >> >>> >> weekend
> >> >> >>> >> >> to
> >> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
> >> >> really
> >> >> >>> need
> >> >> >>> >> to
> >> >> >>> >> >> > figure out way to get around this problem.  Other than
> that,
> >> >> 3.2.2
> >> >> >>> >> seems
> >> >> >>> >> >> to
> >> >> >>> >> >> > work perfectly fine.
> >> >> >>> >> >> >
> >> >> >>> >> >> > Here is the caused by error again in case it's any bit
> >> >> different
> >> >> >>> than
> >> >> >>> >> the
> >> >> >>> >> >> > 3.2.1 one was:
> >> >> >>> >> >> >
> >> >> >>> >> >> > Caused by: java.lang.NullPointerException
> >> >> >>> >> >> >        at
> >> >> >>> >> >> >
> >> >> >>>
> >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >> >>> >> >> >        at
> >> >> >>> >> >> >
> >> >> >>> >> >>
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >> >>> >> >> >        at
> >> >> >>> >> >> >
> >> >> >>> >> >>
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> >> >>> >> >> > ionHandlerImpl.java:80)
> >> >> >>> >> >> >
> >> >> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
> >> >> curious if
> >> >> >>> >> >> multiple
> >> >> >>> >> >> > threads accessing it is a problem or if I should keep
> access
> >> to
> >> >> it
> >> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't
> want
> >> to
> >> >> if I
> >> >> >>> >> don't
> >> >> >>> >> >> > need to.
> >> >> >>> >> >> >
> >> >> >>> >> >> > Thanks!
> >> >> >>> >> >> > Ryan
> >> >> >>> >> >> >
> >> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >> >> >>> bruce.snyder@gmail.com
> >> >> >>> >> >
> >> >> >>> >> >> > wrote:
> >> >> >>> >> >> >
> >> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >> >> >>> fragility2.0@gmail.com
> >> >> >>> >> >
> >> >> >>> >> >> >> wrote:
> >> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.
>  I
> >> was
> >> >> >>> kind
> >> >> >>> >> of
> >> >> >>> >> >> >> waiting
> >> >> >>> >> >> >> > until it was released, but this problem is now
> cropping
> >> up
> >> >> on a
> >> >> >>> >> >> regular
> >> >> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
> >> >>  Hopefully
> >> >> >>> >> this
> >> >> >>> >> >> will
> >> >> >>> >> >> >> > allow me to get this project done so I can then get
> that
> >> >> Joram
> >> >> >>> >> write
> >> >> >>> >> >> up
> >> >> >>> >> >> >> done
> >> >> >>> >> >> >> > since I should have ran across hopefully most of the
> >> gotchas
> >> >> for
> >> >> >>> it
> >> >> >>> >> at
> >> >> >>> >> >> >> that
> >> >> >>> >> >> >> > point.
> >> >> >>> >> >> >>
> >> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
> >> >> stable.
> >> >> >>> Maybe
> >> >> >>> >> >> >> we can release it this weekend.
> >> >> >>> >> >> >>
> >> >> >>> >> >> >> Bruce
> >> >> >>> >> >> >> --
> >> >> >>> >> >> >> perl -e 'print
> >> >> >>> >> >> >>
> >> >> >>>
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >> >>> >> >> >> );'
> >> >> >>> >> >> >>
> >> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
> >> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
> >> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
> >> >> >>> >> >> >>
> >> >> >>> >> >> >> Blog: http://bruceblog.org/
> >> >> >>> >> >> >>
> >> >> >>> >> >> >
> >> >> >>> >> >>
> >> >> >>> >> >>
> >> >> >>> >> >>
> >> >> >>> >> >> --
> >> >> >>> >> >> Cheers,
> >> >> >>> >> >> Guillaume Nodet
> >> >> >>> >> >> ------------------------
> >> >> >>> >> >> Blog: http://gnodet.blogspot.com/
> >> >> >>> >> >>
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >> --
> >> >> >>> >> Cheers,
> >> >> >>> >> Guillaume Nodet
> >> >> >>> >> ------------------------
> >> >> >>> >> Blog: http://gnodet.blogspot.com/
> >> >> >>> >>
> >> >> >>> >
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> --
> >> >> >>> Cheers,
> >> >> >>> Guillaume Nodet
> >> >> >>> ------------------------
> >> >> >>> Blog: http://gnodet.blogspot.com/
> >> >> >>>
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Cheers,
> >> >> Guillaume Nodet
> >> >> ------------------------
> >> >> Blog: http://gnodet.blogspot.com/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
it may be a little more complicated though.  If all the thread pool
are exhausted, it could that the jms send back the done status to the
pojo, and everything could be executed in the same thread.  Not sure
though ... But this is the only explanation I have so far.

On Mon, Jun 23, 2008 at 5:52 PM, Ryan Moquin <fr...@gmail.com> wrote:
> Ohhhh ok, that was my initial thought, but then I decided it read as though
> I could actually get it from my bean component without modifiying the
> source.  No problem, now that I follow you.. I'll go ahead and try it.
>
> Out of curiosity though, if my bean is sending a message to itself for some
> reason.. isn't that a sign of a bigger problem?  I'm trying to send a
> message to my jms component....
>
> On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
>> the component and install it instead of the old one.
>> You can compile 3.2.x branch by checking it out from;
>>   http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
>> Then run:
>>   mvn install -Pstep1 -Dmaven.test.skip=true
>>   mvn install -Pstep2 -Dmaven.test.skip=true
>> You may be able to simply hack the component and recompile it without
>> compiling the whole tree:
>>   cd deployables/serviceengines/servicemix-bean
>>   mvn install
>>
>> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > I feel dumb asking this, but I've been looking at the source code and I'm
>> > not sure how to test out your suggestion?  How am I able to retrieve the
>> > current request?  It looks like it's contained in a parent object that
>> isn't
>> > accessible to my bean?
>> >
>> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> Could you please test something ?
>> >> In the BeanEndpoint, save the old value for the currentRequest.get()
>> >> in a local variable before setting it to the new value, and instead of
>> >> setting it to null after processing, set it back to the old value.  It
>> >> may fix the problem ...
>> >>
>> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> > I'm wondering if for some reason your endpoint sends a request to
>> itself
>> >> ?
>> >> > If this request is handled synchronously, it may happen that the
>> >> > currentRequest is set to null while handling this request, but in the
>> >> > same thread as the first request ?
>> >> > Under high load, this behavior could happen if the thread pool is
>> >> > exhausted, because under such conditions, the work will be executed in
>> >> > the same thread...
>> >> >
>> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> >> Oh right, because the thread obviously would be the one that would go
>> >> >> through onMessageExchange method and then it would be set to null
>> >> after...
>> >> >> (bear with me, long weekend dealing with this problem and it's 4am on
>> a
>> >> >> workday.. haha).
>> >> >>
>> >> >> It's a rather large bean, composed of several classes (it does a lot
>> of
>> >> >> complicated stuff inside the bean)... but I could probably send you
>> some
>> >> >> pieces of it... do you mind if I email them privately to you?
>> >> >>
>> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >>
>> >> >>> But the current request is only set to null *after* calling the
>> pojo.
>> >> >>>  Do you have the full code of you bean ?
>> >> >>>
>> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
>> fragility2.0@gmail.com>
>> >> >>> wrote:
>> >> >>> > Sure, I backed out the changes in my editor.. basically my bean is
>> >> >>> standard
>> >> >>> > compared to the servicemix docs (for how to handle the exchange
>> >> coming
>> >> >>> in),
>> >> >>> > then my bean takes the injected deliverychannel and hands it to a
>> >> class
>> >> >>> that
>> >> >>> > creates a message to send out with results of some analysis
>> >> performed..
>> >> >>> here
>> >> >>> > is the code to send out (it's using the DeliveryChannel injected
>> into
>> >> the
>> >> >>> > bean by Servicemix):
>> >> >>> >
>> >> >>> > Marshaller notificationMarshaller =
>> jaxbContext.createMarshaller();
>> >> >>> >
>> >>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> >> >>> > Boolean.TRUE);
>> >> >>> >      notificationMarshaller.marshal(notification, writer);
>> >> >>> >      if (destinationQname == null) {
>> >> >>> >        destinationQname = new QName(getDestinationNamespace(),
>> >> >>> > getDestinationService());
>> >> >>> >      }
>> >> >>> >      MessageExchangeFactory exchangeFactory =
>> >> >>> > deliveryChannel.createExchangeFactory();
>> >> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >> >>> >      NormalizedMessage message = exchange.createMessage();
>> >> >>> >      message.setContent(new StringSource(writer.toString()));
>> >> >>> >      exchange.setInMessage(message);
>> >> >>> >      exchange.setService(destinationQname);
>> >> >>> >      deliveryChannel.send(exchange);
>> >> >>> >
>> >> >>> > The send is where the ConcurrentHashmap complains about an NPE ..
>> I
>> >> think
>> >> >>> > because the BeanComponent sets the CurrentRequest to null around
>> the
>> >> time
>> >> >>> my
>> >> >>> > code is trying to send a request that must get clobbered?  There's
>> no
>> >> >>> other
>> >> >>> > explanation for it.. it looks like the NPE is caused by
>> >> >>> > currentRequest.get(), which is set back to null by the
>> BeanComponent
>> >> and
>> >> >>> > since they are in the same thread.... they interfere.
>> >> >>> >
>> >> >>> > Ryan
>> >> >>> >
>> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
>> gnodet@gmail.com>
>> >> >>> wrote:
>> >> >>> >
>> >> >>> >> Is there any way you could paste the code of the bean you're
>> using
>> >> so
>> >> >>> >> that i can have a quick look. You can skip any non-jbi related
>> >> >>> >> processing...
>> >> >>> >>
>> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
>> >> fragility2.0@gmail.com>
>> >> >>> >> wrote:
>> >> >>> >> > No, I'm just simply using the deliverychannel to send out,
>> which
>> >> is
>> >> >>> >> > mentioned in the servicemix docs as something that you can do.
>>  I
>> >> >>> assume
>> >> >>> >> > that means it's recommended :)  I did see that I can inject a
>> >> >>> >> > ComponentContext and so I'm currently changing my outbound
>> >> messages to
>> >> >>> >> that
>> >> >>> >> > to see if I can get around this problem.  I think I just can't
>> use
>> >> the
>> >> >>> >> > DeliveryContext in the same Pojo (same thread).
>> >> >>> >> >
>> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
>> >> gnodet@gmail.com>
>> >> >>> >> wrote:
>> >> >>> >> >
>> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >>> >> >> currentRequest.get() is null.
>> >> >>> >> >> Do you perform any threading operation in the pojo ? If yes,
>> you
>> >> >>> >> >> should try to remove that, as the component is already able to
>> >> handle
>> >> >>> >> >> concurrent requests.
>> >> >>> >> >>
>> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
>> >> fragility2.0@gmail.com
>> >> >>> >
>> >> >>> >> >> wrote:
>> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
>> >> pretty
>> >> >>> >> bad
>> >> >>> >> >> for
>> >> >>> >> >> > me and has the same problem :(  It only seems to affect our
>> >> >>> production
>> >> >>> >> >> > server and in a few minutes after start up, I start getting
>> the
>> >> >>> >> >> > NullPointerException.. slowly all my services start doing it
>> >> and
>> >> >>> they
>> >> >>> >> all
>> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
>> >> >>> servicemix-jms
>> >> >>> >> >> > components are no longer routable.  I'm guessing this error
>> >> causes
>> >> >>> >> >> > Servicemix to shut them down and not deploy them anymore
>> >> >>> (Servicemix
>> >> >>> >> does
>> >> >>> >> >> > the same thing if a service unit starts up, tries to make a
>> >> Joram
>> >> >>> >> >> connection
>> >> >>> >> >> > to a server that isn't up, servicemix will shutdown that SU
>> and
>> >> >>> will
>> >> >>> >> >> always
>> >> >>> >> >> > shut it down immediately after it starts on any subsequent
>> >> run).
>> >> >>> >> >> >
>> >> >>> >> >> > It seems like this problem must be related to a race
>> condition.
>> >> >>>  When
>> >> >>> >> >> doing
>> >> >>> >> >> > development testing, I never see this problem on my laptop
>> even
>> >> >>> under
>> >> >>> >> >> high
>> >> >>> >> >> > load.  One our fast test server, I see this error popup once
>> on
>> >> >>> >> startup
>> >> >>> >> >> and
>> >> >>> >> >> > then it doesn't seem to happen again.  On our even faster
>> >> >>> production
>> >> >>> >> >> server,
>> >> >>> >> >> > the whole thing looses it's wheels and falls apart after a
>> few
>> >> >>> >> minutes.
>> >> >>> >> >> >
>> >> >>> >> >> > I'm supposed to be deploying this system in a few days and
>> of
>> >> >>> course
>> >> >>> >> >> that's
>> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
>> >> possible
>> >> >>> you
>> >> >>> >> >> could
>> >> >>> >> >> > give me some hints on what the problem is and I'll debug it
>> >> this
>> >> >>> >> weekend
>> >> >>> >> >> to
>> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
>> >> really
>> >> >>> need
>> >> >>> >> to
>> >> >>> >> >> > figure out way to get around this problem.  Other than that,
>> >> 3.2.2
>> >> >>> >> seems
>> >> >>> >> >> to
>> >> >>> >> >> > work perfectly fine.
>> >> >>> >> >> >
>> >> >>> >> >> > Here is the caused by error again in case it's any bit
>> >> different
>> >> >>> than
>> >> >>> >> the
>> >> >>> >> >> > 3.2.1 one was:
>> >> >>> >> >> >
>> >> >>> >> >> > Caused by: java.lang.NullPointerException
>> >> >>> >> >> >        at
>> >> >>> >> >> >
>> >> >>>
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >>> >> >> >        at
>> >> >>> >> >> >
>> >> >>> >> >>
>> >> >>> >>
>> >> >>>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >>> >> >> >        at
>> >> >>> >> >> >
>> >> >>> >> >>
>> >> >>> >>
>> >> >>>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >>> >> >> > ionHandlerImpl.java:80)
>> >> >>> >> >> >
>> >> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
>> >> curious if
>> >> >>> >> >> multiple
>> >> >>> >> >> > threads accessing it is a problem or if I should keep access
>> to
>> >> it
>> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't want
>> to
>> >> if I
>> >> >>> >> don't
>> >> >>> >> >> > need to.
>> >> >>> >> >> >
>> >> >>> >> >> > Thanks!
>> >> >>> >> >> > Ryan
>> >> >>> >> >> >
>> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> >> >>> bruce.snyder@gmail.com
>> >> >>> >> >
>> >> >>> >> >> > wrote:
>> >> >>> >> >> >
>> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> >> >>> fragility2.0@gmail.com
>> >> >>> >> >
>> >> >>> >> >> >> wrote:
>> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I
>> was
>> >> >>> kind
>> >> >>> >> of
>> >> >>> >> >> >> waiting
>> >> >>> >> >> >> > until it was released, but this problem is now cropping
>> up
>> >> on a
>> >> >>> >> >> regular
>> >> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
>> >>  Hopefully
>> >> >>> >> this
>> >> >>> >> >> will
>> >> >>> >> >> >> > allow me to get this project done so I can then get that
>> >> Joram
>> >> >>> >> write
>> >> >>> >> >> up
>> >> >>> >> >> >> done
>> >> >>> >> >> >> > since I should have ran across hopefully most of the
>> gotchas
>> >> for
>> >> >>> it
>> >> >>> >> at
>> >> >>> >> >> >> that
>> >> >>> >> >> >> > point.
>> >> >>> >> >> >>
>> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
>> >> stable.
>> >> >>> Maybe
>> >> >>> >> >> >> we can release it this weekend.
>> >> >>> >> >> >>
>> >> >>> >> >> >> Bruce
>> >> >>> >> >> >> --
>> >> >>> >> >> >> perl -e 'print
>> >> >>> >> >> >>
>> >> >>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >>> >> >> >> );'
>> >> >>> >> >> >>
>> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >>> >> >> >>
>> >> >>> >> >> >> Blog: http://bruceblog.org/
>> >> >>> >> >> >>
>> >> >>> >> >> >
>> >> >>> >> >>
>> >> >>> >> >>
>> >> >>> >> >>
>> >> >>> >> >> --
>> >> >>> >> >> Cheers,
>> >> >>> >> >> Guillaume Nodet
>> >> >>> >> >> ------------------------
>> >> >>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>> >> >>
>> >> >>> >> >
>> >> >>> >>
>> >> >>> >>
>> >> >>> >>
>> >> >>> >> --
>> >> >>> >> Cheers,
>> >> >>> >> Guillaume Nodet
>> >> >>> >> ------------------------
>> >> >>> >> Blog: http://gnodet.blogspot.com/
>> >> >>> >>
>> >> >>> >
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Cheers,
>> >> >>> Guillaume Nodet
>> >> >>> ------------------------
>> >> >>> Blog: http://gnodet.blogspot.com/
>> >> >>>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Ohhhh ok, that was my initial thought, but then I decided it read as though
I could actually get it from my bean component without modifiying the
source.  No problem, now that I follow you.. I'll go ahead and try it.

Out of curiosity though, if my bean is sending a message to itself for some
reason.. isn't that a sign of a bigger problem?  I'm trying to send a
message to my jms component....

On Mon, Jun 23, 2008 at 10:59 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> Sorry, I was suggesting that you modify the BeanEndpoint, recompile
> the component and install it instead of the old one.
> You can compile 3.2.x branch by checking it out from;
>   http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
> Then run:
>   mvn install -Pstep1 -Dmaven.test.skip=true
>   mvn install -Pstep2 -Dmaven.test.skip=true
> You may be able to simply hack the component and recompile it without
> compiling the whole tree:
>   cd deployables/serviceengines/servicemix-bean
>   mvn install
>
> On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > I feel dumb asking this, but I've been looking at the source code and I'm
> > not sure how to test out your suggestion?  How am I able to retrieve the
> > current request?  It looks like it's contained in a parent object that
> isn't
> > accessible to my bean?
> >
> > On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> Could you please test something ?
> >> In the BeanEndpoint, save the old value for the currentRequest.get()
> >> in a local variable before setting it to the new value, and instead of
> >> setting it to null after processing, set it back to the old value.  It
> >> may fix the problem ...
> >>
> >> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> > I'm wondering if for some reason your endpoint sends a request to
> itself
> >> ?
> >> > If this request is handled synchronously, it may happen that the
> >> > currentRequest is set to null while handling this request, but in the
> >> > same thread as the first request ?
> >> > Under high load, this behavior could happen if the thread pool is
> >> > exhausted, because under such conditions, the work will be executed in
> >> > the same thread...
> >> >
> >> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> >> Oh right, because the thread obviously would be the one that would go
> >> >> through onMessageExchange method and then it would be set to null
> >> after...
> >> >> (bear with me, long weekend dealing with this problem and it's 4am on
> a
> >> >> workday.. haha).
> >> >>
> >> >> It's a rather large bean, composed of several classes (it does a lot
> of
> >> >> complicated stuff inside the bean)... but I could probably send you
> some
> >> >> pieces of it... do you mind if I email them privately to you?
> >> >>
> >> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> >>
> >> >>> But the current request is only set to null *after* calling the
> pojo.
> >> >>>  Do you have the full code of you bean ?
> >> >>>
> >> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <
> fragility2.0@gmail.com>
> >> >>> wrote:
> >> >>> > Sure, I backed out the changes in my editor.. basically my bean is
> >> >>> standard
> >> >>> > compared to the servicemix docs (for how to handle the exchange
> >> coming
> >> >>> in),
> >> >>> > then my bean takes the injected deliverychannel and hands it to a
> >> class
> >> >>> that
> >> >>> > creates a message to send out with results of some analysis
> >> performed..
> >> >>> here
> >> >>> > is the code to send out (it's using the DeliveryChannel injected
> into
> >> the
> >> >>> > bean by Servicemix):
> >> >>> >
> >> >>> > Marshaller notificationMarshaller =
> jaxbContext.createMarshaller();
> >> >>> >
> >>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >> >>> > Boolean.TRUE);
> >> >>> >      notificationMarshaller.marshal(notification, writer);
> >> >>> >      if (destinationQname == null) {
> >> >>> >        destinationQname = new QName(getDestinationNamespace(),
> >> >>> > getDestinationService());
> >> >>> >      }
> >> >>> >      MessageExchangeFactory exchangeFactory =
> >> >>> > deliveryChannel.createExchangeFactory();
> >> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >> >>> >      NormalizedMessage message = exchange.createMessage();
> >> >>> >      message.setContent(new StringSource(writer.toString()));
> >> >>> >      exchange.setInMessage(message);
> >> >>> >      exchange.setService(destinationQname);
> >> >>> >      deliveryChannel.send(exchange);
> >> >>> >
> >> >>> > The send is where the ConcurrentHashmap complains about an NPE ..
> I
> >> think
> >> >>> > because the BeanComponent sets the CurrentRequest to null around
> the
> >> time
> >> >>> my
> >> >>> > code is trying to send a request that must get clobbered?  There's
> no
> >> >>> other
> >> >>> > explanation for it.. it looks like the NPE is caused by
> >> >>> > currentRequest.get(), which is set back to null by the
> BeanComponent
> >> and
> >> >>> > since they are in the same thread.... they interfere.
> >> >>> >
> >> >>> > Ryan
> >> >>> >
> >> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <
> gnodet@gmail.com>
> >> >>> wrote:
> >> >>> >
> >> >>> >> Is there any way you could paste the code of the bean you're
> using
> >> so
> >> >>> >> that i can have a quick look. You can skip any non-jbi related
> >> >>> >> processing...
> >> >>> >>
> >> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
> >> fragility2.0@gmail.com>
> >> >>> >> wrote:
> >> >>> >> > No, I'm just simply using the deliverychannel to send out,
> which
> >> is
> >> >>> >> > mentioned in the servicemix docs as something that you can do.
>  I
> >> >>> assume
> >> >>> >> > that means it's recommended :)  I did see that I can inject a
> >> >>> >> > ComponentContext and so I'm currently changing my outbound
> >> messages to
> >> >>> >> that
> >> >>> >> > to see if I can get around this problem.  I think I just can't
> use
> >> the
> >> >>> >> > DeliveryContext in the same Pojo (same thread).
> >> >>> >> >
> >> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
> >> gnodet@gmail.com>
> >> >>> >> wrote:
> >> >>> >> >
> >> >>> >> >> The NPE in the PojoChannel.send() method means that the
> >> >>> >> >> currentRequest.get() is null.
> >> >>> >> >> Do you perform any threading operation in the pojo ? If yes,
> you
> >> >>> >> >> should try to remove that, as the component is already able to
> >> handle
> >> >>> >> >> concurrent requests.
> >> >>> >> >>
> >> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> >> fragility2.0@gmail.com
> >> >>> >
> >> >>> >> >> wrote:
> >> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
> >> pretty
> >> >>> >> bad
> >> >>> >> >> for
> >> >>> >> >> > me and has the same problem :(  It only seems to affect our
> >> >>> production
> >> >>> >> >> > server and in a few minutes after start up, I start getting
> the
> >> >>> >> >> > NullPointerException.. slowly all my services start doing it
> >> and
> >> >>> they
> >> >>> >> all
> >> >>> >> >> > stop working.  If I stop and restart servicemix, then
> >> >>> servicemix-jms
> >> >>> >> >> > components are no longer routable.  I'm guessing this error
> >> causes
> >> >>> >> >> > Servicemix to shut them down and not deploy them anymore
> >> >>> (Servicemix
> >> >>> >> does
> >> >>> >> >> > the same thing if a service unit starts up, tries to make a
> >> Joram
> >> >>> >> >> connection
> >> >>> >> >> > to a server that isn't up, servicemix will shutdown that SU
> and
> >> >>> will
> >> >>> >> >> always
> >> >>> >> >> > shut it down immediately after it starts on any subsequent
> >> run).
> >> >>> >> >> >
> >> >>> >> >> > It seems like this problem must be related to a race
> condition.
> >> >>>  When
> >> >>> >> >> doing
> >> >>> >> >> > development testing, I never see this problem on my laptop
> even
> >> >>> under
> >> >>> >> >> high
> >> >>> >> >> > load.  One our fast test server, I see this error popup once
> on
> >> >>> >> startup
> >> >>> >> >> and
> >> >>> >> >> > then it doesn't seem to happen again.  On our even faster
> >> >>> production
> >> >>> >> >> server,
> >> >>> >> >> > the whole thing looses it's wheels and falls apart after a
> few
> >> >>> >> minutes.
> >> >>> >> >> >
> >> >>> >> >> > I'm supposed to be deploying this system in a few days and
> of
> >> >>> course
> >> >>> >> >> that's
> >> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
> >> possible
> >> >>> you
> >> >>> >> >> could
> >> >>> >> >> > give me some hints on what the problem is and I'll debug it
> >> this
> >> >>> >> weekend
> >> >>> >> >> to
> >> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
> >> really
> >> >>> need
> >> >>> >> to
> >> >>> >> >> > figure out way to get around this problem.  Other than that,
> >> 3.2.2
> >> >>> >> seems
> >> >>> >> >> to
> >> >>> >> >> > work perfectly fine.
> >> >>> >> >> >
> >> >>> >> >> > Here is the caused by error again in case it's any bit
> >> different
> >> >>> than
> >> >>> >> the
> >> >>> >> >> > 3.2.1 one was:
> >> >>> >> >> >
> >> >>> >> >> > Caused by: java.lang.NullPointerException
> >> >>> >> >> >        at
> >> >>> >> >> >
> >> >>>
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >>> >> >> >        at
> >> >>> >> >> >
> >> >>> >> >>
> >> >>> >>
> >> >>>
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >>> >> >> >        at
> >> >>> >> >> >
> >> >>> >> >>
> >> >>> >>
> >> >>>
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> >>> >> >> > ionHandlerImpl.java:80)
> >> >>> >> >> >
> >> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
> >> curious if
> >> >>> >> >> multiple
> >> >>> >> >> > threads accessing it is a problem or if I should keep access
> to
> >> it
> >> >>> >> >> > synchronized?  I'm currently synchronizing, but don't want
> to
> >> if I
> >> >>> >> don't
> >> >>> >> >> > need to.
> >> >>> >> >> >
> >> >>> >> >> > Thanks!
> >> >>> >> >> > Ryan
> >> >>> >> >> >
> >> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >> >>> bruce.snyder@gmail.com
> >> >>> >> >
> >> >>> >> >> > wrote:
> >> >>> >> >> >
> >> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >> >>> fragility2.0@gmail.com
> >> >>> >> >
> >> >>> >> >> >> wrote:
> >> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I
> was
> >> >>> kind
> >> >>> >> of
> >> >>> >> >> >> waiting
> >> >>> >> >> >> > until it was released, but this problem is now cropping
> up
> >> on a
> >> >>> >> >> regular
> >> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
> >>  Hopefully
> >> >>> >> this
> >> >>> >> >> will
> >> >>> >> >> >> > allow me to get this project done so I can then get that
> >> Joram
> >> >>> >> write
> >> >>> >> >> up
> >> >>> >> >> >> done
> >> >>> >> >> >> > since I should have ran across hopefully most of the
> gotchas
> >> for
> >> >>> it
> >> >>> >> at
> >> >>> >> >> >> that
> >> >>> >> >> >> > point.
> >> >>> >> >> >>
> >> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
> >> stable.
> >> >>> Maybe
> >> >>> >> >> >> we can release it this weekend.
> >> >>> >> >> >>
> >> >>> >> >> >> Bruce
> >> >>> >> >> >> --
> >> >>> >> >> >> perl -e 'print
> >> >>> >> >> >>
> >> >>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >>> >> >> >> );'
> >> >>> >> >> >>
> >> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
> >> >>> >> >> >> Apache Camel - http://activemq.org/camel/
> >> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
> >> >>> >> >> >>
> >> >>> >> >> >> Blog: http://bruceblog.org/
> >> >>> >> >> >>
> >> >>> >> >> >
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >> --
> >> >>> >> >> Cheers,
> >> >>> >> >> Guillaume Nodet
> >> >>> >> >> ------------------------
> >> >>> >> >> Blog: http://gnodet.blogspot.com/
> >> >>> >> >>
> >> >>> >> >
> >> >>> >>
> >> >>> >>
> >> >>> >>
> >> >>> >> --
> >> >>> >> Cheers,
> >> >>> >> Guillaume Nodet
> >> >>> >> ------------------------
> >> >>> >> Blog: http://gnodet.blogspot.com/
> >> >>> >>
> >> >>> >
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Cheers,
> >> >>> Guillaume Nodet
> >> >>> ------------------------
> >> >>> Blog: http://gnodet.blogspot.com/
> >> >>>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
Sorry, I was suggesting that you modify the BeanEndpoint, recompile
the component and install it instead of the old one.
You can compile 3.2.x branch by checking it out from;
   http://svn.apache.org/repos/asf/servicemix/smx3/branches/servicemix-3.2
Then run:
   mvn install -Pstep1 -Dmaven.test.skip=true
   mvn install -Pstep2 -Dmaven.test.skip=true
You may be able to simply hack the component and recompile it without
compiling the whole tree:
   cd deployables/serviceengines/servicemix-bean
   mvn install

On Mon, Jun 23, 2008 at 4:52 PM, Ryan Moquin <fr...@gmail.com> wrote:
> I feel dumb asking this, but I've been looking at the source code and I'm
> not sure how to test out your suggestion?  How am I able to retrieve the
> current request?  It looks like it's contained in a parent object that isn't
> accessible to my bean?
>
> On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> Could you please test something ?
>> In the BeanEndpoint, save the old value for the currentRequest.get()
>> in a local variable before setting it to the new value, and instead of
>> setting it to null after processing, set it back to the old value.  It
>> may fix the problem ...
>>
>> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> > I'm wondering if for some reason your endpoint sends a request to itself
>> ?
>> > If this request is handled synchronously, it may happen that the
>> > currentRequest is set to null while handling this request, but in the
>> > same thread as the first request ?
>> > Under high load, this behavior could happen if the thread pool is
>> > exhausted, because under such conditions, the work will be executed in
>> > the same thread...
>> >
>> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> >> Oh right, because the thread obviously would be the one that would go
>> >> through onMessageExchange method and then it would be set to null
>> after...
>> >> (bear with me, long weekend dealing with this problem and it's 4am on a
>> >> workday.. haha).
>> >>
>> >> It's a rather large bean, composed of several classes (it does a lot of
>> >> complicated stuff inside the bean)... but I could probably send you some
>> >> pieces of it... do you mind if I email them privately to you?
>> >>
>> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >>
>> >>> But the current request is only set to null *after* calling the pojo.
>> >>>  Do you have the full code of you bean ?
>> >>>
>> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
>> >>> wrote:
>> >>> > Sure, I backed out the changes in my editor.. basically my bean is
>> >>> standard
>> >>> > compared to the servicemix docs (for how to handle the exchange
>> coming
>> >>> in),
>> >>> > then my bean takes the injected deliverychannel and hands it to a
>> class
>> >>> that
>> >>> > creates a message to send out with results of some analysis
>> performed..
>> >>> here
>> >>> > is the code to send out (it's using the DeliveryChannel injected into
>> the
>> >>> > bean by Servicemix):
>> >>> >
>> >>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>> >>> >
>>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> >>> > Boolean.TRUE);
>> >>> >      notificationMarshaller.marshal(notification, writer);
>> >>> >      if (destinationQname == null) {
>> >>> >        destinationQname = new QName(getDestinationNamespace(),
>> >>> > getDestinationService());
>> >>> >      }
>> >>> >      MessageExchangeFactory exchangeFactory =
>> >>> > deliveryChannel.createExchangeFactory();
>> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >>> >      NormalizedMessage message = exchange.createMessage();
>> >>> >      message.setContent(new StringSource(writer.toString()));
>> >>> >      exchange.setInMessage(message);
>> >>> >      exchange.setService(destinationQname);
>> >>> >      deliveryChannel.send(exchange);
>> >>> >
>> >>> > The send is where the ConcurrentHashmap complains about an NPE .. I
>> think
>> >>> > because the BeanComponent sets the CurrentRequest to null around the
>> time
>> >>> my
>> >>> > code is trying to send a request that must get clobbered?  There's no
>> >>> other
>> >>> > explanation for it.. it looks like the NPE is caused by
>> >>> > currentRequest.get(), which is set back to null by the BeanComponent
>> and
>> >>> > since they are in the same thread.... they interfere.
>> >>> >
>> >>> > Ryan
>> >>> >
>> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
>> >>> wrote:
>> >>> >
>> >>> >> Is there any way you could paste the code of the bean you're using
>> so
>> >>> >> that i can have a quick look. You can skip any non-jbi related
>> >>> >> processing...
>> >>> >>
>> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
>> fragility2.0@gmail.com>
>> >>> >> wrote:
>> >>> >> > No, I'm just simply using the deliverychannel to send out, which
>> is
>> >>> >> > mentioned in the servicemix docs as something that you can do.  I
>> >>> assume
>> >>> >> > that means it's recommended :)  I did see that I can inject a
>> >>> >> > ComponentContext and so I'm currently changing my outbound
>> messages to
>> >>> >> that
>> >>> >> > to see if I can get around this problem.  I think I just can't use
>> the
>> >>> >> > DeliveryContext in the same Pojo (same thread).
>> >>> >> >
>> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
>> gnodet@gmail.com>
>> >>> >> wrote:
>> >>> >> >
>> >>> >> >> The NPE in the PojoChannel.send() method means that the
>> >>> >> >> currentRequest.get() is null.
>> >>> >> >> Do you perform any threading operation in the pojo ? If yes, you
>> >>> >> >> should try to remove that, as the component is already able to
>> handle
>> >>> >> >> concurrent requests.
>> >>> >> >>
>> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
>> fragility2.0@gmail.com
>> >>> >
>> >>> >> >> wrote:
>> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
>> pretty
>> >>> >> bad
>> >>> >> >> for
>> >>> >> >> > me and has the same problem :(  It only seems to affect our
>> >>> production
>> >>> >> >> > server and in a few minutes after start up, I start getting the
>> >>> >> >> > NullPointerException.. slowly all my services start doing it
>> and
>> >>> they
>> >>> >> all
>> >>> >> >> > stop working.  If I stop and restart servicemix, then
>> >>> servicemix-jms
>> >>> >> >> > components are no longer routable.  I'm guessing this error
>> causes
>> >>> >> >> > Servicemix to shut them down and not deploy them anymore
>> >>> (Servicemix
>> >>> >> does
>> >>> >> >> > the same thing if a service unit starts up, tries to make a
>> Joram
>> >>> >> >> connection
>> >>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
>> >>> will
>> >>> >> >> always
>> >>> >> >> > shut it down immediately after it starts on any subsequent
>> run).
>> >>> >> >> >
>> >>> >> >> > It seems like this problem must be related to a race condition.
>> >>>  When
>> >>> >> >> doing
>> >>> >> >> > development testing, I never see this problem on my laptop even
>> >>> under
>> >>> >> >> high
>> >>> >> >> > load.  One our fast test server, I see this error popup once on
>> >>> >> startup
>> >>> >> >> and
>> >>> >> >> > then it doesn't seem to happen again.  On our even faster
>> >>> production
>> >>> >> >> server,
>> >>> >> >> > the whole thing looses it's wheels and falls apart after a few
>> >>> >> minutes.
>> >>> >> >> >
>> >>> >> >> > I'm supposed to be deploying this system in a few days and of
>> >>> course
>> >>> >> >> that's
>> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
>> possible
>> >>> you
>> >>> >> >> could
>> >>> >> >> > give me some hints on what the problem is and I'll debug it
>> this
>> >>> >> weekend
>> >>> >> >> to
>> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
>> really
>> >>> need
>> >>> >> to
>> >>> >> >> > figure out way to get around this problem.  Other than that,
>> 3.2.2
>> >>> >> seems
>> >>> >> >> to
>> >>> >> >> > work perfectly fine.
>> >>> >> >> >
>> >>> >> >> > Here is the caused by error again in case it's any bit
>> different
>> >>> than
>> >>> >> the
>> >>> >> >> > 3.2.1 one was:
>> >>> >> >> >
>> >>> >> >> > Caused by: java.lang.NullPointerException
>> >>> >> >> >        at
>> >>> >> >> >
>> >>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >>> >> >> >        at
>> >>> >> >> >
>> >>> >> >>
>> >>> >>
>> >>>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >>> >> >> >        at
>> >>> >> >> >
>> >>> >> >>
>> >>> >>
>> >>>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >>> >> >> > ionHandlerImpl.java:80)
>> >>> >> >> >
>> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
>> curious if
>> >>> >> >> multiple
>> >>> >> >> > threads accessing it is a problem or if I should keep access to
>> it
>> >>> >> >> > synchronized?  I'm currently synchronizing, but don't want to
>> if I
>> >>> >> don't
>> >>> >> >> > need to.
>> >>> >> >> >
>> >>> >> >> > Thanks!
>> >>> >> >> > Ryan
>> >>> >> >> >
>> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> >>> bruce.snyder@gmail.com
>> >>> >> >
>> >>> >> >> > wrote:
>> >>> >> >> >
>> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> >>> fragility2.0@gmail.com
>> >>> >> >
>> >>> >> >> >> wrote:
>> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
>> >>> kind
>> >>> >> of
>> >>> >> >> >> waiting
>> >>> >> >> >> > until it was released, but this problem is now cropping up
>> on a
>> >>> >> >> regular
>> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
>>  Hopefully
>> >>> >> this
>> >>> >> >> will
>> >>> >> >> >> > allow me to get this project done so I can then get that
>> Joram
>> >>> >> write
>> >>> >> >> up
>> >>> >> >> >> done
>> >>> >> >> >> > since I should have ran across hopefully most of the gotchas
>> for
>> >>> it
>> >>> >> at
>> >>> >> >> >> that
>> >>> >> >> >> > point.
>> >>> >> >> >>
>> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
>> stable.
>> >>> Maybe
>> >>> >> >> >> we can release it this weekend.
>> >>> >> >> >>
>> >>> >> >> >> Bruce
>> >>> >> >> >> --
>> >>> >> >> >> perl -e 'print
>> >>> >> >> >>
>> >>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >>> >> >> >> );'
>> >>> >> >> >>
>> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >>> >> >> >>
>> >>> >> >> >> Blog: http://bruceblog.org/
>> >>> >> >> >>
>> >>> >> >> >
>> >>> >> >>
>> >>> >> >>
>> >>> >> >>
>> >>> >> >> --
>> >>> >> >> Cheers,
>> >>> >> >> Guillaume Nodet
>> >>> >> >> ------------------------
>> >>> >> >> Blog: http://gnodet.blogspot.com/
>> >>> >> >>
>> >>> >> >
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> --
>> >>> >> Cheers,
>> >>> >> Guillaume Nodet
>> >>> >> ------------------------
>> >>> >> Blog: http://gnodet.blogspot.com/
>> >>> >>
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Cheers,
>> >>> Guillaume Nodet
>> >>> ------------------------
>> >>> Blog: http://gnodet.blogspot.com/
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
I feel dumb asking this, but I've been looking at the source code and I'm
not sure how to test out your suggestion?  How am I able to retrieve the
current request?  It looks like it's contained in a parent object that isn't
accessible to my bean?

On Mon, Jun 23, 2008 at 6:01 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> Could you please test something ?
> In the BeanEndpoint, save the old value for the currentRequest.get()
> in a local variable before setting it to the new value, and instead of
> setting it to null after processing, set it back to the old value.  It
> may fix the problem ...
>
> On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> > I'm wondering if for some reason your endpoint sends a request to itself
> ?
> > If this request is handled synchronously, it may happen that the
> > currentRequest is set to null while handling this request, but in the
> > same thread as the first request ?
> > Under high load, this behavior could happen if the thread pool is
> > exhausted, because under such conditions, the work will be executed in
> > the same thread...
> >
> > On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> >> Oh right, because the thread obviously would be the one that would go
> >> through onMessageExchange method and then it would be set to null
> after...
> >> (bear with me, long weekend dealing with this problem and it's 4am on a
> >> workday.. haha).
> >>
> >> It's a rather large bean, composed of several classes (it does a lot of
> >> complicated stuff inside the bean)... but I could probably send you some
> >> pieces of it... do you mind if I email them privately to you?
> >>
> >> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >>
> >>> But the current request is only set to null *after* calling the pojo.
> >>>  Do you have the full code of you bean ?
> >>>
> >>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
> >>> wrote:
> >>> > Sure, I backed out the changes in my editor.. basically my bean is
> >>> standard
> >>> > compared to the servicemix docs (for how to handle the exchange
> coming
> >>> in),
> >>> > then my bean takes the injected deliverychannel and hands it to a
> class
> >>> that
> >>> > creates a message to send out with results of some analysis
> performed..
> >>> here
> >>> > is the code to send out (it's using the DeliveryChannel injected into
> the
> >>> > bean by Servicemix):
> >>> >
> >>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
> >>> >
>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >>> > Boolean.TRUE);
> >>> >      notificationMarshaller.marshal(notification, writer);
> >>> >      if (destinationQname == null) {
> >>> >        destinationQname = new QName(getDestinationNamespace(),
> >>> > getDestinationService());
> >>> >      }
> >>> >      MessageExchangeFactory exchangeFactory =
> >>> > deliveryChannel.createExchangeFactory();
> >>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >>> >      NormalizedMessage message = exchange.createMessage();
> >>> >      message.setContent(new StringSource(writer.toString()));
> >>> >      exchange.setInMessage(message);
> >>> >      exchange.setService(destinationQname);
> >>> >      deliveryChannel.send(exchange);
> >>> >
> >>> > The send is where the ConcurrentHashmap complains about an NPE .. I
> think
> >>> > because the BeanComponent sets the CurrentRequest to null around the
> time
> >>> my
> >>> > code is trying to send a request that must get clobbered?  There's no
> >>> other
> >>> > explanation for it.. it looks like the NPE is caused by
> >>> > currentRequest.get(), which is set back to null by the BeanComponent
> and
> >>> > since they are in the same thread.... they interfere.
> >>> >
> >>> > Ryan
> >>> >
> >>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
> >>> wrote:
> >>> >
> >>> >> Is there any way you could paste the code of the bean you're using
> so
> >>> >> that i can have a quick look. You can skip any non-jbi related
> >>> >> processing...
> >>> >>
> >>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
> fragility2.0@gmail.com>
> >>> >> wrote:
> >>> >> > No, I'm just simply using the deliverychannel to send out, which
> is
> >>> >> > mentioned in the servicemix docs as something that you can do.  I
> >>> assume
> >>> >> > that means it's recommended :)  I did see that I can inject a
> >>> >> > ComponentContext and so I'm currently changing my outbound
> messages to
> >>> >> that
> >>> >> > to see if I can get around this problem.  I think I just can't use
> the
> >>> >> > DeliveryContext in the same Pojo (same thread).
> >>> >> >
> >>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
> gnodet@gmail.com>
> >>> >> wrote:
> >>> >> >
> >>> >> >> The NPE in the PojoChannel.send() method means that the
> >>> >> >> currentRequest.get() is null.
> >>> >> >> Do you perform any threading operation in the pojo ? If yes, you
> >>> >> >> should try to remove that, as the component is already able to
> handle
> >>> >> >> concurrent requests.
> >>> >> >>
> >>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> fragility2.0@gmail.com
> >>> >
> >>> >> >> wrote:
> >>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
> pretty
> >>> >> bad
> >>> >> >> for
> >>> >> >> > me and has the same problem :(  It only seems to affect our
> >>> production
> >>> >> >> > server and in a few minutes after start up, I start getting the
> >>> >> >> > NullPointerException.. slowly all my services start doing it
> and
> >>> they
> >>> >> all
> >>> >> >> > stop working.  If I stop and restart servicemix, then
> >>> servicemix-jms
> >>> >> >> > components are no longer routable.  I'm guessing this error
> causes
> >>> >> >> > Servicemix to shut them down and not deploy them anymore
> >>> (Servicemix
> >>> >> does
> >>> >> >> > the same thing if a service unit starts up, tries to make a
> Joram
> >>> >> >> connection
> >>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
> >>> will
> >>> >> >> always
> >>> >> >> > shut it down immediately after it starts on any subsequent
> run).
> >>> >> >> >
> >>> >> >> > It seems like this problem must be related to a race condition.
> >>>  When
> >>> >> >> doing
> >>> >> >> > development testing, I never see this problem on my laptop even
> >>> under
> >>> >> >> high
> >>> >> >> > load.  One our fast test server, I see this error popup once on
> >>> >> startup
> >>> >> >> and
> >>> >> >> > then it doesn't seem to happen again.  On our even faster
> >>> production
> >>> >> >> server,
> >>> >> >> > the whole thing looses it's wheels and falls apart after a few
> >>> >> minutes.
> >>> >> >> >
> >>> >> >> > I'm supposed to be deploying this system in a few days and of
> >>> course
> >>> >> >> that's
> >>> >> >> > the only spot where I can't temporarily limp by.  Is it
> possible
> >>> you
> >>> >> >> could
> >>> >> >> > give me some hints on what the problem is and I'll debug it
> this
> >>> >> weekend
> >>> >> >> to
> >>> >> >> > see if I can fix it, or at least patch it temporarily?  I
> really
> >>> need
> >>> >> to
> >>> >> >> > figure out way to get around this problem.  Other than that,
> 3.2.2
> >>> >> seems
> >>> >> >> to
> >>> >> >> > work perfectly fine.
> >>> >> >> >
> >>> >> >> > Here is the caused by error again in case it's any bit
> different
> >>> than
> >>> >> the
> >>> >> >> > 3.2.1 one was:
> >>> >> >> >
> >>> >> >> > Caused by: java.lang.NullPointerException
> >>> >> >> >        at
> >>> >> >> >
> >>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >>> >> >> >        at
> >>> >> >> >
> >>> >> >>
> >>> >>
> >>>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >>> >> >> >        at
> >>> >> >> >
> >>> >> >>
> >>> >>
> >>>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >>> >> >> > ionHandlerImpl.java:80)
> >>> >> >> >
> >>> >> >> > Also, is the delivery channel component threadsafe?  I'm
> curious if
> >>> >> >> multiple
> >>> >> >> > threads accessing it is a problem or if I should keep access to
> it
> >>> >> >> > synchronized?  I'm currently synchronizing, but don't want to
> if I
> >>> >> don't
> >>> >> >> > need to.
> >>> >> >> >
> >>> >> >> > Thanks!
> >>> >> >> > Ryan
> >>> >> >> >
> >>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >>> bruce.snyder@gmail.com
> >>> >> >
> >>> >> >> > wrote:
> >>> >> >> >
> >>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >>> fragility2.0@gmail.com
> >>> >> >
> >>> >> >> >> wrote:
> >>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
> >>> kind
> >>> >> of
> >>> >> >> >> waiting
> >>> >> >> >> > until it was released, but this problem is now cropping up
> on a
> >>> >> >> regular
> >>> >> >> >> > basis on a server so I'll definitely give it a shot.
>  Hopefully
> >>> >> this
> >>> >> >> will
> >>> >> >> >> > allow me to get this project done so I can then get that
> Joram
> >>> >> write
> >>> >> >> up
> >>> >> >> >> done
> >>> >> >> >> > since I should have ran across hopefully most of the gotchas
> for
> >>> it
> >>> >> at
> >>> >> >> >> that
> >>> >> >> >> > point.
> >>> >> >> >>
> >>> >> >> >> 3.2.2 will be released very soon and I know it's pretty
> stable.
> >>> Maybe
> >>> >> >> >> we can release it this weekend.
> >>> >> >> >>
> >>> >> >> >> Bruce
> >>> >> >> >> --
> >>> >> >> >> perl -e 'print
> >>> >> >> >>
> >>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >>> >> >> >> );'
> >>> >> >> >>
> >>> >> >> >> Apache ActiveMQ - http://activemq.org/
> >>> >> >> >> Apache Camel - http://activemq.org/camel/
> >>> >> >> >> Apache ServiceMix - http://servicemix.org/
> >>> >> >> >>
> >>> >> >> >> Blog: http://bruceblog.org/
> >>> >> >> >>
> >>> >> >> >
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> --
> >>> >> >> Cheers,
> >>> >> >> Guillaume Nodet
> >>> >> >> ------------------------
> >>> >> >> Blog: http://gnodet.blogspot.com/
> >>> >> >>
> >>> >> >
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Cheers,
> >>> >> Guillaume Nodet
> >>> >> ------------------------
> >>> >> Blog: http://gnodet.blogspot.com/
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Cheers,
> >>> Guillaume Nodet
> >>> ------------------------
> >>> Blog: http://gnodet.blogspot.com/
> >>>
> >>
> >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
Could you please test something ?
In the BeanEndpoint, save the old value for the currentRequest.get()
in a local variable before setting it to the new value, and instead of
setting it to null after processing, set it back to the old value.  It
may fix the problem ...

On Mon, Jun 23, 2008 at 11:58 AM, Guillaume Nodet <gn...@gmail.com> wrote:
> I'm wondering if for some reason your endpoint sends a request to itself ?
> If this request is handled synchronously, it may happen that the
> currentRequest is set to null while handling this request, but in the
> same thread as the first request ?
> Under high load, this behavior could happen if the thread pool is
> exhausted, because under such conditions, the work will be executed in
> the same thread...
>
> On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com> wrote:
>> Oh right, because the thread obviously would be the one that would go
>> through onMessageExchange method and then it would be set to null after...
>> (bear with me, long weekend dealing with this problem and it's 4am on a
>> workday.. haha).
>>
>> It's a rather large bean, composed of several classes (it does a lot of
>> complicated stuff inside the bean)... but I could probably send you some
>> pieces of it... do you mind if I email them privately to you?
>>
>> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>>
>>> But the current request is only set to null *after* calling the pojo.
>>>  Do you have the full code of you bean ?
>>>
>>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
>>> wrote:
>>> > Sure, I backed out the changes in my editor.. basically my bean is
>>> standard
>>> > compared to the servicemix docs (for how to handle the exchange coming
>>> in),
>>> > then my bean takes the injected deliverychannel and hands it to a class
>>> that
>>> > creates a message to send out with results of some analysis performed..
>>> here
>>> > is the code to send out (it's using the DeliveryChannel injected into the
>>> > bean by Servicemix):
>>> >
>>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>>> >      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>>> > Boolean.TRUE);
>>> >      notificationMarshaller.marshal(notification, writer);
>>> >      if (destinationQname == null) {
>>> >        destinationQname = new QName(getDestinationNamespace(),
>>> > getDestinationService());
>>> >      }
>>> >      MessageExchangeFactory exchangeFactory =
>>> > deliveryChannel.createExchangeFactory();
>>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>>> >      NormalizedMessage message = exchange.createMessage();
>>> >      message.setContent(new StringSource(writer.toString()));
>>> >      exchange.setInMessage(message);
>>> >      exchange.setService(destinationQname);
>>> >      deliveryChannel.send(exchange);
>>> >
>>> > The send is where the ConcurrentHashmap complains about an NPE .. I think
>>> > because the BeanComponent sets the CurrentRequest to null around the time
>>> my
>>> > code is trying to send a request that must get clobbered?  There's no
>>> other
>>> > explanation for it.. it looks like the NPE is caused by
>>> > currentRequest.get(), which is set back to null by the BeanComponent and
>>> > since they are in the same thread.... they interfere.
>>> >
>>> > Ryan
>>> >
>>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
>>> wrote:
>>> >
>>> >> Is there any way you could paste the code of the bean you're using so
>>> >> that i can have a quick look. You can skip any non-jbi related
>>> >> processing...
>>> >>
>>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
>>> >> wrote:
>>> >> > No, I'm just simply using the deliverychannel to send out, which is
>>> >> > mentioned in the servicemix docs as something that you can do.  I
>>> assume
>>> >> > that means it's recommended :)  I did see that I can inject a
>>> >> > ComponentContext and so I'm currently changing my outbound messages to
>>> >> that
>>> >> > to see if I can get around this problem.  I think I just can't use the
>>> >> > DeliveryContext in the same Pojo (same thread).
>>> >> >
>>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
>>> >> wrote:
>>> >> >
>>> >> >> The NPE in the PojoChannel.send() method means that the
>>> >> >> currentRequest.get() is null.
>>> >> >> Do you perform any threading operation in the pojo ? If yes, you
>>> >> >> should try to remove that, as the component is already able to handle
>>> >> >> concurrent requests.
>>> >> >>
>>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fragility2.0@gmail.com
>>> >
>>> >> >> wrote:
>>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>>> >> bad
>>> >> >> for
>>> >> >> > me and has the same problem :(  It only seems to affect our
>>> production
>>> >> >> > server and in a few minutes after start up, I start getting the
>>> >> >> > NullPointerException.. slowly all my services start doing it and
>>> they
>>> >> all
>>> >> >> > stop working.  If I stop and restart servicemix, then
>>> servicemix-jms
>>> >> >> > components are no longer routable.  I'm guessing this error causes
>>> >> >> > Servicemix to shut them down and not deploy them anymore
>>> (Servicemix
>>> >> does
>>> >> >> > the same thing if a service unit starts up, tries to make a Joram
>>> >> >> connection
>>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
>>> will
>>> >> >> always
>>> >> >> > shut it down immediately after it starts on any subsequent run).
>>> >> >> >
>>> >> >> > It seems like this problem must be related to a race condition.
>>>  When
>>> >> >> doing
>>> >> >> > development testing, I never see this problem on my laptop even
>>> under
>>> >> >> high
>>> >> >> > load.  One our fast test server, I see this error popup once on
>>> >> startup
>>> >> >> and
>>> >> >> > then it doesn't seem to happen again.  On our even faster
>>> production
>>> >> >> server,
>>> >> >> > the whole thing looses it's wheels and falls apart after a few
>>> >> minutes.
>>> >> >> >
>>> >> >> > I'm supposed to be deploying this system in a few days and of
>>> course
>>> >> >> that's
>>> >> >> > the only spot where I can't temporarily limp by.  Is it possible
>>> you
>>> >> >> could
>>> >> >> > give me some hints on what the problem is and I'll debug it this
>>> >> weekend
>>> >> >> to
>>> >> >> > see if I can fix it, or at least patch it temporarily?  I really
>>> need
>>> >> to
>>> >> >> > figure out way to get around this problem.  Other than that, 3.2.2
>>> >> seems
>>> >> >> to
>>> >> >> > work perfectly fine.
>>> >> >> >
>>> >> >> > Here is the caused by error again in case it's any bit different
>>> than
>>> >> the
>>> >> >> > 3.2.1 one was:
>>> >> >> >
>>> >> >> > Caused by: java.lang.NullPointerException
>>> >> >> >        at
>>> >> >> >
>>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>>> >> >> >        at
>>> >> >> >
>>> >> >>
>>> >>
>>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>>> >> >> >        at
>>> >> >> >
>>> >> >>
>>> >>
>>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>>> >> >> > ionHandlerImpl.java:80)
>>> >> >> >
>>> >> >> > Also, is the delivery channel component threadsafe?  I'm curious if
>>> >> >> multiple
>>> >> >> > threads accessing it is a problem or if I should keep access to it
>>> >> >> > synchronized?  I'm currently synchronizing, but don't want to if I
>>> >> don't
>>> >> >> > need to.
>>> >> >> >
>>> >> >> > Thanks!
>>> >> >> > Ryan
>>> >> >> >
>>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>>> bruce.snyder@gmail.com
>>> >> >
>>> >> >> > wrote:
>>> >> >> >
>>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>>> fragility2.0@gmail.com
>>> >> >
>>> >> >> >> wrote:
>>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
>>> kind
>>> >> of
>>> >> >> >> waiting
>>> >> >> >> > until it was released, but this problem is now cropping up on a
>>> >> >> regular
>>> >> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
>>> >> this
>>> >> >> will
>>> >> >> >> > allow me to get this project done so I can then get that Joram
>>> >> write
>>> >> >> up
>>> >> >> >> done
>>> >> >> >> > since I should have ran across hopefully most of the gotchas for
>>> it
>>> >> at
>>> >> >> >> that
>>> >> >> >> > point.
>>> >> >> >>
>>> >> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
>>> Maybe
>>> >> >> >> we can release it this weekend.
>>> >> >> >>
>>> >> >> >> Bruce
>>> >> >> >> --
>>> >> >> >> perl -e 'print
>>> >> >> >>
>>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>> >> >> >> );'
>>> >> >> >>
>>> >> >> >> Apache ActiveMQ - http://activemq.org/
>>> >> >> >> Apache Camel - http://activemq.org/camel/
>>> >> >> >> Apache ServiceMix - http://servicemix.org/
>>> >> >> >>
>>> >> >> >> Blog: http://bruceblog.org/
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> Cheers,
>>> >> >> Guillaume Nodet
>>> >> >> ------------------------
>>> >> >> Blog: http://gnodet.blogspot.com/
>>> >> >>
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Cheers,
>>> >> Guillaume Nodet
>>> >> ------------------------
>>> >> Blog: http://gnodet.blogspot.com/
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> Guillaume Nodet
>>> ------------------------
>>> Blog: http://gnodet.blogspot.com/
>>>
>>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Does it possibly mean anything, or give any clues that when Servicemix first
deploys my BeanEndpoint (I have a couple instances of it deployed as
different services), they all deadlock at the same spot, which is
coincidentally where the NPEs happen?  I had a stack trace, but then I lost
it because I disconnected my remote desktop terminal ... doh..

On Mon, Jun 23, 2008 at 6:08 AM, Ryan Moquin <fr...@gmail.com> wrote:

> Would it be worth making the threadpool larger possibly?
>
>
> On Mon, Jun 23, 2008 at 5:58 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> I'm wondering if for some reason your endpoint sends a request to itself ?
>> If this request is handled synchronously, it may happen that the
>> currentRequest is set to null while handling this request, but in the
>> same thread as the first request ?
>> Under high load, this behavior could happen if the thread pool is
>> exhausted, because under such conditions, the work will be executed in
>> the same thread...
>>
>> On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > Oh right, because the thread obviously would be the one that would go
>> > through onMessageExchange method and then it would be set to null
>> after...
>> > (bear with me, long weekend dealing with this problem and it's 4am on a
>> > workday.. haha).
>> >
>> > It's a rather large bean, composed of several classes (it does a lot of
>> > complicated stuff inside the bean)... but I could probably send you some
>> > pieces of it... do you mind if I email them privately to you?
>> >
>> > On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> But the current request is only set to null *after* calling the pojo.
>> >>  Do you have the full code of you bean ?
>> >>
>> >> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > Sure, I backed out the changes in my editor.. basically my bean is
>> >> standard
>> >> > compared to the servicemix docs (for how to handle the exchange
>> coming
>> >> in),
>> >> > then my bean takes the injected deliverychannel and hands it to a
>> class
>> >> that
>> >> > creates a message to send out with results of some analysis
>> performed..
>> >> here
>> >> > is the code to send out (it's using the DeliveryChannel injected into
>> the
>> >> > bean by Servicemix):
>> >> >
>> >> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>> >> >
>>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> >> > Boolean.TRUE);
>> >> >      notificationMarshaller.marshal(notification, writer);
>> >> >      if (destinationQname == null) {
>> >> >        destinationQname = new QName(getDestinationNamespace(),
>> >> > getDestinationService());
>> >> >      }
>> >> >      MessageExchangeFactory exchangeFactory =
>> >> > deliveryChannel.createExchangeFactory();
>> >> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >> >      NormalizedMessage message = exchange.createMessage();
>> >> >      message.setContent(new StringSource(writer.toString()));
>> >> >      exchange.setInMessage(message);
>> >> >      exchange.setService(destinationQname);
>> >> >      deliveryChannel.send(exchange);
>> >> >
>> >> > The send is where the ConcurrentHashmap complains about an NPE .. I
>> think
>> >> > because the BeanComponent sets the CurrentRequest to null around the
>> time
>> >> my
>> >> > code is trying to send a request that must get clobbered?  There's no
>> >> other
>> >> > explanation for it.. it looks like the NPE is caused by
>> >> > currentRequest.get(), which is set back to null by the BeanComponent
>> and
>> >> > since they are in the same thread.... they interfere.
>> >> >
>> >> > Ryan
>> >> >
>> >> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> Is there any way you could paste the code of the bean you're using
>> so
>> >> >> that i can have a quick look. You can skip any non-jbi related
>> >> >> processing...
>> >> >>
>> >> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <
>> fragility2.0@gmail.com>
>> >> >> wrote:
>> >> >> > No, I'm just simply using the deliverychannel to send out, which
>> is
>> >> >> > mentioned in the servicemix docs as something that you can do.  I
>> >> assume
>> >> >> > that means it's recommended :)  I did see that I can inject a
>> >> >> > ComponentContext and so I'm currently changing my outbound
>> messages to
>> >> >> that
>> >> >> > to see if I can get around this problem.  I think I just can't use
>> the
>> >> >> > DeliveryContext in the same Pojo (same thread).
>> >> >> >
>> >> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <
>> gnodet@gmail.com>
>> >> >> wrote:
>> >> >> >
>> >> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >> >> currentRequest.get() is null.
>> >> >> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> >> >> should try to remove that, as the component is already able to
>> handle
>> >> >> >> concurrent requests.
>> >> >> >>
>> >> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
>> fragility2.0@gmail.com
>> >> >
>> >> >> >> wrote:
>> >> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
>> pretty
>> >> >> bad
>> >> >> >> for
>> >> >> >> > me and has the same problem :(  It only seems to affect our
>> >> production
>> >> >> >> > server and in a few minutes after start up, I start getting the
>> >> >> >> > NullPointerException.. slowly all my services start doing it
>> and
>> >> they
>> >> >> all
>> >> >> >> > stop working.  If I stop and restart servicemix, then
>> >> servicemix-jms
>> >> >> >> > components are no longer routable.  I'm guessing this error
>> causes
>> >> >> >> > Servicemix to shut them down and not deploy them anymore
>> >> (Servicemix
>> >> >> does
>> >> >> >> > the same thing if a service unit starts up, tries to make a
>> Joram
>> >> >> >> connection
>> >> >> >> > to a server that isn't up, servicemix will shutdown that SU and
>> >> will
>> >> >> >> always
>> >> >> >> > shut it down immediately after it starts on any subsequent
>> run).
>> >> >> >> >
>> >> >> >> > It seems like this problem must be related to a race condition.
>> >>  When
>> >> >> >> doing
>> >> >> >> > development testing, I never see this problem on my laptop even
>> >> under
>> >> >> >> high
>> >> >> >> > load.  One our fast test server, I see this error popup once on
>> >> >> startup
>> >> >> >> and
>> >> >> >> > then it doesn't seem to happen again.  On our even faster
>> >> production
>> >> >> >> server,
>> >> >> >> > the whole thing looses it's wheels and falls apart after a few
>> >> >> minutes.
>> >> >> >> >
>> >> >> >> > I'm supposed to be deploying this system in a few days and of
>> >> course
>> >> >> >> that's
>> >> >> >> > the only spot where I can't temporarily limp by.  Is it
>> possible
>> >> you
>> >> >> >> could
>> >> >> >> > give me some hints on what the problem is and I'll debug it
>> this
>> >> >> weekend
>> >> >> >> to
>> >> >> >> > see if I can fix it, or at least patch it temporarily?  I
>> really
>> >> need
>> >> >> to
>> >> >> >> > figure out way to get around this problem.  Other than that,
>> 3.2.2
>> >> >> seems
>> >> >> >> to
>> >> >> >> > work perfectly fine.
>> >> >> >> >
>> >> >> >> > Here is the caused by error again in case it's any bit
>> different
>> >> than
>> >> >> the
>> >> >> >> > 3.2.1 one was:
>> >> >> >> >
>> >> >> >> > Caused by: java.lang.NullPointerException
>> >> >> >> >        at
>> >> >> >> >
>> >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >> >> >        at
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >> >> >        at
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >> >> > ionHandlerImpl.java:80)
>> >> >> >> >
>> >> >> >> > Also, is the delivery channel component threadsafe?  I'm
>> curious if
>> >> >> >> multiple
>> >> >> >> > threads accessing it is a problem or if I should keep access to
>> it
>> >> >> >> > synchronized?  I'm currently synchronizing, but don't want to
>> if I
>> >> >> don't
>> >> >> >> > need to.
>> >> >> >> >
>> >> >> >> > Thanks!
>> >> >> >> > Ryan
>> >> >> >> >
>> >> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> >> bruce.snyder@gmail.com
>> >> >> >
>> >> >> >> > wrote:
>> >> >> >> >
>> >> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> >> fragility2.0@gmail.com
>> >> >> >
>> >> >> >> >> wrote:
>> >> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
>> >> kind
>> >> >> of
>> >> >> >> >> waiting
>> >> >> >> >> > until it was released, but this problem is now cropping up
>> on a
>> >> >> >> regular
>> >> >> >> >> > basis on a server so I'll definitely give it a shot.
>>  Hopefully
>> >> >> this
>> >> >> >> will
>> >> >> >> >> > allow me to get this project done so I can then get that
>> Joram
>> >> >> write
>> >> >> >> up
>> >> >> >> >> done
>> >> >> >> >> > since I should have ran across hopefully most of the gotchas
>> for
>> >> it
>> >> >> at
>> >> >> >> >> that
>> >> >> >> >> > point.
>> >> >> >> >>
>> >> >> >> >> 3.2.2 will be released very soon and I know it's pretty
>> stable.
>> >> Maybe
>> >> >> >> >> we can release it this weekend.
>> >> >> >> >>
>> >> >> >> >> Bruce
>> >> >> >> >> --
>> >> >> >> >> perl -e 'print
>> >> >> >> >>
>> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> >> >> );'
>> >> >> >> >>
>> >> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >> >> >>
>> >> >> >> >> Blog: http://bruceblog.org/
>> >> >> >> >>
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Cheers,
>> >> >> >> Guillaume Nodet
>> >> >> >> ------------------------
>> >> >> >> Blog: http://gnodet.blogspot.com/
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Cheers,
>> >> >> Guillaume Nodet
>> >> >> ------------------------
>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>
>

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Would it be worth making the threadpool larger possibly?

On Mon, Jun 23, 2008 at 5:58 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> I'm wondering if for some reason your endpoint sends a request to itself ?
> If this request is handled synchronously, it may happen that the
> currentRequest is set to null while handling this request, but in the
> same thread as the first request ?
> Under high load, this behavior could happen if the thread pool is
> exhausted, because under such conditions, the work will be executed in
> the same thread...
>
> On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Oh right, because the thread obviously would be the one that would go
> > through onMessageExchange method and then it would be set to null
> after...
> > (bear with me, long weekend dealing with this problem and it's 4am on a
> > workday.. haha).
> >
> > It's a rather large bean, composed of several classes (it does a lot of
> > complicated stuff inside the bean)... but I could probably send you some
> > pieces of it... do you mind if I email them privately to you?
> >
> > On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> But the current request is only set to null *after* calling the pojo.
> >>  Do you have the full code of you bean ?
> >>
> >> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > Sure, I backed out the changes in my editor.. basically my bean is
> >> standard
> >> > compared to the servicemix docs (for how to handle the exchange coming
> >> in),
> >> > then my bean takes the injected deliverychannel and hands it to a
> class
> >> that
> >> > creates a message to send out with results of some analysis
> performed..
> >> here
> >> > is the code to send out (it's using the DeliveryChannel injected into
> the
> >> > bean by Servicemix):
> >> >
> >> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
> >> >
>  notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> >> > Boolean.TRUE);
> >> >      notificationMarshaller.marshal(notification, writer);
> >> >      if (destinationQname == null) {
> >> >        destinationQname = new QName(getDestinationNamespace(),
> >> > getDestinationService());
> >> >      }
> >> >      MessageExchangeFactory exchangeFactory =
> >> > deliveryChannel.createExchangeFactory();
> >> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >> >      NormalizedMessage message = exchange.createMessage();
> >> >      message.setContent(new StringSource(writer.toString()));
> >> >      exchange.setInMessage(message);
> >> >      exchange.setService(destinationQname);
> >> >      deliveryChannel.send(exchange);
> >> >
> >> > The send is where the ConcurrentHashmap complains about an NPE .. I
> think
> >> > because the BeanComponent sets the CurrentRequest to null around the
> time
> >> my
> >> > code is trying to send a request that must get clobbered?  There's no
> >> other
> >> > explanation for it.. it looks like the NPE is caused by
> >> > currentRequest.get(), which is set back to null by the BeanComponent
> and
> >> > since they are in the same thread.... they interfere.
> >> >
> >> > Ryan
> >> >
> >> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> >
> >> >> Is there any way you could paste the code of the bean you're using so
> >> >> that i can have a quick look. You can skip any non-jbi related
> >> >> processing...
> >> >>
> >> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fragility2.0@gmail.com
> >
> >> >> wrote:
> >> >> > No, I'm just simply using the deliverychannel to send out, which is
> >> >> > mentioned in the servicemix docs as something that you can do.  I
> >> assume
> >> >> > that means it's recommended :)  I did see that I can inject a
> >> >> > ComponentContext and so I'm currently changing my outbound messages
> to
> >> >> that
> >> >> > to see if I can get around this problem.  I think I just can't use
> the
> >> >> > DeliveryContext in the same Pojo (same thread).
> >> >> >
> >> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gnodet@gmail.com
> >
> >> >> wrote:
> >> >> >
> >> >> >> The NPE in the PojoChannel.send() method means that the
> >> >> >> currentRequest.get() is null.
> >> >> >> Do you perform any threading operation in the pojo ? If yes, you
> >> >> >> should try to remove that, as the component is already able to
> handle
> >> >> >> concurrent requests.
> >> >> >>
> >> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <
> fragility2.0@gmail.com
> >> >
> >> >> >> wrote:
> >> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working
> pretty
> >> >> bad
> >> >> >> for
> >> >> >> > me and has the same problem :(  It only seems to affect our
> >> production
> >> >> >> > server and in a few minutes after start up, I start getting the
> >> >> >> > NullPointerException.. slowly all my services start doing it and
> >> they
> >> >> all
> >> >> >> > stop working.  If I stop and restart servicemix, then
> >> servicemix-jms
> >> >> >> > components are no longer routable.  I'm guessing this error
> causes
> >> >> >> > Servicemix to shut them down and not deploy them anymore
> >> (Servicemix
> >> >> does
> >> >> >> > the same thing if a service unit starts up, tries to make a
> Joram
> >> >> >> connection
> >> >> >> > to a server that isn't up, servicemix will shutdown that SU and
> >> will
> >> >> >> always
> >> >> >> > shut it down immediately after it starts on any subsequent run).
> >> >> >> >
> >> >> >> > It seems like this problem must be related to a race condition.
> >>  When
> >> >> >> doing
> >> >> >> > development testing, I never see this problem on my laptop even
> >> under
> >> >> >> high
> >> >> >> > load.  One our fast test server, I see this error popup once on
> >> >> startup
> >> >> >> and
> >> >> >> > then it doesn't seem to happen again.  On our even faster
> >> production
> >> >> >> server,
> >> >> >> > the whole thing looses it's wheels and falls apart after a few
> >> >> minutes.
> >> >> >> >
> >> >> >> > I'm supposed to be deploying this system in a few days and of
> >> course
> >> >> >> that's
> >> >> >> > the only spot where I can't temporarily limp by.  Is it possible
> >> you
> >> >> >> could
> >> >> >> > give me some hints on what the problem is and I'll debug it this
> >> >> weekend
> >> >> >> to
> >> >> >> > see if I can fix it, or at least patch it temporarily?  I really
> >> need
> >> >> to
> >> >> >> > figure out way to get around this problem.  Other than that,
> 3.2.2
> >> >> seems
> >> >> >> to
> >> >> >> > work perfectly fine.
> >> >> >> >
> >> >> >> > Here is the caused by error again in case it's any bit different
> >> than
> >> >> the
> >> >> >> > 3.2.1 one was:
> >> >> >> >
> >> >> >> > Caused by: java.lang.NullPointerException
> >> >> >> >        at
> >> >> >> >
> >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >> >> >        at
> >> >> >> >
> >> >> >>
> >> >>
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >> >> >        at
> >> >> >> >
> >> >> >>
> >> >>
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> >> >> > ionHandlerImpl.java:80)
> >> >> >> >
> >> >> >> > Also, is the delivery channel component threadsafe?  I'm curious
> if
> >> >> >> multiple
> >> >> >> > threads accessing it is a problem or if I should keep access to
> it
> >> >> >> > synchronized?  I'm currently synchronizing, but don't want to if
> I
> >> >> don't
> >> >> >> > need to.
> >> >> >> >
> >> >> >> > Thanks!
> >> >> >> > Ryan
> >> >> >> >
> >> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> >> bruce.snyder@gmail.com
> >> >> >
> >> >> >> > wrote:
> >> >> >> >
> >> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> >> fragility2.0@gmail.com
> >> >> >
> >> >> >> >> wrote:
> >> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
> >> kind
> >> >> of
> >> >> >> >> waiting
> >> >> >> >> > until it was released, but this problem is now cropping up on
> a
> >> >> >> regular
> >> >> >> >> > basis on a server so I'll definitely give it a shot.
>  Hopefully
> >> >> this
> >> >> >> will
> >> >> >> >> > allow me to get this project done so I can then get that
> Joram
> >> >> write
> >> >> >> up
> >> >> >> >> done
> >> >> >> >> > since I should have ran across hopefully most of the gotchas
> for
> >> it
> >> >> at
> >> >> >> >> that
> >> >> >> >> > point.
> >> >> >> >>
> >> >> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
> >> Maybe
> >> >> >> >> we can release it this weekend.
> >> >> >> >>
> >> >> >> >> Bruce
> >> >> >> >> --
> >> >> >> >> perl -e 'print
> >> >> >> >>
> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >> >> >> );'
> >> >> >> >>
> >> >> >> >> Apache ActiveMQ - http://activemq.org/
> >> >> >> >> Apache Camel - http://activemq.org/camel/
> >> >> >> >> Apache ServiceMix - http://servicemix.org/
> >> >> >> >>
> >> >> >> >> Blog: http://bruceblog.org/
> >> >> >> >>
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Cheers,
> >> >> >> Guillaume Nodet
> >> >> >> ------------------------
> >> >> >> Blog: http://gnodet.blogspot.com/
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Cheers,
> >> >> Guillaume Nodet
> >> >> ------------------------
> >> >> Blog: http://gnodet.blogspot.com/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
I'm wondering if for some reason your endpoint sends a request to itself ?
If this request is handled synchronously, it may happen that the
currentRequest is set to null while handling this request, but in the
same thread as the first request ?
Under high load, this behavior could happen if the thread pool is
exhausted, because under such conditions, the work will be executed in
the same thread...

On Mon, Jun 23, 2008 at 9:52 AM, Ryan Moquin <fr...@gmail.com> wrote:
> Oh right, because the thread obviously would be the one that would go
> through onMessageExchange method and then it would be set to null after...
> (bear with me, long weekend dealing with this problem and it's 4am on a
> workday.. haha).
>
> It's a rather large bean, composed of several classes (it does a lot of
> complicated stuff inside the bean)... but I could probably send you some
> pieces of it... do you mind if I email them privately to you?
>
> On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> But the current request is only set to null *after* calling the pojo.
>>  Do you have the full code of you bean ?
>>
>> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > Sure, I backed out the changes in my editor.. basically my bean is
>> standard
>> > compared to the servicemix docs (for how to handle the exchange coming
>> in),
>> > then my bean takes the injected deliverychannel and hands it to a class
>> that
>> > creates a message to send out with results of some analysis performed..
>> here
>> > is the code to send out (it's using the DeliveryChannel injected into the
>> > bean by Servicemix):
>> >
>> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>> >      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
>> > Boolean.TRUE);
>> >      notificationMarshaller.marshal(notification, writer);
>> >      if (destinationQname == null) {
>> >        destinationQname = new QName(getDestinationNamespace(),
>> > getDestinationService());
>> >      }
>> >      MessageExchangeFactory exchangeFactory =
>> > deliveryChannel.createExchangeFactory();
>> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
>> >      NormalizedMessage message = exchange.createMessage();
>> >      message.setContent(new StringSource(writer.toString()));
>> >      exchange.setInMessage(message);
>> >      exchange.setService(destinationQname);
>> >      deliveryChannel.send(exchange);
>> >
>> > The send is where the ConcurrentHashmap complains about an NPE .. I think
>> > because the BeanComponent sets the CurrentRequest to null around the time
>> my
>> > code is trying to send a request that must get clobbered?  There's no
>> other
>> > explanation for it.. it looks like the NPE is caused by
>> > currentRequest.get(), which is set back to null by the BeanComponent and
>> > since they are in the same thread.... they interfere.
>> >
>> > Ryan
>> >
>> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> Is there any way you could paste the code of the bean you're using so
>> >> that i can have a quick look. You can skip any non-jbi related
>> >> processing...
>> >>
>> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > No, I'm just simply using the deliverychannel to send out, which is
>> >> > mentioned in the servicemix docs as something that you can do.  I
>> assume
>> >> > that means it's recommended :)  I did see that I can inject a
>> >> > ComponentContext and so I'm currently changing my outbound messages to
>> >> that
>> >> > to see if I can get around this problem.  I think I just can't use the
>> >> > DeliveryContext in the same Pojo (same thread).
>> >> >
>> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
>> >> wrote:
>> >> >
>> >> >> The NPE in the PojoChannel.send() method means that the
>> >> >> currentRequest.get() is null.
>> >> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> >> should try to remove that, as the component is already able to handle
>> >> >> concurrent requests.
>> >> >>
>> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fragility2.0@gmail.com
>> >
>> >> >> wrote:
>> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>> >> bad
>> >> >> for
>> >> >> > me and has the same problem :(  It only seems to affect our
>> production
>> >> >> > server and in a few minutes after start up, I start getting the
>> >> >> > NullPointerException.. slowly all my services start doing it and
>> they
>> >> all
>> >> >> > stop working.  If I stop and restart servicemix, then
>> servicemix-jms
>> >> >> > components are no longer routable.  I'm guessing this error causes
>> >> >> > Servicemix to shut them down and not deploy them anymore
>> (Servicemix
>> >> does
>> >> >> > the same thing if a service unit starts up, tries to make a Joram
>> >> >> connection
>> >> >> > to a server that isn't up, servicemix will shutdown that SU and
>> will
>> >> >> always
>> >> >> > shut it down immediately after it starts on any subsequent run).
>> >> >> >
>> >> >> > It seems like this problem must be related to a race condition.
>>  When
>> >> >> doing
>> >> >> > development testing, I never see this problem on my laptop even
>> under
>> >> >> high
>> >> >> > load.  One our fast test server, I see this error popup once on
>> >> startup
>> >> >> and
>> >> >> > then it doesn't seem to happen again.  On our even faster
>> production
>> >> >> server,
>> >> >> > the whole thing looses it's wheels and falls apart after a few
>> >> minutes.
>> >> >> >
>> >> >> > I'm supposed to be deploying this system in a few days and of
>> course
>> >> >> that's
>> >> >> > the only spot where I can't temporarily limp by.  Is it possible
>> you
>> >> >> could
>> >> >> > give me some hints on what the problem is and I'll debug it this
>> >> weekend
>> >> >> to
>> >> >> > see if I can fix it, or at least patch it temporarily?  I really
>> need
>> >> to
>> >> >> > figure out way to get around this problem.  Other than that, 3.2.2
>> >> seems
>> >> >> to
>> >> >> > work perfectly fine.
>> >> >> >
>> >> >> > Here is the caused by error again in case it's any bit different
>> than
>> >> the
>> >> >> > 3.2.1 one was:
>> >> >> >
>> >> >> > Caused by: java.lang.NullPointerException
>> >> >> >        at
>> >> >> >
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >> >        at
>> >> >> >
>> >> >>
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >> >        at
>> >> >> >
>> >> >>
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> >> > ionHandlerImpl.java:80)
>> >> >> >
>> >> >> > Also, is the delivery channel component threadsafe?  I'm curious if
>> >> >> multiple
>> >> >> > threads accessing it is a problem or if I should keep access to it
>> >> >> > synchronized?  I'm currently synchronizing, but don't want to if I
>> >> don't
>> >> >> > need to.
>> >> >> >
>> >> >> > Thanks!
>> >> >> > Ryan
>> >> >> >
>> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> bruce.snyder@gmail.com
>> >> >
>> >> >> > wrote:
>> >> >> >
>> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> fragility2.0@gmail.com
>> >> >
>> >> >> >> wrote:
>> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
>> kind
>> >> of
>> >> >> >> waiting
>> >> >> >> > until it was released, but this problem is now cropping up on a
>> >> >> regular
>> >> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
>> >> this
>> >> >> will
>> >> >> >> > allow me to get this project done so I can then get that Joram
>> >> write
>> >> >> up
>> >> >> >> done
>> >> >> >> > since I should have ran across hopefully most of the gotchas for
>> it
>> >> at
>> >> >> >> that
>> >> >> >> > point.
>> >> >> >>
>> >> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
>> Maybe
>> >> >> >> we can release it this weekend.
>> >> >> >>
>> >> >> >> Bruce
>> >> >> >> --
>> >> >> >> perl -e 'print
>> >> >> >>
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> >> );'
>> >> >> >>
>> >> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >> >>
>> >> >> >> Blog: http://bruceblog.org/
>> >> >> >>
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Cheers,
>> >> >> Guillaume Nodet
>> >> >> ------------------------
>> >> >> Blog: http://gnodet.blogspot.com/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Oh right, because the thread obviously would be the one that would go
through onMessageExchange method and then it would be set to null after...
(bear with me, long weekend dealing with this problem and it's 4am on a
workday.. haha).

It's a rather large bean, composed of several classes (it does a lot of
complicated stuff inside the bean)... but I could probably send you some
pieces of it... do you mind if I email them privately to you?

On Mon, Jun 23, 2008 at 3:44 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> But the current request is only set to null *after* calling the pojo.
>  Do you have the full code of you bean ?
>
> On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Sure, I backed out the changes in my editor.. basically my bean is
> standard
> > compared to the servicemix docs (for how to handle the exchange coming
> in),
> > then my bean takes the injected deliverychannel and hands it to a class
> that
> > creates a message to send out with results of some analysis performed..
> here
> > is the code to send out (it's using the DeliveryChannel injected into the
> > bean by Servicemix):
> >
> > Marshaller notificationMarshaller = jaxbContext.createMarshaller();
> >      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> > Boolean.TRUE);
> >      notificationMarshaller.marshal(notification, writer);
> >      if (destinationQname == null) {
> >        destinationQname = new QName(getDestinationNamespace(),
> > getDestinationService());
> >      }
> >      MessageExchangeFactory exchangeFactory =
> > deliveryChannel.createExchangeFactory();
> >      InOnly exchange = exchangeFactory.createInOnlyExchange();
> >      NormalizedMessage message = exchange.createMessage();
> >      message.setContent(new StringSource(writer.toString()));
> >      exchange.setInMessage(message);
> >      exchange.setService(destinationQname);
> >      deliveryChannel.send(exchange);
> >
> > The send is where the ConcurrentHashmap complains about an NPE .. I think
> > because the BeanComponent sets the CurrentRequest to null around the time
> my
> > code is trying to send a request that must get clobbered?  There's no
> other
> > explanation for it.. it looks like the NPE is caused by
> > currentRequest.get(), which is set back to null by the BeanComponent and
> > since they are in the same thread.... they interfere.
> >
> > Ryan
> >
> > On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> Is there any way you could paste the code of the bean you're using so
> >> that i can have a quick look. You can skip any non-jbi related
> >> processing...
> >>
> >> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > No, I'm just simply using the deliverychannel to send out, which is
> >> > mentioned in the servicemix docs as something that you can do.  I
> assume
> >> > that means it's recommended :)  I did see that I can inject a
> >> > ComponentContext and so I'm currently changing my outbound messages to
> >> that
> >> > to see if I can get around this problem.  I think I just can't use the
> >> > DeliveryContext in the same Pojo (same thread).
> >> >
> >> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
> >> wrote:
> >> >
> >> >> The NPE in the PojoChannel.send() method means that the
> >> >> currentRequest.get() is null.
> >> >> Do you perform any threading operation in the pojo ? If yes, you
> >> >> should try to remove that, as the component is already able to handle
> >> >> concurrent requests.
> >> >>
> >> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fragility2.0@gmail.com
> >
> >> >> wrote:
> >> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
> >> bad
> >> >> for
> >> >> > me and has the same problem :(  It only seems to affect our
> production
> >> >> > server and in a few minutes after start up, I start getting the
> >> >> > NullPointerException.. slowly all my services start doing it and
> they
> >> all
> >> >> > stop working.  If I stop and restart servicemix, then
> servicemix-jms
> >> >> > components are no longer routable.  I'm guessing this error causes
> >> >> > Servicemix to shut them down and not deploy them anymore
> (Servicemix
> >> does
> >> >> > the same thing if a service unit starts up, tries to make a Joram
> >> >> connection
> >> >> > to a server that isn't up, servicemix will shutdown that SU and
> will
> >> >> always
> >> >> > shut it down immediately after it starts on any subsequent run).
> >> >> >
> >> >> > It seems like this problem must be related to a race condition.
>  When
> >> >> doing
> >> >> > development testing, I never see this problem on my laptop even
> under
> >> >> high
> >> >> > load.  One our fast test server, I see this error popup once on
> >> startup
> >> >> and
> >> >> > then it doesn't seem to happen again.  On our even faster
> production
> >> >> server,
> >> >> > the whole thing looses it's wheels and falls apart after a few
> >> minutes.
> >> >> >
> >> >> > I'm supposed to be deploying this system in a few days and of
> course
> >> >> that's
> >> >> > the only spot where I can't temporarily limp by.  Is it possible
> you
> >> >> could
> >> >> > give me some hints on what the problem is and I'll debug it this
> >> weekend
> >> >> to
> >> >> > see if I can fix it, or at least patch it temporarily?  I really
> need
> >> to
> >> >> > figure out way to get around this problem.  Other than that, 3.2.2
> >> seems
> >> >> to
> >> >> > work perfectly fine.
> >> >> >
> >> >> > Here is the caused by error again in case it's any bit different
> than
> >> the
> >> >> > 3.2.1 one was:
> >> >> >
> >> >> > Caused by: java.lang.NullPointerException
> >> >> >        at
> >> >> >
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >> >        at
> >> >> >
> >> >>
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >> >        at
> >> >> >
> >> >>
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> >> > ionHandlerImpl.java:80)
> >> >> >
> >> >> > Also, is the delivery channel component threadsafe?  I'm curious if
> >> >> multiple
> >> >> > threads accessing it is a problem or if I should keep access to it
> >> >> > synchronized?  I'm currently synchronizing, but don't want to if I
> >> don't
> >> >> > need to.
> >> >> >
> >> >> > Thanks!
> >> >> > Ryan
> >> >> >
> >> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
> bruce.snyder@gmail.com
> >> >
> >> >> > wrote:
> >> >> >
> >> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
> fragility2.0@gmail.com
> >> >
> >> >> >> wrote:
> >> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was
> kind
> >> of
> >> >> >> waiting
> >> >> >> > until it was released, but this problem is now cropping up on a
> >> >> regular
> >> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
> >> this
> >> >> will
> >> >> >> > allow me to get this project done so I can then get that Joram
> >> write
> >> >> up
> >> >> >> done
> >> >> >> > since I should have ran across hopefully most of the gotchas for
> it
> >> at
> >> >> >> that
> >> >> >> > point.
> >> >> >>
> >> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
> Maybe
> >> >> >> we can release it this weekend.
> >> >> >>
> >> >> >> Bruce
> >> >> >> --
> >> >> >> perl -e 'print
> >> >> >>
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >> >> );'
> >> >> >>
> >> >> >> Apache ActiveMQ - http://activemq.org/
> >> >> >> Apache Camel - http://activemq.org/camel/
> >> >> >> Apache ServiceMix - http://servicemix.org/
> >> >> >>
> >> >> >> Blog: http://bruceblog.org/
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Cheers,
> >> >> Guillaume Nodet
> >> >> ------------------------
> >> >> Blog: http://gnodet.blogspot.com/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
But the current request is only set to null *after* calling the pojo.
  Do you have the full code of you bean ?

On Mon, Jun 23, 2008 at 9:31 AM, Ryan Moquin <fr...@gmail.com> wrote:
> Sure, I backed out the changes in my editor.. basically my bean is standard
> compared to the servicemix docs (for how to handle the exchange coming in),
> then my bean takes the injected deliverychannel and hands it to a class that
> creates a message to send out with results of some analysis performed.. here
> is the code to send out (it's using the DeliveryChannel injected into the
> bean by Servicemix):
>
> Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> Boolean.TRUE);
>      notificationMarshaller.marshal(notification, writer);
>      if (destinationQname == null) {
>        destinationQname = new QName(getDestinationNamespace(),
> getDestinationService());
>      }
>      MessageExchangeFactory exchangeFactory =
> deliveryChannel.createExchangeFactory();
>      InOnly exchange = exchangeFactory.createInOnlyExchange();
>      NormalizedMessage message = exchange.createMessage();
>      message.setContent(new StringSource(writer.toString()));
>      exchange.setInMessage(message);
>      exchange.setService(destinationQname);
>      deliveryChannel.send(exchange);
>
> The send is where the ConcurrentHashmap complains about an NPE .. I think
> because the BeanComponent sets the CurrentRequest to null around the time my
> code is trying to send a request that must get clobbered?  There's no other
> explanation for it.. it looks like the NPE is caused by
> currentRequest.get(), which is set back to null by the BeanComponent and
> since they are in the same thread.... they interfere.
>
> Ryan
>
> On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> Is there any way you could paste the code of the bean you're using so
>> that i can have a quick look. You can skip any non-jbi related
>> processing...
>>
>> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > No, I'm just simply using the deliverychannel to send out, which is
>> > mentioned in the servicemix docs as something that you can do.  I assume
>> > that means it's recommended :)  I did see that I can inject a
>> > ComponentContext and so I'm currently changing my outbound messages to
>> that
>> > to see if I can get around this problem.  I think I just can't use the
>> > DeliveryContext in the same Pojo (same thread).
>> >
>> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> The NPE in the PojoChannel.send() method means that the
>> >> currentRequest.get() is null.
>> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> should try to remove that, as the component is already able to handle
>> >> concurrent requests.
>> >>
>> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>> bad
>> >> for
>> >> > me and has the same problem :(  It only seems to affect our production
>> >> > server and in a few minutes after start up, I start getting the
>> >> > NullPointerException.. slowly all my services start doing it and they
>> all
>> >> > stop working.  If I stop and restart servicemix, then servicemix-jms
>> >> > components are no longer routable.  I'm guessing this error causes
>> >> > Servicemix to shut them down and not deploy them anymore (Servicemix
>> does
>> >> > the same thing if a service unit starts up, tries to make a Joram
>> >> connection
>> >> > to a server that isn't up, servicemix will shutdown that SU and will
>> >> always
>> >> > shut it down immediately after it starts on any subsequent run).
>> >> >
>> >> > It seems like this problem must be related to a race condition.  When
>> >> doing
>> >> > development testing, I never see this problem on my laptop even under
>> >> high
>> >> > load.  One our fast test server, I see this error popup once on
>> startup
>> >> and
>> >> > then it doesn't seem to happen again.  On our even faster production
>> >> server,
>> >> > the whole thing looses it's wheels and falls apart after a few
>> minutes.
>> >> >
>> >> > I'm supposed to be deploying this system in a few days and of course
>> >> that's
>> >> > the only spot where I can't temporarily limp by.  Is it possible you
>> >> could
>> >> > give me some hints on what the problem is and I'll debug it this
>> weekend
>> >> to
>> >> > see if I can fix it, or at least patch it temporarily?  I really need
>> to
>> >> > figure out way to get around this problem.  Other than that, 3.2.2
>> seems
>> >> to
>> >> > work perfectly fine.
>> >> >
>> >> > Here is the caused by error again in case it's any bit different than
>> the
>> >> > 3.2.1 one was:
>> >> >
>> >> > Caused by: java.lang.NullPointerException
>> >> >        at
>> >> > java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >        at
>> >> >
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >        at
>> >> >
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> > ionHandlerImpl.java:80)
>> >> >
>> >> > Also, is the delivery channel component threadsafe?  I'm curious if
>> >> multiple
>> >> > threads accessing it is a problem or if I should keep access to it
>> >> > synchronized?  I'm currently synchronizing, but don't want to if I
>> don't
>> >> > need to.
>> >> >
>> >> > Thanks!
>> >> > Ryan
>> >> >
>> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <bruce.snyder@gmail.com
>> >
>> >> > wrote:
>> >> >
>> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fragility2.0@gmail.com
>> >
>> >> >> wrote:
>> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind
>> of
>> >> >> waiting
>> >> >> > until it was released, but this problem is now cropping up on a
>> >> regular
>> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
>> this
>> >> will
>> >> >> > allow me to get this project done so I can then get that Joram
>> write
>> >> up
>> >> >> done
>> >> >> > since I should have ran across hopefully most of the gotchas for it
>> at
>> >> >> that
>> >> >> > point.
>> >> >>
>> >> >> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>> >> >> we can release it this weekend.
>> >> >>
>> >> >> Bruce
>> >> >> --
>> >> >> perl -e 'print
>> >> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> );'
>> >> >>
>> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >>
>> >> >> Blog: http://bruceblog.org/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Ahhh, wait.. you know what?  You got me thinking on your correction of my
original theory.. I have one spot that my assumption should prove true.. and
I think this might explain a few things as well... I'm actually using the
DeliveryChannel to send in TWO spots on the bean.. so it's possible that in
those two spots, two different threads are using that same deliverychannel
and clobbering each other.. and may be why I see the deadlocks sometimes..
so maybe I just need to synchronize on the deliverychannel when sending in
each of those two spots... that almost has to be it.... using the servicemix
client really exploded, probably for the same reasons....  hopefully that
is.. to some extent it seems like the threadlocal should prevent that, but
dunno.. something weird is happening either way with it.

On Mon, Jun 23, 2008 at 3:31 AM, Ryan Moquin <fr...@gmail.com> wrote:

> Sure, I backed out the changes in my editor.. basically my bean is standard
> compared to the servicemix docs (for how to handle the exchange coming in),
> then my bean takes the injected deliverychannel and hands it to a class that
> creates a message to send out with results of some analysis performed.. here
> is the code to send out (it's using the DeliveryChannel injected into the
> bean by Servicemix):
>
> Marshaller notificationMarshaller = jaxbContext.createMarshaller();
>       notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> Boolean.TRUE);
>       notificationMarshaller.marshal(notification, writer);
>       if (destinationQname == null) {
>         destinationQname = new QName(getDestinationNamespace(),
> getDestinationService());
>       }
>       MessageExchangeFactory exchangeFactory =
> deliveryChannel.createExchangeFactory();
>       InOnly exchange = exchangeFactory.createInOnlyExchange();
>       NormalizedMessage message = exchange.createMessage();
>       message.setContent(new StringSource(writer.toString()));
>       exchange.setInMessage(message);
>       exchange.setService(destinationQname);
>       deliveryChannel.send(exchange);
>
> The send is where the ConcurrentHashmap complains about an NPE .. I think
> because the BeanComponent sets the CurrentRequest to null around the time my
> code is trying to send a request that must get clobbered?  There's no other
> explanation for it.. it looks like the NPE is caused by
> currentRequest.get(), which is set back to null by the BeanComponent and
> since they are in the same thread.... they interfere.
>
> Ryan
>
>
> On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> Is there any way you could paste the code of the bean you're using so
>> that i can have a quick look. You can skip any non-jbi related
>> processing...
>>
>> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > No, I'm just simply using the deliverychannel to send out, which is
>> > mentioned in the servicemix docs as something that you can do.  I assume
>> > that means it's recommended :)  I did see that I can inject a
>> > ComponentContext and so I'm currently changing my outbound messages to
>> that
>> > to see if I can get around this problem.  I think I just can't use the
>> > DeliveryContext in the same Pojo (same thread).
>> >
>> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
>> wrote:
>> >
>> >> The NPE in the PojoChannel.send() method means that the
>> >> currentRequest.get() is null.
>> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> should try to remove that, as the component is already able to handle
>> >> concurrent requests.
>> >>
>> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>> bad
>> >> for
>> >> > me and has the same problem :(  It only seems to affect our
>> production
>> >> > server and in a few minutes after start up, I start getting the
>> >> > NullPointerException.. slowly all my services start doing it and they
>> all
>> >> > stop working.  If I stop and restart servicemix, then servicemix-jms
>> >> > components are no longer routable.  I'm guessing this error causes
>> >> > Servicemix to shut them down and not deploy them anymore (Servicemix
>> does
>> >> > the same thing if a service unit starts up, tries to make a Joram
>> >> connection
>> >> > to a server that isn't up, servicemix will shutdown that SU and will
>> >> always
>> >> > shut it down immediately after it starts on any subsequent run).
>> >> >
>> >> > It seems like this problem must be related to a race condition.  When
>> >> doing
>> >> > development testing, I never see this problem on my laptop even under
>> >> high
>> >> > load.  One our fast test server, I see this error popup once on
>> startup
>> >> and
>> >> > then it doesn't seem to happen again.  On our even faster production
>> >> server,
>> >> > the whole thing looses it's wheels and falls apart after a few
>> minutes.
>> >> >
>> >> > I'm supposed to be deploying this system in a few days and of course
>> >> that's
>> >> > the only spot where I can't temporarily limp by.  Is it possible you
>> >> could
>> >> > give me some hints on what the problem is and I'll debug it this
>> weekend
>> >> to
>> >> > see if I can fix it, or at least patch it temporarily?  I really need
>> to
>> >> > figure out way to get around this problem.  Other than that, 3.2.2
>> seems
>> >> to
>> >> > work perfectly fine.
>> >> >
>> >> > Here is the caused by error again in case it's any bit different than
>> the
>> >> > 3.2.1 one was:
>> >> >
>> >> > Caused by: java.lang.NullPointerException
>> >> >        at
>> >> >
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> >        at
>> >> >
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> >        at
>> >> >
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> > ionHandlerImpl.java:80)
>> >> >
>> >> > Also, is the delivery channel component threadsafe?  I'm curious if
>> >> multiple
>> >> > threads accessing it is a problem or if I should keep access to it
>> >> > synchronized?  I'm currently synchronizing, but don't want to if I
>> don't
>> >> > need to.
>> >> >
>> >> > Thanks!
>> >> > Ryan
>> >> >
>> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> bruce.snyder@gmail.com>
>> >> > wrote:
>> >> >
>> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> fragility2.0@gmail.com>
>> >> >> wrote:
>> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind
>> of
>> >> >> waiting
>> >> >> > until it was released, but this problem is now cropping up on a
>> >> regular
>> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
>> this
>> >> will
>> >> >> > allow me to get this project done so I can then get that Joram
>> write
>> >> up
>> >> >> done
>> >> >> > since I should have ran across hopefully most of the gotchas for
>> it at
>> >> >> that
>> >> >> > point.
>> >> >>
>> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
>> Maybe
>> >> >> we can release it this weekend.
>> >> >>
>> >> >> Bruce
>> >> >> --
>> >> >> perl -e 'print
>> >> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> );'
>> >> >>
>> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >>
>> >> >> Blog: http://bruceblog.org/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>
>

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
Sure, I backed out the changes in my editor.. basically my bean is standard
compared to the servicemix docs (for how to handle the exchange coming in),
then my bean takes the injected deliverychannel and hands it to a class that
creates a message to send out with results of some analysis performed.. here
is the code to send out (it's using the DeliveryChannel injected into the
bean by Servicemix):

Marshaller notificationMarshaller = jaxbContext.createMarshaller();
      notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.TRUE);
      notificationMarshaller.marshal(notification, writer);
      if (destinationQname == null) {
        destinationQname = new QName(getDestinationNamespace(),
getDestinationService());
      }
      MessageExchangeFactory exchangeFactory =
deliveryChannel.createExchangeFactory();
      InOnly exchange = exchangeFactory.createInOnlyExchange();
      NormalizedMessage message = exchange.createMessage();
      message.setContent(new StringSource(writer.toString()));
      exchange.setInMessage(message);
      exchange.setService(destinationQname);
      deliveryChannel.send(exchange);

The send is where the ConcurrentHashmap complains about an NPE .. I think
because the BeanComponent sets the CurrentRequest to null around the time my
code is trying to send a request that must get clobbered?  There's no other
explanation for it.. it looks like the NPE is caused by
currentRequest.get(), which is set back to null by the BeanComponent and
since they are in the same thread.... they interfere.

Ryan

On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> Is there any way you could paste the code of the bean you're using so
> that i can have a quick look. You can skip any non-jbi related
> processing...
>
> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > No, I'm just simply using the deliverychannel to send out, which is
> > mentioned in the servicemix docs as something that you can do.  I assume
> > that means it's recommended :)  I did see that I can inject a
> > ComponentContext and so I'm currently changing my outbound messages to
> that
> > to see if I can get around this problem.  I think I just can't use the
> > DeliveryContext in the same Pojo (same thread).
> >
> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com>
> wrote:
> >
> >> The NPE in the PojoChannel.send() method means that the
> >> currentRequest.get() is null.
> >> Do you perform any threading operation in the pojo ? If yes, you
> >> should try to remove that, as the component is already able to handle
> >> concurrent requests.
> >>
> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
> bad
> >> for
> >> > me and has the same problem :(  It only seems to affect our production
> >> > server and in a few minutes after start up, I start getting the
> >> > NullPointerException.. slowly all my services start doing it and they
> all
> >> > stop working.  If I stop and restart servicemix, then servicemix-jms
> >> > components are no longer routable.  I'm guessing this error causes
> >> > Servicemix to shut them down and not deploy them anymore (Servicemix
> does
> >> > the same thing if a service unit starts up, tries to make a Joram
> >> connection
> >> > to a server that isn't up, servicemix will shutdown that SU and will
> >> always
> >> > shut it down immediately after it starts on any subsequent run).
> >> >
> >> > It seems like this problem must be related to a race condition.  When
> >> doing
> >> > development testing, I never see this problem on my laptop even under
> >> high
> >> > load.  One our fast test server, I see this error popup once on
> startup
> >> and
> >> > then it doesn't seem to happen again.  On our even faster production
> >> server,
> >> > the whole thing looses it's wheels and falls apart after a few
> minutes.
> >> >
> >> > I'm supposed to be deploying this system in a few days and of course
> >> that's
> >> > the only spot where I can't temporarily limp by.  Is it possible you
> >> could
> >> > give me some hints on what the problem is and I'll debug it this
> weekend
> >> to
> >> > see if I can fix it, or at least patch it temporarily?  I really need
> to
> >> > figure out way to get around this problem.  Other than that, 3.2.2
> seems
> >> to
> >> > work perfectly fine.
> >> >
> >> > Here is the caused by error again in case it's any bit different than
> the
> >> > 3.2.1 one was:
> >> >
> >> > Caused by: java.lang.NullPointerException
> >> >        at
> >> > java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >> >        at
> >> >
> >>
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >> >        at
> >> >
> >>
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> >> > ionHandlerImpl.java:80)
> >> >
> >> > Also, is the delivery channel component threadsafe?  I'm curious if
> >> multiple
> >> > threads accessing it is a problem or if I should keep access to it
> >> > synchronized?  I'm currently synchronizing, but don't want to if I
> don't
> >> > need to.
> >> >
> >> > Thanks!
> >> > Ryan
> >> >
> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <bruce.snyder@gmail.com
> >
> >> > wrote:
> >> >
> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fragility2.0@gmail.com
> >
> >> >> wrote:
> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind
> of
> >> >> waiting
> >> >> > until it was released, but this problem is now cropping up on a
> >> regular
> >> >> > basis on a server so I'll definitely give it a shot.  Hopefully
> this
> >> will
> >> >> > allow me to get this project done so I can then get that Joram
> write
> >> up
> >> >> done
> >> >> > since I should have ran across hopefully most of the gotchas for it
> at
> >> >> that
> >> >> > point.
> >> >>
> >> >> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
> >> >> we can release it this weekend.
> >> >>
> >> >> Bruce
> >> >> --
> >> >> perl -e 'print
> >> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> >> );'
> >> >>
> >> >> Apache ActiveMQ - http://activemq.org/
> >> >> Apache Camel - http://activemq.org/camel/
> >> >> Apache ServiceMix - http://servicemix.org/
> >> >>
> >> >> Blog: http://bruceblog.org/
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
Is there any way you could paste the code of the bean you're using so
that i can have a quick look. You can skip any non-jbi related
processing...

On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <fr...@gmail.com> wrote:
> No, I'm just simply using the deliverychannel to send out, which is
> mentioned in the servicemix docs as something that you can do.  I assume
> that means it's recommended :)  I did see that I can inject a
> ComponentContext and so I'm currently changing my outbound messages to that
> to see if I can get around this problem.  I think I just can't use the
> DeliveryContext in the same Pojo (same thread).
>
> On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com> wrote:
>
>> The NPE in the PojoChannel.send() method means that the
>> currentRequest.get() is null.
>> Do you perform any threading operation in the pojo ? If yes, you
>> should try to remove that, as the component is already able to handle
>> concurrent requests.
>>
>> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad
>> for
>> > me and has the same problem :(  It only seems to affect our production
>> > server and in a few minutes after start up, I start getting the
>> > NullPointerException.. slowly all my services start doing it and they all
>> > stop working.  If I stop and restart servicemix, then servicemix-jms
>> > components are no longer routable.  I'm guessing this error causes
>> > Servicemix to shut them down and not deploy them anymore (Servicemix does
>> > the same thing if a service unit starts up, tries to make a Joram
>> connection
>> > to a server that isn't up, servicemix will shutdown that SU and will
>> always
>> > shut it down immediately after it starts on any subsequent run).
>> >
>> > It seems like this problem must be related to a race condition.  When
>> doing
>> > development testing, I never see this problem on my laptop even under
>> high
>> > load.  One our fast test server, I see this error popup once on startup
>> and
>> > then it doesn't seem to happen again.  On our even faster production
>> server,
>> > the whole thing looses it's wheels and falls apart after a few minutes.
>> >
>> > I'm supposed to be deploying this system in a few days and of course
>> that's
>> > the only spot where I can't temporarily limp by.  Is it possible you
>> could
>> > give me some hints on what the problem is and I'll debug it this weekend
>> to
>> > see if I can fix it, or at least patch it temporarily?  I really need to
>> > figure out way to get around this problem.  Other than that, 3.2.2 seems
>> to
>> > work perfectly fine.
>> >
>> > Here is the caused by error again in case it's any bit different than the
>> > 3.2.1 one was:
>> >
>> > Caused by: java.lang.NullPointerException
>> >        at
>> > java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >        at
>> >
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >        at
>> >
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> > ionHandlerImpl.java:80)
>> >
>> > Also, is the delivery channel component threadsafe?  I'm curious if
>> multiple
>> > threads accessing it is a problem or if I should keep access to it
>> > synchronized?  I'm currently synchronizing, but don't want to if I don't
>> > need to.
>> >
>> > Thanks!
>> > Ryan
>> >
>> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
>> > wrote:
>> >
>> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>> >> wrote:
>> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>> >> waiting
>> >> > until it was released, but this problem is now cropping up on a
>> regular
>> >> > basis on a server so I'll definitely give it a shot.  Hopefully this
>> will
>> >> > allow me to get this project done so I can then get that Joram write
>> up
>> >> done
>> >> > since I should have ran across hopefully most of the gotchas for it at
>> >> that
>> >> > point.
>> >>
>> >> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>> >> we can release it this weekend.
>> >>
>> >> Bruce
>> >> --
>> >> perl -e 'print
>> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> );'
>> >>
>> >> Apache ActiveMQ - http://activemq.org/
>> >> Apache Camel - http://activemq.org/camel/
>> >> Apache ServiceMix - http://servicemix.org/
>> >>
>> >> Blog: http://bruceblog.org/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
No, I'm just simply using the deliverychannel to send out, which is
mentioned in the servicemix docs as something that you can do.  I assume
that means it's recommended :)  I did see that I can inject a
ComponentContext and so I'm currently changing my outbound messages to that
to see if I can get around this problem.  I think I just can't use the
DeliveryContext in the same Pojo (same thread).

On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> The NPE in the PojoChannel.send() method means that the
> currentRequest.get() is null.
> Do you perform any threading operation in the pojo ? If yes, you
> should try to remove that, as the component is already able to handle
> concurrent requests.
>
> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad
> for
> > me and has the same problem :(  It only seems to affect our production
> > server and in a few minutes after start up, I start getting the
> > NullPointerException.. slowly all my services start doing it and they all
> > stop working.  If I stop and restart servicemix, then servicemix-jms
> > components are no longer routable.  I'm guessing this error causes
> > Servicemix to shut them down and not deploy them anymore (Servicemix does
> > the same thing if a service unit starts up, tries to make a Joram
> connection
> > to a server that isn't up, servicemix will shutdown that SU and will
> always
> > shut it down immediately after it starts on any subsequent run).
> >
> > It seems like this problem must be related to a race condition.  When
> doing
> > development testing, I never see this problem on my laptop even under
> high
> > load.  One our fast test server, I see this error popup once on startup
> and
> > then it doesn't seem to happen again.  On our even faster production
> server,
> > the whole thing looses it's wheels and falls apart after a few minutes.
> >
> > I'm supposed to be deploying this system in a few days and of course
> that's
> > the only spot where I can't temporarily limp by.  Is it possible you
> could
> > give me some hints on what the problem is and I'll debug it this weekend
> to
> > see if I can fix it, or at least patch it temporarily?  I really need to
> > figure out way to get around this problem.  Other than that, 3.2.2 seems
> to
> > work perfectly fine.
> >
> > Here is the caused by error again in case it's any bit different than the
> > 3.2.1 one was:
> >
> > Caused by: java.lang.NullPointerException
> >        at
> > java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
> >        at
> >
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
> >        at
> >
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> > ionHandlerImpl.java:80)
> >
> > Also, is the delivery channel component threadsafe?  I'm curious if
> multiple
> > threads accessing it is a problem or if I should keep access to it
> > synchronized?  I'm currently synchronizing, but don't want to if I don't
> > need to.
> >
> > Thanks!
> > Ryan
> >
> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
> > wrote:
> >
> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
> >> wrote:
> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
> >> waiting
> >> > until it was released, but this problem is now cropping up on a
> regular
> >> > basis on a server so I'll definitely give it a shot.  Hopefully this
> will
> >> > allow me to get this project done so I can then get that Joram write
> up
> >> done
> >> > since I should have ran across hopefully most of the gotchas for it at
> >> that
> >> > point.
> >>
> >> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
> >> we can release it this weekend.
> >>
> >> Bruce
> >> --
> >> perl -e 'print
> >> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> >> );'
> >>
> >> Apache ActiveMQ - http://activemq.org/
> >> Apache Camel - http://activemq.org/camel/
> >> Apache ServiceMix - http://servicemix.org/
> >>
> >> Blog: http://bruceblog.org/
> >>
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>

Re: NPE errors in DeliveryChannel

Posted by Guillaume Nodet <gn...@gmail.com>.
The NPE in the PojoChannel.send() method means that the
currentRequest.get() is null.
Do you perform any threading operation in the pojo ? If yes, you
should try to remove that, as the component is already able to handle
concurrent requests.

On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <fr...@gmail.com> wrote:
> I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad for
> me and has the same problem :(  It only seems to affect our production
> server and in a few minutes after start up, I start getting the
> NullPointerException.. slowly all my services start doing it and they all
> stop working.  If I stop and restart servicemix, then servicemix-jms
> components are no longer routable.  I'm guessing this error causes
> Servicemix to shut them down and not deploy them anymore (Servicemix does
> the same thing if a service unit starts up, tries to make a Joram connection
> to a server that isn't up, servicemix will shutdown that SU and will always
> shut it down immediately after it starts on any subsequent run).
>
> It seems like this problem must be related to a race condition.  When doing
> development testing, I never see this problem on my laptop even under high
> load.  One our fast test server, I see this error popup once on startup and
> then it doesn't seem to happen again.  On our even faster production server,
> the whole thing looses it's wheels and falls apart after a few minutes.
>
> I'm supposed to be deploying this system in a few days and of course that's
> the only spot where I can't temporarily limp by.  Is it possible you could
> give me some hints on what the problem is and I'll debug it this weekend to
> see if I can fix it, or at least patch it temporarily?  I really need to
> figure out way to get around this problem.  Other than that, 3.2.2 seems to
> work perfectly fine.
>
> Here is the caused by error again in case it's any bit different than the
> 3.2.1 one was:
>
> Caused by: java.lang.NullPointerException
>        at
> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>        at
> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>        at
> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
> ionHandlerImpl.java:80)
>
> Also, is the delivery channel component threadsafe?  I'm curious if multiple
> threads accessing it is a problem or if I should keep access to it
> synchronized?  I'm currently synchronizing, but don't want to if I don't
> need to.
>
> Thanks!
> Ryan
>
> On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
> wrote:
>
>> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
>> waiting
>> > until it was released, but this problem is now cropping up on a regular
>> > basis on a server so I'll definitely give it a shot.  Hopefully this will
>> > allow me to get this project done so I can then get that Joram write up
>> done
>> > since I should have ran across hopefully most of the gotchas for it at
>> that
>> > point.
>>
>> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
>> we can release it this weekend.
>>
>> Bruce
>> --
>> perl -e 'print
>> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>>
>> Apache ActiveMQ - http://activemq.org/
>> Apache Camel - http://activemq.org/camel/
>> Apache ServiceMix - http://servicemix.org/
>>
>> Blog: http://bruceblog.org/
>>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
I hate to say this Bruce, but unfortunately 3.2.2 is working pretty bad for
me and has the same problem :(  It only seems to affect our production
server and in a few minutes after start up, I start getting the
NullPointerException.. slowly all my services start doing it and they all
stop working.  If I stop and restart servicemix, then servicemix-jms
components are no longer routable.  I'm guessing this error causes
Servicemix to shut them down and not deploy them anymore (Servicemix does
the same thing if a service unit starts up, tries to make a Joram connection
to a server that isn't up, servicemix will shutdown that SU and will always
shut it down immediately after it starts on any subsequent run).

It seems like this problem must be related to a race condition.  When doing
development testing, I never see this problem on my laptop even under high
load.  One our fast test server, I see this error popup once on startup and
then it doesn't seem to happen again.  On our even faster production server,
the whole thing looses it's wheels and falls apart after a few minutes.

I'm supposed to be deploying this system in a few days and of course that's
the only spot where I can't temporarily limp by.  Is it possible you could
give me some hints on what the problem is and I'll debug it this weekend to
see if I can fix it, or at least patch it temporarily?  I really need to
figure out way to get around this problem.  Other than that, 3.2.2 seems to
work perfectly fine.

Here is the caused by error again in case it's any bit different than the
3.2.1 one was:

Caused by: java.lang.NullPointerException
        at
java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
        at
org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
        at
com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
ionHandlerImpl.java:80)

Also, is the delivery channel component threadsafe?  I'm curious if multiple
threads accessing it is a problem or if I should keep access to it
synchronized?  I'm currently synchronizing, but don't want to if I don't
need to.

Thanks!
Ryan

On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <br...@gmail.com>
wrote:

> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of
> waiting
> > until it was released, but this problem is now cropping up on a regular
> > basis on a server so I'll definitely give it a shot.  Hopefully this will
> > allow me to get this project done so I can then get that Joram write up
> done
> > since I should have ran across hopefully most of the gotchas for it at
> that
> > point.
>
> 3.2.2 will be released very soon and I know it's pretty stable. Maybe
> we can release it this weekend.
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
>
> Blog: http://bruceblog.org/
>

Re: NPE errors in DeliveryChannel

Posted by Bruce Snyder <br...@gmail.com>.
On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <fr...@gmail.com> wrote:
> I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of waiting
> until it was released, but this problem is now cropping up on a regular
> basis on a server so I'll definitely give it a shot.  Hopefully this will
> allow me to get this project done so I can then get that Joram write up done
> since I should have ran across hopefully most of the gotchas for it at that
> point.

3.2.2 will be released very soon and I know it's pretty stable. Maybe
we can release it this weekend.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: NPE errors in DeliveryChannel

Posted by Ryan Moquin <fr...@gmail.com>.
I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try.  I was kind of waiting
until it was released, but this problem is now cropping up on a regular
basis on a server so I'll definitely give it a shot.  Hopefully this will
allow me to get this project done so I can then get that Joram write up done
since I should have ran across hopefully most of the gotchas for it at that
point.

Thanks!

On Tue, Jun 17, 2008 at 11:06 AM, Bruce Snyder <br...@gmail.com>
wrote:

> On Fri, Jun 13, 2008 at 2:23 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
> > Out of curiosity.. is it possible for the quartz component in servicemix
> to
> > "start up too quickly" and fire off a message to a service before it's
> > ready?  I've been seeing errors like this a lot more during start up and
> I'm
> > not sure why.. but it always seems to be related to the delivery channel:
> >
> > WARN  - DeliveryChannelImpl            - Error calling listener: null
> > java.lang.NullPointerException
> >        at
> >
> org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
> >        at
> >
> org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
> >        at
> >
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> >        at java.lang.Thread.run(Thread.java:595)
> > WARN  - DeliveryChannelImpl            - Error calling listener: null
> > java.lang.NullPointerException
> >        at
> >
> org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
> >        at
> >
> org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
> >        at
> >
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> >        at java.lang.Thread.run(Thread.java:595)
> >
> > Another one is:
> >
> > ERROR - BeanComponent                  - Error processing exchange
> InOnly[
> >  id: ID:192.168.1.2-11a83961a1c-9:1
> >  status: Active
> >  role: provider
> >  service: {urn://myservice}notification-service
> >  endpoint: endpoint
> >  in: <?xml version="1.0"
> >
> encoding="UTF-8"?><timer><name>{urn://myservice}service-invoker:endpoint</name><group>DEFAULT</group><fullname>DEFAULT.{urn://myservice}service-
> > invoker:endpoint</fullname><description/><fireTime>Fri Jun 13 16:21:13
> EDT
> > 2008</fireTime></timer>
> > ]
> > java.lang.NullPointerException
> >        at
> >
> org.apache.servicemix.bean.BeanEndpoint.getCorrelationExpression(BeanEndpoint.java:421)
> >        at
> >
> org.apache.servicemix.bean.BeanEndpoint.getCorrelation(BeanEndpoint.java:298)
> >        at
> >
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:218)
> >        at
> > org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
> >        at
> >
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
> >        at
> >
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
> >        at
> >
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
> >        at
> >
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> >        at
> >
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> >        at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> >        at java.lang.Thread.run(Thread.java:595)
> >
> > Any ideas?
>
> What version of SMX are you using? There's a fix for this sort of
> thing in 3.2.2, is it possible that you could try that and see if it
> clears up the problem?
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
>
> Blog: http://bruceblog.org/
>

Re: NPE errors in DeliveryChannel

Posted by Bruce Snyder <br...@gmail.com>.
On Fri, Jun 13, 2008 at 2:23 PM, Ryan Moquin <fr...@gmail.com> wrote:
> Out of curiosity.. is it possible for the quartz component in servicemix to
> "start up too quickly" and fire off a message to a service before it's
> ready?  I've been seeing errors like this a lot more during start up and I'm
> not sure why.. but it always seems to be related to the delivery channel:
>
> WARN  - DeliveryChannelImpl            - Error calling listener: null
> java.lang.NullPointerException
>        at
> org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
>        at
> org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
> WARN  - DeliveryChannelImpl            - Error calling listener: null
> java.lang.NullPointerException
>        at
> org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAccepted(StatisticsService.java:307)
>        at
> org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAccepted(StatisticsService.java:186)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:598)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
> Another one is:
>
> ERROR - BeanComponent                  - Error processing exchange InOnly[
>  id: ID:192.168.1.2-11a83961a1c-9:1
>  status: Active
>  role: provider
>  service: {urn://myservice}notification-service
>  endpoint: endpoint
>  in: <?xml version="1.0"
> encoding="UTF-8"?><timer><name>{urn://myservice}service-invoker:endpoint</name><group>DEFAULT</group><fullname>DEFAULT.{urn://myservice}service-
> invoker:endpoint</fullname><description/><fireTime>Fri Jun 13 16:21:13 EDT
> 2008</fireTime></timer>
> ]
> java.lang.NullPointerException
>        at
> org.apache.servicemix.bean.BeanEndpoint.getCorrelationExpression(BeanEndpoint.java:421)
>        at
> org.apache.servicemix.bean.BeanEndpoint.getCorrelation(BeanEndpoint.java:298)
>        at
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:218)
>        at
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>        at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>        at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>        at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>        at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
> Any ideas?

What version of SMX are you using? There's a fix for this sort of
thing in 3.2.2, is it possible that you could try that and see if it
clears up the problem?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/