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

[BUG] Calling Notifications from other plugins results in ClassLoader error #37

Closed
joshuali925 opened this issue Jul 12, 2021 · 4 comments
Assignees
Labels
bug Something isn't working untriaged

Comments

@joshuali925
Copy link
Member

Describe the bug


Tested in reporting plugin. When reporting calls this function, the following error will show up.

java.lang.ClassCastException: class org.opensearch.commons.notifications.action.SendNotificationRequest cannot be cast to class org.opensearch.commons.notifications.action.SendNotificationRequest (org.opensearch.commons.notifications.action.SendNotificationRequest is in unnamed module of loader java.net.FactoryURLClassLoader @1229a2b7; org.opensearch.commons.notifications.action.SendNotificationRequest is in unnamed module of loader java.net.FactoryURLClassLoader @28f9fedd)
        at org.opensearch.notifications.action.SendNotificationAction.doExecute(SendNotificationAction.kt:47) ~[?:?]
        at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:192) [opensearch-1.0.0-rc1.jar:1.0.0-rc1]
        at org.opensearch.indexmanagement.rollup.actionfilter.FieldCapsFilter.apply(FieldCapsFilter.kt:136) [opensearch-index-management-1.0.0.0-rc1.jar:1.0.0.0-rc1]
        at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:190) [opensearch-1.0.0-rc1.jar:1.0.0-rc1]
...

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@joshuali925 joshuali925 added bug Something isn't working Beta untriaged labels Jul 12, 2021
@joshuali925
Copy link
Member Author

@anirudha
Copy link

@dblock @dbbaughe @nknize please review, thanks

@dblock
Copy link
Member

dblock commented Jul 13, 2021

It looks like there's a cookbook for solving this exact issue in https://discuss.elastic.co/t/how-to-share-classloader-bewteen-different-plugins/181076/6 - have you tried it?

@dai-chen
Copy link
Contributor

As the forum post above explains, this may be caused by "optimization to avoid serialization" for local request between plugins. Possible solutions include:

  1. Copy common jar to OpenSearch lib at runtime and make each plugin compileOnly depends on it
  2. Move common code to OpenSearch core engine codebase
  3. Extend OpenSearch core engine to support this kind of communication
  4. Force serialization/de-serialization request/response class even for local request (what's proposed in the post)

Will reproduce the issue and do a PoC for Option 4 first which seems not hacky and little impact on current architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

No branches or pull requests

4 participants