-
Notifications
You must be signed in to change notification settings - Fork 22
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
Exchange View: Blocked Exchanges very difficult (impossible?) to test #141
Comments
@jsolovjo Do you know if this feature is covered in the existing test suite? @phantomjinx I think it's great to cover the feature in the test suite. On the other hand, considering it just invokes a backend MBean and render the results in almost the same way with the Inflight Exchanges, for the time being we can just rely on |
Actually, the legacy impl looks up the MBean by the wildcard And btw, have you enabled statistics for the test Camel route? It looks like this flag is required for collecting blocked exchanges. |
So if you implement a new Class that implements I did enable statistics on everything I came across. That being said, the doc page references Either way my attempt should provide a starting point for further testing. |
Hi @tadayosi If you could help me to understand it and explain how it works, and what expected configurations and user behaviours are - it would be very beneficial and will help me to create more meaningful tests to cover complex scenarios. (Not only related to this specific issue) Thank you |
@jsolovjo Thanks. While it is our consensus that it's hard to replicate blocked exchanges, inflight exchanges in the Exchanges view is a good target to cover in the E2E tests at hawtio/hawtio. Paul already provides a nice reproducer for the inflight exchanges here, so you can start from this and add some test scenario in the hawtio/hawtio E2E tests: |
@tadayosi Thank you. I will have a look at this and implement tests to cover these scenarios. |
The Exchanges view displays the statistics of both Inflight and Blocked Exchanges as 2 distinct tables. The Inflight Exchanges are straightforward to test by adding a Processor to a route that calls Thread.sleep(60000). The Exchanges that are inflight but pending due to the sleeping Processor are logged as rows in the Inflight Exchanges table.
However, despite best attempts (see here), trying to create a test app that creates blocking threads that are detectable and so listed in the Blocked Exchanges table is very complex (near impossible??).
The architecture for extracting the Blocked Exchanges is to interrogate the MBean -> Service -> DefaultAsyncProcessorAwaitManager. This mbean contains the count of the number of threads blocked as well as a list of the exchanges. However, in common routes, this particular Manager seems to be rarely implemented (breakpoints on it never get called) and its key method that seems to log the blocked threads seems never to be called.
(It should be noted that it is possible to override this class with a custom AsyncProcessorAwaitManager which means that a different name is listed in MBean -> Service and so breaks the logic of extracting the bean by name.)
Looking at the test example it is not difficult to block threads and so exchanges. However, these blocked threads are never logged by this mbean and so never displayed in the table. Therefore, perhaps a rethink of this specific table may be required to make it more useful?
The text was updated successfully, but these errors were encountered: