Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limitBehavior option REMOVE_OLDEST/REMOVE_LOWPRIORITY does not remove when reached limit #345

Open
glassfishrobot opened this issue Sep 12, 2013 · 7 comments

Comments

@glassfishrobot
Copy link

It seems that the behavior of this option is different between REJECT_NEWEST and REMOVE_OLDEST/REMOVE_LOWPRIORITY.

• Isssue
The behavior of limitBehavior is different between REJECT_NEWEST and REMOVE_OLDEST/REMOVE_LOWPRIORITY.

• Steps to reproduce issue
Compile sample program. Set CLASSPATH for glassfish\lib\gf-client.jar and compile the attached program.
Set Connection Factory and Destination in Glassfish.

Create physical destination for message broker as follows:

imqcmd create dst -t q -n JMSQueue -u admin -pw admin
imqcmd update dst -t q -n JMSQueue -o maxTotalMsgBytes=5k -u admin -pw admin -f

Setting maxTotalMsgBytes=5k sets limit on the storage in Physical destination.
After the above steps are executed, set limitBehavior option as follows:

oSetting REMOVE_OLDEST/REMOVE_LOW_PRIORITY
1.imqcmd update dst -t q -n JMSQueue -o limitBehavior=REMOVE_OLDEST -u admin -pw admin -f
or
imqcmd update dst -t q -n JMSQueue -o limitBehavior=REMOVE_LOW_PRIORITY -u admin -pw admin -f
2.Send 1KB data x 5 times.
3.Verify the above. imqcmd list dst
4.5 messages are stored.

oSetting REJECT_NEWEST
1.imqcmd update dst -t q -n JMSQueue -o limitBehavior=REJECT_NEWEST -u admin -pw admin -f
2.Send 1KB data x 5 times. *Error occurs at 5th send.
3.Verify the above. Imqcmd list dst
4.4 messages are stored.

Based on the above results,
For REJECT_NEWEST, new data is rejected if existing data size + new data size is larger than maxTotalMsgBytes.
On the other hand, for REMOVE_OLDEST/REMOVE_LOW_PRIORITY, data is stored if existing data size is smaller than maxTotalMsgBytes.

It is possible that 1KB message is sent x 4 times and 10MB is sent at 5th time when 5KB is limit. I have attached the sample program to reproduce the problem and the log file.

Environment

Glassfish 4.0, OpenMQ 5.0

Affected Versions

[4.1, 4.2, 4.3, 4.4, 4.4u1, 4.4u2, 4.5, 4.5.1, 4.5.2, 5.0-RI (JMS2.0), 5.0]

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by tak09

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
tak09 said:
== REJECT_NEWEST ==

imqbrokerd -remove instance -force

imqbrokerd

imqcmd create dst -t q -n JMSQueue -u admin -pw admin

imqcmd update dst -t q -n JMSQueue -o maxTotalMsgBytes=5k -u admin -pw admin -f

imqcmd update dst -t q -n JMSQueue -o limitBehavior=REJECT_NEWEST -u admin -pw admin -f

appclient removeoldest.Main 1 5

Sep 10, 2013 5:27:45 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 5.0.0.Final
Sep 10, 2013 5:27:46 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 5.0 (Build 14-e) Compile: April 12 2013 0104
Sep 10, 2013 5:27:46 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Sep 10, 2013 5:27:46 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
com.sun.messaging.jms.ResourceAllocationException: [C4096]: Destination is full and is rejecting new messages: JMSQueue user=guest, broker=l
ocalhost:7676(59994)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.checkWriteJMSMessageStatus(ProtocolHandler.java:2075)
at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writeJMSMessage(ProtocolHandler.java:2027)
at com.sun.messaging.jmq.jmsclient.WriteChannel.sendWithFlowControl(WriteChannel.java:171)
at com.sun.messaging.jmq.jmsclient.WriteChannel.writeJMSMessage(WriteChannel.java:123)
at com.sun.messaging.jmq.jmsclient.SessionImpl.writeJMSMessage(SessionImpl.java:970)
at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:239)
at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:216)
at com.sun.messaging.jmq.jmsclient.MessageProducerImpl._send(MessageProducerImpl.java:808)
at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.send(MessageProducerImpl.java:771)
at com.sun.messaging.jmq.jmsclient.QueueSenderImpl.send(QueueSenderImpl.java:128)
at removeoldest.Main.main(Main.java:48)

imqcmd list dst -u admin -pw admin
Warning [A2014]: Due to security implications the -pw command line option will
be removed in a future release of Message Queue. As a safer alternative
please use -passfile.

Listing all the destinations on the broker specified by:


Host Primary Port

localhost 7676


Name Type State Producers Consumers Msgs
Total Wildcard Total Wildcard Count Remote UnAck InDelay Avg Size

JMSQueue Queue RUNNING 0 - 0 - 4 0 0 0 1152.0
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0 0.0

Successfully listed destinations.

////////////////////////////////////////////////////////////////////////////////////////////////////

== REMOVE_LOW_PRIORITY ==

imqbrokerd -remove instance -force

imqbrokerd

imqcmd create dst -t q -n JMSQueue -u admin -pw admin

imqcmd update dst -t q -n JMSQueue -o maxTotalMsgBytes=5k -u admin -pw admin -f

imqcmd update dst -t q -n JMSQueue -o limitBehavior=REMOVE_LOW_PRIORITY -u admin -pw admin -f

appclient removeoldest.Main 1 5
Sep 10, 2013 5:38:17 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 5.0.0.Final
Sep 10, 2013 5:38:18 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 5.0 (Build 14-e) Compile: April 12 2013 0104
Sep 10, 2013 5:38:18 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Sep 10, 2013 5:38:18 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE

imqcmd list dst -u admin -pw admin
Warning [A2014]: Due to security implications the -pw command line option will
be removed in a future release of Message Queue. As a safer alternative
please use -passfile.

Listing all the destinations on the broker specified by:


Host Primary Port

localhost 7676


Name Type State Producers Consumers Msgs
Total Wildcard Total Wildcard Count Remote UnAck InDelay Avg Size

JMSQueue Queue RUNNING 0 - 0 - 5 0 0 0 1152.0
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0 0.0

Successfully listed destinations.

////////////////////////////////////////////////////////////////////////////////////////////////////

== REMOVE_OLDEST ==

imqbrokerd -remove instance -force

imqbrokerd

imqcmd create dst -t q -n JMSQueue -u admin -pw admin

imqcmd update dst -t q -n JMSQueue -o maxTotalMsgBytes=5k -u admin -pw admin -f

imqcmd update dst -t q -n JMSQueue -o limitBehavior=REMOVE_OLDEST -u admin -pw admin -f

appclient removeoldest.Main 1 5
Sep 10, 2013 5:46:11 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 5.0.0.Final
Sep 10, 2013 5:46:11 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 5.0 (Build 14-e) Compile: April 12 2013 0104
Sep 10, 2013 5:46:11 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Sep 10, 2013 5:46:11 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE

imqcmd list dst -u admin -pw admin
Warning [A2014]: Due to security implications the -pw command line option will
be removed in a future release of Message Queue. As a safer alternative
please use -passfile.

Listing all the destinations on the broker specified by:


Host Primary Port

localhost 7676


Name Type State Producers Consumers Msgs
Total Wildcard Total Wildcard Count Remote UnAck InDelay Avg Size

JMSQueue Queue RUNNING 0 - 0 - 5 0 0 0 1152.0
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0 0.0

Successfully listed destinations.

////////////////////////////////////////////////////////////////////////////////////////////////////

== Set REMOVE_OLDEST and send 10MB at fifth time ==

imqbrokerd -remove instance -force

imqbrokerd

imqcmd create dst -t q -n JMSQueue -u admin -pw admin

imqcmd update dst -t q -n JMSQueue -o maxTotalMsgBytes=5k -u admin -pw admin -f

imqcmd update dst -t q -n JMSQueue -o limitBehavior=REMOVE_OLDEST -u admin -pw admin -f

    • Send 1KB 4 times **

      appclient removeoldest.Main 1 4
      Sep 10, 2013 5:55:02 PM org.hibernate.validator.internal.util.Version
      INFO: HV000001: Hibernate Validator 5.0.0.Final
      Sep 10, 2013 5:55:03 PM com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 5.0 (Build 14-e) Compile: April 12 2013 0104
      Sep 10, 2013 5:55:03 PM com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
      Sep 10, 2013 5:55:03 PM com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE

imqcmd list dst -u admin -pw admin
Warning [A2014]: Due to security implications the -pw command line option will
be removed in a future release of Message Queue. As a safer alternative
please use -passfile.

Listing all the destinations on the broker specified by:


Host Primary Port

localhost 7676


Name Type State Producers Consumers Msgs
Total Wildcard Total Wildcard Count Remote UnAck InDelay Avg Size

JMSQueue Queue RUNNING 0 - 0 - 4 0 0 0 1152.0
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0 0.0

Successfully listed destinations.

    • Send 10MB (10000KB) 1 time ** No Error

appclient removeoldest.Main 10000 1
Sep 10, 2013 5:57:00 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator 5.0.0.Final
Sep 10, 2013 5:57:01 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version: 5.0 (Build 14-e) Compile: April 12 2013 0104
Sep 10, 2013 5:57:01 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Sep 10, 2013 5:57:01 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE

imqcmd list dst -u admin -pw admin
Warning [A2014]: Due to security implications the -pw command line option will
be removed in a future release of Message Queue. As a safer alternative
please use -passfile.

Listing all the destinations on the broker specified by:


Host Primary Port

localhost 7676


Name Type State Producers Consumers Msgs
Total Wildcard Total Wildcard Count Remote UnAck InDelay Avg Size

JMSQueue Queue RUNNING 0 - 0 - 5 0 0 0 2048947.2
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0 0.0

Successfully listed destinations.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
tak09 said:
Test program

https://www.dropbox.com/s/qcls1vuzsc4kd2i/Main.java

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
File: limitBehavior.txt
Attached By: @amykang2020

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
File: Main.java
Attached By: @amykang2020

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA MQ-345

@glassfishrobot
Copy link
Author

@keilw keilw added the bug Something isn't working label Jul 6, 2018
@pzygielo pzygielo removed this from the 5.1 (RI-Bug-Fix) milestone May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants