I have more info...it seems the bug is in artemis-commons.jar (I'm using v2.22.0). In the ByteUtil.uncheckedZeros(final ByteBuffer buffer, int offset, int bytes) method it is using the else condition (slow path comment).
for (int i = 0; i < bytes; i++) { buffer.put(i + offset, zero); // buffer is DirectByteBuffer } where bytes == 4096. When i gets to 16 it throws IndexOutOfBoundsException because it contains this check on the index value: @HotSpotIntrinsicCandidate final int checkIndex(int i) { // package-private if ((i < 0) || (i >= limit)) throw new IndexOutOfBoundsException(); return i; } Here limit == 16. So the code in this path will always throw IndexOutOfBoundsException as the expected max size (limit) are not the same. One thinks the limit is 4096 and the other 16. How to fix this? On Thu, Jun 29, 2023 at 2:24 PM David Hoffer <dhoff...@gmail.com> wrote: > I have more information on this issue. It turns out that we also added > this dependency to our Quarkus build. > > <dependency> > <groupId>io.quarkus</groupId> > <artifactId>quarkus-infinispan-client</artifactId> > </dependency> > > We have proven that this breaks the Embedded Artemis in the Quarkus app. > We don't know why but with quarkus-infinispan-client included in the build, > Artemis has the runtime error previously reported. So it never gets past > its preActivate state. > > If anyone has any ideas how to fix this I would like to know. > > -David > > > On Thu, Jun 29, 2023 at 1:59 PM Clebert Suconic <clebert.suco...@gmail.com> > wrote: > >> Btw It is probably related to dynamic class loading added in 2.28 (broker >> connections) >> >> On Thu, Jun 29, 2023 at 3:52 PM Clebert Suconic < >> clebert.suco...@gmail.com> >> wrote: >> >> > I know tests are done with the clients thought. >> > >> > On Thu, Jun 29, 2023 at 3:51 PM Clebert Suconic < >> clebert.suco...@gmail.com> >> > wrote: >> > >> >> We don’t have any tests of artemis embedded as a server in quarkus. I >> >> didn’t even know it worked. >> >> >> >> It would be required to have some tests. >> >> >> >> As none of the devs tried it. We would need to add tests in order to >> say >> >> it works. >> >> >> >> On Thu, Jun 29, 2023 at 2:08 PM David Hoffer <dhoff...@gmail.com> >> wrote: >> >> >> >>> Hi, >> >>> >> >>> We have a Quarkus app where we embed an Artemis server, we were using >> >>> 2.27.1. We were connecting to it via quarkus-artemis-jms 1.0.3 which >> I >> >>> see >> >>> now is very old. This stopped working and strangely it stopped >> working >> >>> when it tried to create the activemq working directories. >> >>> >> >>> I have tried upgrading to quarkus-artemis-jms 2.1.1 but strangely that >> >>> version can't read our quarkus properties correctly. It reads the >> wrong >> >>> value for build time is devervices enabled and wrong value for url >> >>> setting. Can't figure that one out. So we get this error: >> >>> >> >>> new IllegalStateException(String.format( >> >>> "Configuration %s: url is not set and devservices is >> >>> activated. This is a bug. Please report it.", name)); >> >>> >> >>> So taking a step back here I'm thinking we don't have the correct >> >>> dependencies in our build. Can you point me to the correct way to >> >>> include >> >>> both the artemis server and the artemis client jars? E.g. is there a >> BOM >> >>> for these? >> >>> >> >>> We are using Quarkus 2.16.7 >> >>> JDK 11 >> >>> We would prefer to use the latest known stable versions of Artemis >> server >> >>> and client components, but most important is that they work together >> >>> properly. >> >>> >> >>> Thanks, >> >>> -David >> >>> >> >>> P.S. Here is the error log when it fails to generate the working >> >>> folders/files. Note the broker.xml file does exist, no idea why that >> >>> shows >> >>> as a warning. >> >>> >> >>> 14:07:17,414 dhoffe-bstaq-pc ./target/app-runner.jar[10576] WARN >> >>> [org.apa.act.art.cor.server] (main) AMQ222219: File >> >>> file:\C:\projects\app\target\app-runner.jar!\broker.xml does not exist >> >>> 2023-06-26 14:07:17,426 dhoffe-bstaq-pc ./target/app-runner.jar[10576] >> >>> INFO >> >>> [org.apa.act.art.cor.server] (main) AMQ221034: Waiting indefinitely >> to >> >>> obtain live lock >> >>> 2023-06-26 14:07:17,426 dhoffe-bstaq-pc ./target/app-runner.jar[10576] >> >>> INFO >> >>> [org.apa.act.art.cor.server] (main) AMQ221035: Live Server Obtained >> live >> >>> lock >> >>> 2023-06-26 14:07:17,434 dhoffe-bstaq-pc ./target/app-runner.jar[10576] >> >>> WARN >> >>> [org.apa.act.art.journal] (main) AMQ142018: Temporary files were left >> >>> unattended after a crash on journal directory, deleting invalid files >> now >> >>> 2023-06-26 14:07:17,434 dhoffe-bstaq-pc ./target/app-runner.jar[10576] >> >>> WARN >> >>> [org.apa.act.art.journal] (main) AMQ142019: Deleting orphaned file >> >>> activemq-bindings-4.bindings.tmp >> >>> 2023-06-26 14:07:17,492 dhoffe-bstaq-pc ./target/app-runner.jar[10576] >> >>> ERROR [org.apa.act.art.cor.server] (main) AMQ224000: Failure in >> >>> initialisation: java.lang.IndexOutOfBoundsException >> >>> at java.base/java.nio.Buffer.checkIndex(Buffer.java:687) >> >>> at java.base/java.nio.DirectByteBuffer.put(DirectByteBuffer.java:344) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.utils.ByteUtil.uncheckedZeros(ByteUtil.java:512) >> >>> at org.apache.activemq.artemis.utils.ByteUtil.zeros(ByteUtil.java:494) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.io.util.ThreadLocalByteBufferPool.borrow(ThreadLocalByteBufferPool.java:47) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory.newBuffer(NIOSequentialFileFactory.java:150) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory.newBuffer(NIOSequentialFileFactory.java:142) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.io.nio.NIOSequentialFile.fill(NIOSequentialFile.java:170) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalFilesRepository.createFile0(JournalFilesRepository.java:655) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalFilesRepository.createFile(JournalFilesRepository.java:611) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalFilesRepository.ensureMinFiles(JournalFilesRepository.java:220) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalImpl.setUpCurrentFile(JournalImpl.java:3454) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:2288) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:2340) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.journal.impl.JournalImpl.load(JournalImpl.java:1669) >> >>> at >> >>> >> org.apache.activemq.artemis.core.journal.Journal.load(Journal.java:278) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.loadBindingJournal(AbstractJournalStorageManager.java:1515) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.loadJournals(ActiveMQServerImpl.java:3643) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart2(ActiveMQServerImpl.java:3324) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:78) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:684) >> >>> at >> >>> >> >>> >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:581) >> >>> >> >> -- >> >> Clebert Suconic >> >> >> > -- >> > Clebert Suconic >> > >> -- >> Clebert Suconic >> >