You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Marko Asplund <ma...@gmail.com> on 2017/08/23 06:29:40 UTC

Artemis v2.2: ActiveMQIllegalStateException with core API

Hi,

I'm getting occasional ActiveMQIllegalStateException in Artemis server log.
Artemis has been deployed in a single instance setup and I'm connecting
using the core API. I've a single queue with one producer and 10 consumers.
The messages can be rather large but the volume has been quite low.
Here's a log extract:

13:51:37,340 ERROR [org.apache.activemq.artemis.core.server] AMQ224016:
Caught exception: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE
message=AMQ119027: Could not find reference on consumer ID=0, messageId =
1,535 queue = foo.bar.requests]
        at
org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.acknowledge(ServerConsumerImpl.java:850)
[artemis-server-2.2.0.jar:2.2.0]
        at
org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.acknowledge(ServerSessionImpl.java:773)
[artemis-server-2.2.0.jar:2.2.0]
        at
org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.onSessionAcknowledge(ServerSessionPacketHandler.java:629)
[artemis-server-2.2.0.jar:2.2.0]
        at
org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.onMessagePacket(ServerSessionPacketHandler.java:267)
[artemis-server-2.2.0.jar:2.2.0]
        at
org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:33)
[artemis-commons-2.2.0.jar:2.2.0]
...

Any ideas on what could be causing this?


Artemis has been deployed on Ubuntu 16.04 server and running with Oracle
Java 8.

The code is demonstrated in a sample here:
https://gist.github.com/marko-asplund/983300e4bec59f53a13bc0d319a506f6


marko

Re: Artemis v2.2: ActiveMQIllegalStateException with core API

Posted by Clebert Suconic <cl...@gmail.com>.
A session is supposed to be the contract of a thread.  Aren't you using the
same season between producer and consumer and calling commit on both ends ?

On Wed, Aug 23, 2017 at 4:05 PM Justin Bertram <jb...@redhat.com> wrote:

> So I just looked at the code again and I totally missed the Thread.sleep()
> in consumeMessage() which nullifies my previous theory.
>
>
> Justin
>
> On Wed, Aug 23, 2017 at 3:02 PM, Justin Bertram <jb...@redhat.com>
> wrote:
>
> > Your code may be inducing a race condition.  Your consumeMessage() method
> > is creating a session, setting a MessageListener, starting the session,
> and
> > then closing the session immediately.  Meanwhile another thread is likely
> > invoking your MessageListener's onMessage and attempting to acknowledge
> the
> > message (on the session which was just closed).  The broker might should
> > handle this situation more elegantly, but this looks like a bug in your
> > code.  I'm not a Scala expert so correct me if I'm wrong.
> >
> >
> > Justin
> >
> > On Wed, Aug 23, 2017 at 1:29 AM, Marko Asplund <ma...@gmail.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I'm getting occasional ActiveMQIllegalStateException in Artemis server
> >> log.
> >> Artemis has been deployed in a single instance setup and I'm connecting
> >> using the core API. I've a single queue with one producer and 10
> >> consumers.
> >> The messages can be rather large but the volume has been quite low.
> >> Here's a log extract:
> >>
> >> 13:51:37,340 ERROR [org.apache.activemq.artemis.core.server] AMQ224016:
> >> Caught exception: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE
> >> message=AMQ119027: Could not find reference on consumer ID=0, messageId
> =
> >> 1,535 queue = foo.bar.requests]
> >>         at
> >> org.apache.activemq.artemis.core.server.impl.ServerConsumerI
> >> mpl.acknowledge(ServerConsumerImpl.java:850)
> >> [artemis-server-2.2.0.jar:2.2.0]
> >>         at
> >> org.apache.activemq.artemis.core.server.impl.ServerSessionIm
> >> pl.acknowledge(ServerSessionImpl.java:773)
> >> [artemis-server-2.2.0.jar:2.2.0]
> >>         at
> >> org.apache.activemq.artemis.core.protocol.core.ServerSession
> >> PacketHandler.onSessionAcknowledge(ServerSessionPacketHandler.java:629)
> >> [artemis-server-2.2.0.jar:2.2.0]
> >>         at
> >> org.apache.activemq.artemis.core.protocol.core.ServerSession
> >> PacketHandler.onMessagePacket(ServerSessionPacketHandler.java:267)
> >> [artemis-server-2.2.0.jar:2.2.0]
> >>         at
> >> org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:33)
> >> [artemis-commons-2.2.0.jar:2.2.0]
> >> ...
> >>
> >> Any ideas on what could be causing this?
> >>
> >>
> >> Artemis has been deployed on Ubuntu 16.04 server and running with Oracle
> >> Java 8.
> >>
> >> The code is demonstrated in a sample here:
> >> https://gist.github.com/marko-asplund/983300e4bec59f53a13bc0d319a506f6
> >>
> >>
> >> marko
> >>
> >
> >
>
-- 
Clebert Suconic

Re: Artemis v2.2: ActiveMQIllegalStateException with core API

