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

AMQ-8049: Failed to start Apache ActiveMQ (mKahaDB / JMX) #984

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lraczko
Copy link

@lraczko lraczko commented Mar 1, 2023

When using filtered adapter for topics or queues with perDestination on catch all, after restart it is possible to have duplicated adapters when there are destinations in metadata and as a result start will fail. Perdestination should not start adapter for directory read from filesystem which is already defined in configured adapters.

@jbonofre jbonofre self-requested a review March 1, 2023 11:18
@lraczko lraczko force-pushed the AMQ-8049 branch 2 times, most recently from fb04e9f to b7dc544 Compare March 6, 2023 11:14
@lraczko lraczko marked this pull request as draft April 5, 2023 13:30
@lraczko lraczko force-pushed the AMQ-8049 branch 2 times, most recently from cd3b1e3 to ea8bc4b Compare April 11, 2023 11:20
When using filtered adapter for topics or queues with perDestination on catch all, after restart it is possible to have duplicated adapters when there are destinations in metadata and as a result start will fail. Perdestination should not start adapter for directory read from filesystem which is already defined in configured adapters.
@lraczko
Copy link
Author

lraczko commented Apr 26, 2023

Hey @jbonofre

I need help and consultation :). I keep getting some random fails in tests (locally on my machine I had few successes but also fails. On your pipeline there were only fails). They do not seem to be connected to my change (and when I rerun them locally then they work), but still I am not fan of giving to code review commit with failed verification. Do you have some hints what should I do and how you guys proceed in such cases?

@jbonofre
Copy link
Member

jbonofre commented Jun 6, 2023

Let me take a look on this one. For the tests, it's possible we still have some flaky tests, let me do a pass on these tests.

@mattrpav
Copy link
Contributor

mattrpav commented Jun 6, 2023

How does the error occur when the adapters are added via directory listing? There should not be duplication.

@lraczko
Copy link
Author

lraczko commented Jun 7, 2023

When you have configuration like:

	<mKahaDB directory="${activemq.data}/kahadb">
		<filteredPersistenceAdapters>
			<!-- kahaDB per destinations -->
			<filteredKahaDB perDestination="true">
				<persistenceAdapter>
					<kahaDB>
						...
					</kahaDB>
				</persistenceAdapter>
			</filteredKahaDB>
			<filteredKahaDB topic="STOMP.>">
				<persistenceAdapter>
					<kahaDB>
						...
					</kahaDB>
				</persistenceAdapter>
			</filteredKahaDB>
		</filteredPersistenceAdapters>
	</mKahaDB>
</persistenceAdapter>

On first start everything works fine, but after restart in
org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter#doStart
you first go through 'matchAll' and for this example topic store in
org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter#registerExistingAdapter
you register and start adapter (as destinations.size() != 0)
and when you get to

        if (candidates != null) {
            for (File candidate : candidates) {
                registerExistingAdapter(template, candidate);
            }
        }

in mentioned 'doStart' then it will try to register and start same adapter second time and corrupt index.
And after that another restart will make AMQ fail to start because of that corrupted index.

@lraczko
Copy link
Author

lraczko commented Jun 16, 2023

@jbonofre - Did you have time to take a look?

@lraczko
Copy link
Author

lraczko commented Jul 10, 2023

@jbonofre - any news? :D

@jbonofre
Copy link
Member

I'm resuming my test/investigation on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants