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] Unable to find a model due to decryption error #1287

Closed
austintlee opened this issue Sep 6, 2023 · 4 comments
Closed

[BUG] Unable to find a model due to decryption error #1287

austintlee opened this issue Sep 6, 2023 · 4 comments
Labels
bug Something isn't working untriaged

Comments

@austintlee
Copy link
Collaborator

What is the bug?
Read operations on registered models are failing with the following stack trace:

{"type": "server", "timestamp": "2023-09-06T01:11:51,908Z", "level": "ERROR", "component": "o.o.m.e.a.r.RemoteModel", "cluster.name": "opensearch-cluster", "node.name": "os-conversation-node2", "message": "Failed to init remote model", "cluster.uuid": "1mwDvBpJQiOUte6CMfwMMQ", "node.id": "JhN1kctFS-qyiXZJxEwUJw" ,
| "stacktrace": ["java.lang.NoClassDefFoundError: org/bouncycastle/util/encoders/Base64",
| "at com.amazonaws.encryptionsdk.internal.Utils.decodeBase64String(Utils.java:261) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.internal.TrailingSignatureAlgorithm$ECDSASignatureAlgorithm.deserializePublicKey(TrailingSignatureAlgorithm.java:117) ~[aws- encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.DefaultCryptoMaterialsManager.deserializeTrailingKeyFromEc(DefaultCryptoMaterialsManager.java:149) ~[aws-encryption-sdk-java-2.4.0. jar:?]",
| "at com.amazonaws.encryptionsdk.DefaultCryptoMaterialsManager.decryptMaterials(DefaultCryptoMaterialsManager.java:134) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.internal.DecryptionHandler.readHeaderFields(DecryptionHandler.java:621) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.internal.DecryptionHandler.(DecryptionHandler.java:111) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.internal.DecryptionHandler.create(DecryptionHandler.java:302) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.AwsCrypto.decryptData(AwsCrypto.java:511) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.AwsCrypto.decryptData(AwsCrypto.java:502) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at com.amazonaws.encryptionsdk.AwsCrypto.decryptData(AwsCrypto.java:476) ~[aws-encryption-sdk-java-2.4.0.jar:?]",
| "at org.opensearch.ml.engine.encryptor.EncryptorImpl.decrypt(EncryptorImpl.java:90) ~[opensearch-ml-algorithms-2.10.0.0-SNAPSHOT.jar:?]",
| "at org.opensearch.ml.engine.algorithms.remote.RemoteModel.lambda$initModel$0(RemoteModel.java:80) ~[opensearch-ml-algorithms-2.10.0.0-SNAPSHOT.jar:?]",
| "at org.opensearch.ml.common.connector.HttpConnector.decrypt(HttpConnector.java:268) ~[opensearch-ml-common-2.10.0.0-SNAPSHOT.jar:?]",
| "at org.opensearch.ml.engine.algorithms.remote.RemoteModel.initModel(RemoteModel.java:80) [opensearch-ml-algorithms-2.10.0.0-SNAPSHOT.jar:?]",
| "at org.opensearch.ml.engine.MLEngine.deploy(MLEngine.java:125) [opensearch-ml-algorithms-2.10.0.0-SNAPSHOT.jar:?]",
| "at org.opensearch.ml.model.MLModelManager.setupPredictable(MLModelManager.java:844) [opensearch-ml-2.10.0.0-SNAPSHOT.jar:2.10.0.0-SNAPSHOT]",
| "at org.opensearch.ml.model.MLModelManager.lambda$deployModel$33(MLModelManager.java:771) [opensearch-ml-2.10.0.0-SNAPSHOT.jar:2.10.0.0-SNAPSHOT]",
| "at org.opensearch.core.action.ActionListener$1.onResponse(ActionListener.java:82) [opensearch-core-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.action.support.TransportAction$1.onResponse(TransportAction.java:113) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.action.support.TransportAction$1.onResponse(TransportAction.java:107) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:298) [opensearch-2.10.0- SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:284) [opensearch-2.10.0- SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1496) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0- SNAPSHOT]",
| "at org.opensearch.transport.InboundHandler.doHandleResponse(InboundHandler.java:394) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundHandler.handleResponse(InboundHandler.java:386) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundHandler.messageReceived(InboundHandler.java:161) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundHandler.inboundMessage(InboundHandler.java:115) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.TcpTransport.inboundMessage(TcpTransport.java:767) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundPipeline.forwardFragments(InboundPipeline.java:175) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundPipeline.doHandleBytes(InboundPipeline.java:150) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.InboundPipeline.handleBytes(InboundPipeline.java:115) [opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]",
| "at org.opensearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:95) [transport-netty4-client-2.10.0-SNAPSHOT.jar:2.10.0- SNAPSHOT]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280) [netty-handler-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:689) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:652) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [netty-transport-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.97.Final.jar:4.1.97.Final]",
| "at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.97.Final.jar:4.1.97.Final]",
| "at java.lang.Thread.run(Thread.java:833) [?:?]",
| "Caused by: java.lang.ClassNotFoundException: org.bouncycastle.util.encoders.Base64",
| "at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]",
| "at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]",
| "at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]",
| "... 51 more"] }

How can one reproduce the bug?
Register a model.
Deploy the model.

What is the expected behavior?
Deploy should succeed.

What is your host/environment?

  • OS: Mac
  • Version 2.10
  • Plugins ml-commons

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

@austintlee austintlee added bug Something isn't working untriaged labels Sep 6, 2023
@saratvemulapalli
Copy link
Member

"stacktrace": ["java.lang.NoClassDefFoundError: org/bouncycastle/util/encoders/Base64",
| "at com.amazonaws.encryptionsdk.internal.Utils.decodeBase64String(Utils.java:261)

Its the same bouncycastle NoClassDefFound, looks like a linker error.
Are you using ML-Commons 2.x(2.10) branch ?

@saratvemulapalli
Copy link
Member

Checking out 2.x and running integration tests are failing with:

»    ↓ errors and warnings from /home/ubuntu/ml-commons/plugin/build/testclusters/integTest-0/logs/opensearch.stdout.log ↓
» ERROR][o.o.b.OpenSearchUncaughtExceptionHandler] [integTest-0] fatal error in thread [main], exiting
»  java.lang.NoClassDefFoundError: com/amazonaws/encryptionsdk/MasterKeyProvider
»       at org.opensearch.ml.plugin.MachineLearningPlugin.createComponents(MachineLearningPlugin.java:287) ~[?:?]
»       at org.opensearch.node.Node.lambda$new$16(Node.java:788) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271) ~[?:?]
»       at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
»       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
»       at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
»       at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
»       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
»       at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
»       at org.opensearch.node.Node.<init>(Node.java:802) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.node.Node.<init>(Node.java:389) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:242) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.Bootstrap.setup(Bootstrap.java:242) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.Bootstrap.init(Bootstrap.java:404) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:180) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.OpenSearch.execute(OpenSearch.java:171) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:104) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.cli.Command.mainWithoutErrorHandling(Command.java:138) ~[opensearch-cli-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.cli.Command.main(Command.java:101) ~[opensearch-cli-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:137) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»       at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:103) ~[opensearch-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT]
»  Caused by: java.lang.ClassNotFoundException: com.amazonaws.encryptionsdk.MasterKeyProvider
»       at java.net.URLClassLoader.findClass(URLClassLoader.java:435) ~[?:?]
»       at java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]
»       at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:855) ~[?:?]
»       at java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]

@austintlee
Copy link
Collaborator Author

I am using the 2.x branch.

@austintlee
Copy link
Collaborator Author

This - opensearch-project/OpenSearch#9833 - seems to have fixed this issue.

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

2 participants