Posted by Justin Bertram <jb...@redhat.com>.
So I just looked at the code again and I totally missed the Thread.sleep()
in consumeMessage() which nullifies my previous theory.


Justin

On Wed, Aug 23, 2017 at 3:02 PM, Justin Bertram <jb...@redhat.com> wrote:

> Your code may be inducing a race condition.  Your consumeMessage() method
> is creating a session, setting a MessageListener, starting the session, and
> then closing the session immediately.  Meanwhile another thread is likely
> invoking your MessageListener's onMessage and attempting to acknowledge the
> message (on the session which was just closed).  The broker might should
> handle this situation more elegantly, but this looks like a bug in your
> code.  I'm not a Scala expert so correct me if I'm wrong.
>
>
> Justin
>
> On Wed, Aug 23, 2017 at 1:29 AM, Marko Asplund <ma...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm getting occasional ActiveMQIllegalStateException in Artemis server
>> log.
>> Artemis has been deployed in a single instance setup and I'm connecting
>> using the core API. I've a single queue with one producer and 10
>> consumers.
>> The messages can be rather large but the volume has been quite low.
>> Here's a log extract:
>>
>> 13:51:37,340 ERROR [org.apache.activemq.artemis.core.server] AMQ224016:
>> Caught exception: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE
>> message=AMQ119027: Could not find reference on consumer ID=0, messageId =
>> 1,535 queue = foo.bar.requests]
>>         at
>> org.apache.activemq.artemis.core.server.impl.ServerConsumerI
>> mpl.acknowledge(ServerConsumerImpl.java:850)
>> [artemis-server-2.2.0.jar:2.2.0]
>>         at
>> org.apache.activemq.artemis.core.server.impl.ServerSessionIm
>> pl.acknowledge(ServerSessionImpl.java:773)
>> [artemis-server-2.2.0.jar:2.2.0]
>>         at
>> org.apache.activemq.artemis.core.protocol.core.ServerSession
>> PacketHandler.onSessionAcknowledge(ServerSessionPacketHandler.java:629)
>> [artemis-server-2.2.0.jar:2.2.0]
>>         at
>> org.apache.activemq.artemis.core.protocol.core.ServerSession
>> PacketHandler.onMessagePacket(ServerSessionPacketHandler.java:267)
>> [artemis-server-2.2.0.jar:2.2.0]
>>         at
>> org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:33)
>> [artemis-commons-2.2.0.jar:2.2.0]
>> ...
>>
>> Any ideas on what could be causing this?
>>
>>
>> Artemis has been deployed on Ubuntu 16.04 server and running with Oracle
>> Java 8.
>>
>> The code is demonstrated in a sample here:
>> https://gist.github.com/marko-asplund/983300e4bec59f53a13bc0d319a506f6
>>
>>
>> marko
>>
>
>

Re: Artemis v2.2: ActiveMQIllegalStateException with core API

Posted by Justin Bertram <jb...@redhat.com>.
Your code may be inducing a race condition.  Your consumeMessage() method
is creating a session, setting a MessageListener, starting the session, and
then closing the session immediately.  Meanwhile another thread is likely
invoking your MessageListener's onMessage and attempting to acknowledge the
message (on the session which was just closed).  The broker might should
handle this situation more elegantly, but this looks like a bug in your
code.  I'm not a Scala expert so correct me if I'm wrong.


Justin

On Wed, Aug 23, 2017 at 1:29 AM, Marko Asplund <ma...@gmail.com>
wrote:

> Hi,
>
> I'm getting occasional ActiveMQIllegalStateException in Artemis server log.
> Artemis has been deployed in a single instance setup and I'm connecting
> using the core API. I've a single queue with one producer and 10 consumers.
> The messages can be rather large but the volume has been quite low.
> Here's a log extract:
>
> 13:51:37,340 ERROR [org.apache.activemq.artemis.core.server] AMQ224016:
> Caught exception: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE
> message=AMQ119027: Could not find reference on consumer ID=0, messageId =
> 1,535 queue = foo.bar.requests]
>         at
> org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl.
> acknowledge(ServerConsumerImpl.java:850)
> [artemis-server-2.2.0.jar:2.2.0]
>         at
> org.apache.activemq.artemis.core.server.impl.
> ServerSessionImpl.acknowledge(ServerSessionImpl.java:773)
> [artemis-server-2.2.0.jar:2.2.0]
>         at
> org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.
> onSessionAcknowledge(ServerSessionPacketHandler.java:629)
> [artemis-server-2.2.0.jar:2.2.0]
>         at
> org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.
> onMessagePacket(ServerSessionPacketHandler.java:267)
> [artemis-server-2.2.0.jar:2.2.0]
>         at
> org.apache.activemq.artemis.utils.actors.Actor.doTask(Actor.java:33)
> [artemis-commons-2.2.0.jar:2.2.0]
> ...
>
> Any ideas on what could be causing this?
>
>
> Artemis has been deployed on Ubuntu 16.04 server and running with Oracle
> Java 8.
>
> The code is demonstrated in a sample here:
> https://gist.github.com/marko-asplund/983300e4bec59f53a13bc0d319a506f6
>
>
> marko
>