-
Notifications
You must be signed in to change notification settings - Fork 306
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
FISH-5768 Clustered CDI Events not Received if Sender Application Deployed on Receiver Instance #5435
Conversation
When CDI event class has been loaded by multiple classes on receiver, don't switch classloader in PayaraValueHolder#getValue(). Also moves PayaraValueHolder out of JCache module since it isn't used there, and log an info message at fine when resolving cdi event qualifiers outside of the current classloader Signed-off-by: Andrew Pielage <[email protected]>
Signed-off-by: Andrew Pielage <[email protected]>
Jenkins test please |
Signed-off-by: Andrew Pielage <[email protected]>
Jenkins test please |
I am quite sure this isn't going to work. I put this in originally in response to another bug. However, I am not quite sure which one it is but I distinctly remember the original code was necessary What that piece of code does is find the appropriate application class loader for the component id of the sender and sets it for the duration of deserialization, which is necessary to avoid |
The problem we faced was that it didn't find appropriate application class loader for receiving application when (another instance of) sending application was also deployed. Receiver's classloader is already set as the thread context classloader earlier in the process and that's the only one that makes sense for reception of clustered event as that's the only one the application can process. |
I remember the issue... it was spamming the logs with CNFs every time the message was sent.
I think I see a cleaner solution that won't break things...
I believe that will save the original intent and fix the current issue. WDYT? |
Can you think what they might be? PayaraValueHolder is only used by the clustered event bus, and I'm not getting CNFEs unnecessarily logged.
I'll need to double-check if they're thrown without this change. The only other case I think you might be referring to is when qualifiers start to get involved, but this change doesn't affect that (error gets logged and ignored): Line 175 in 8e05ed9
I originally had a description of the issue in the PR description but removed it because the problem was found to happen even before Hazelcast 4 was introduced (5.2020.7 was the last community release before Hazelcast 4 was introduced if you want to compare yourself). |
I remember all these issues came up when testing the following: in different deployment combinations (not comprehensive):
|
The issue is when CNF is thrown, it's unclear whether the app is not deployed or something else went wrong. |
I tested the clustered CDI events from Payara-Examples against master and this branch - both throw and catch the CNFE, but my branch actually successfully resolves it within Weld. That reactive app seems broken on master (also on this branch) - deploying it actually causes the server or micro instance to hang (seems to cause Hazelcast to freak out). I'm going to say that's a separate issue though since it affects both branches. Interestingly the baking app doesn't seem to throw any CNFEs (on either branch), but the case still remains that on master no observers are resolved for received events vs. this branch where they are. So I'm not seeing any active case for adding anything to PR, on both cases CNFE exceptions get thrown, but my branch seems to be "more correct", at least from the view that it has the clustered cdi event bus working. |
Signed-off-by: Andrew Pielage <[email protected]>
FISH-5768 Clustered CDI Events not Received if Sender Application Deployed on Receiver Instance
Description
Bug Fix.
Clustered CDI Events do not get resolved correctly if both the sender application and receiver application are deployed to the same instance. The cause is our old favourite: class loaders.
When Weld comes to resolve the observer methods for the event, it fails to do a
.equals
comparison on the event class due to it having been loaded by the sender class loader rather than the receiver.The fix here partially reverts #5010 - notably the bit in
PayaraValueHolder
where the error was tracked down to.Also moves the
PayaraValueHolder
class out of JCache module because it's not used there.Important Info
Blockers
None
Testing
New tests
None
Testing Performed
Testing Environment
Windows 10 - JDK 8
Documentation
N/A
Notes for Reviewers
None