You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "jbonofre (via GitHub)" <gi...@apache.org> on 2026/05/26 15:57:13 UTC
[PR] Bump default JVM heap and add OOM diagnostics [activemq]
jbonofre opened a new pull request, #2044:
URL: https://github.com/apache/activemq/pull/2044
## Summary
- Raise the shipped default heap from `-Xms64M -Xmx1G` to `-Xms512M -Xmx2G` in `assembly/src/release/bin/setenv`. The previous default is undersized for a production broker; the new value is still modest and remains overridable via `ACTIVEMQ_OPTS_MEMORY`.
- Add a new `ACTIVEMQ_OOM_OPTS` variable defaulting to `-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$ACTIVEMQ_DATA -XX:+ExitOnOutOfMemoryError` so that an `OutOfMemoryError` produces a heap dump under the broker data directory and the JVM terminates rather than continuing in a degraded state.
- Mirror the same `ACTIVEMQ_OOM_OPTS` fallback inside `assembly/src/release/bin/activemq` so the diagnostics still apply if `setenv` is absent.
Both new variables remain overridable from the environment or from any of the higher-priority configuration files (`/etc/default/activemq`, `~/.activemqrc`, `bin/setenv`).
## Test plan
- [ ] Start the broker via `bin/activemq console` and confirm the new heap / OOM JVM arguments are visible in the process command line.
- [ ] Override `ACTIVEMQ_OPTS_MEMORY` and `ACTIVEMQ_OOM_OPTS` from `bin/setenv` and verify the overrides take effect.
- [ ] Trigger an OOM (e.g. with a deliberately low `-Xmx`) and confirm a heap dump is produced under `$ACTIVEMQ_DATA` and the JVM exits.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4545936791
@cshannon I propose to update the default configuration like this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #2044:
URL: https://github.com/apache/activemq/pull/2044
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "mattrpav (via GitHub)" <gi...@apache.org>.
mattrpav commented on code in PR #2044:
URL: https://github.com/apache/activemq/pull/2044#discussion_r3552642105
##########
assembly/src/release/bin/setenv:
##########
@@ -31,10 +31,21 @@
# Set jvm memory configuration (minimal/maximum amount of memory)
if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
+ ACTIVEMQ_OPTS_MEMORY="-Xms512M -Xmx2G"
Review Comment:
I like the idea of setting the initial small, like 64MB. If the default out-of-the-box says '512MB' this will be inaccurately construed as 'ActiveMQ needs a lot of memory'.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2044:
URL: https://github.com/apache/activemq/pull/2044#discussion_r3552650291
##########
assembly/src/release/bin/setenv:
##########
@@ -31,10 +31,21 @@
# Set jvm memory configuration (minimal/maximum amount of memory)
if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
+ ACTIVEMQ_OPTS_MEMORY="-Xms512M -Xmx2G"
Review Comment:
That works for me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "mattrpav (via GitHub)" <gi...@apache.org>.
mattrpav commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4546582310
+1 to have a preconfigured but commented out set of options. Having it on by default can quickly lead to disk space usage issues -- there is also a 'where to write the files' problem
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2044:
URL: https://github.com/apache/activemq/pull/2044#discussion_r3552709736
##########
assembly/src/release/bin/setenv:
##########
@@ -31,10 +31,21 @@
# Set jvm memory configuration (minimal/maximum amount of memory)
if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
+ ACTIVEMQ_OPTS_MEMORY="-Xms512M -Xmx2G"
Review Comment:
Done — reverted to `-Xms64M` while keeping `-Xmx2G`. The JVM will start small and grow on demand, avoiding the impression that ActiveMQ has a 512MB baseline requirement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4546110874
> @cshannon yes, I can add a optional flag to setup OOM. I'm just sharing my experience: I have to ask more of the ActiveMQ users to enable it it to investigate 😄 So having a way to enable it by default would be good (or at least documented).
That sounds good, I personally set that flag myself so I am fine with it but I figure someone might not want the extra output.
It can be an issue if the broker gets into an OOM restart loop and has the potential to fill up a partition so users should be aware it's on or at least opt into it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4546000453
Hmm, I think this might need more discussion. I think the 2GB default is good but I don't know about the OOM heap dump as that will cause unexpected output to a file system for users. I think that needs to be configurable on set up maybe. We could bring it up for discussion on the dev list.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #2044:
URL: https://github.com/apache/activemq/pull/2044#discussion_r3552652533
##########
assembly/src/release/bin/setenv:
##########
@@ -31,10 +31,21 @@
# Set jvm memory configuration (minimal/maximum amount of memory)
if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
- ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
+ ACTIVEMQ_OPTS_MEMORY="-Xms512M -Xmx2G"
Review Comment:
Let me do the change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4546049941
@cshannon yes, I can add a optional flag to setup OOM. I'm just sharing my experience: I have to ask more of the ActiveMQ users to enable it it to investigate 😄 So having a way to enable it by default would be good (or at least documented).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4925494843
@cshannon @mattrpav what are your thoughts on this PR? I think this default configuration is a good improvement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4926073335
@cshannon Thanks for the feedback, I've updated the PR:
- Heap dump on OOM is now **disabled by default**. Users can opt in by uncommenting the `ACTIVEMQ_OOM_DUMP_OPTS` lines in `bin/setenv` (or `bin/activemq` for the no-setenv fallback). `-XX:+ExitOnOutOfMemoryError` remains on by default since it has no disk impact.
- Added `-XX:HeapDumpGzipLevel=6` to the opt-in template (requires JDK 17+).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4925692190
@jbonofre - I think the memory updates make sense and I agree with those. For the OOM settings to dump to disk I think we talked about making that optional with a flag to turn on. I don't think it should be on by default because of the unexpected disk usage. Some people might configure large heap sizes.
Also, I would recommend adding compression: `-XX:HeapDumpGzipLevel=6` as that was added in JDK 17 (as long as we are not backporting this)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Bump default JVM heap and add OOM diagnostics [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #2044:
URL: https://github.com/apache/activemq/pull/2044#issuecomment-4925996900
@cshannon thanks! It makes sense. Let me update the PR accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact