Azure/azure-cosmosdb-spark

CosmosDBSpark.load(ss,readConfig) failing with SSL exception.

BalaMahesh opened this issue · 0 comments

Hello all,
I am using cosmos emulator docker image on my local host. I am trying to connect to cosmos db using azure-cosmosdb connector. I am able to open the cosmos ui from web browser and also I have added certificates in the java key store.

I am able to connect to cosmos db using CosmosClient class and able to read/write data.

But with spark connector ( 2.3.0_2.11-1.3.3 ), i am getting exceptions:

21/08/29 15:02:34 WARN GoneAndRetryWithRetryPolicy: Received gone exception after backoff/retry. Will fail the request
com.microsoft.azure.documentdb.DocumentClientException: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
at com.microsoft.azure.documentdb.internal.directconnectivity.HttpTransportClient.invokeStore(HttpTransportClient.java:137)
at com.microsoft.azure.documentdb.internal.directconnectivity.HttpTransportClient.invokeStore(HttpTransportClient.java:163)
at com.microsoft.azure.documentdb.internal.directconnectivity.TransportClient.invokeResourceOperation(TransportClient.java:12)
at com.microsoft.azure.documentdb.internal.directconnectivity.StoreReader.readFromStore(StoreReader.java:340)
at com.microsoft.azure.documentdb.internal.directconnectivity.StoreReader.createStoreReadResult(StoreReader.java:225)
at com.microsoft.azure.documentdb.internal.directconnectivity.StoreReader.readOneReplica(StoreReader.java:194)
at com.microsoft.azure.documentdb.internal.directconnectivity.StoreReader.readEventual(StoreReader.java:76)
at com.microsoft.azure.documentdb.internal.directconnectivity.ConsistencyReader.readAny(ConsistencyReader.java:107)
at com.microsoft.azure.documentdb.internal.directconnectivity.ConsistencyReader.read(ConsistencyReader.java:67)
at com.microsoft.azure.documentdb.internal.directconnectivity.ReplicatedResourceClient.invoke(ReplicatedResourceClient.java:74)
at com.microsoft.azure.documentdb.internal.directconnectivity.ServerStoreModel$1.apply(ServerStoreModel.java:103)
at com.microsoft.azure.documentdb.internal.RetryUtility.executeStoreClientRequest(RetryUtility.java:133)
at com.microsoft.azure.documentdb.internal.directconnectivity.ServerStoreModel.processMessage(ServerStoreModel.java:114)
at com.microsoft.azure.documentdb.DocumentClient$10.apply(DocumentClient.java:3148)
at com.microsoft.azure.documentdb.internal.RetryUtility.executeDocumentClientRequest(RetryUtility.java:71)
at com.microsoft.azure.documentdb.DocumentClient.doQuery(DocumentClient.java:3154)
at com.microsoft.azure.documentdb.DocumentQueryClientInternal.doQuery(DocumentQueryClientInternal.java:47)
at com.microsoft.azure.documentdb.internal.query.AbstractQueryExecutionContext.executeRequest(AbstractQueryExecutionContext.java:219)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.executeOnce(DefaultQueryExecutionContext.java:141)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.fillBuffer(DefaultQueryExecutionContext.java:98)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:81)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.next(DefaultQueryExecutionContext.java:33)
at com.microsoft.azure.documentdb.internal.query.ProxyQueryExecutionContext.(ProxyQueryExecutionContext.java:68)
at com.microsoft.azure.documentdb.internal.query.QueryExecutionContextFactory.createQueryExecutionContext(QueryExecutionContextFactory.java:23)
at com.microsoft.azure.documentdb.QueryIterable.createQueryExecutionContext(QueryIterable.java:70)
at com.microsoft.azure.documentdb.QueryIterable.reset(QueryIterable.java:115)
at com.microsoft.azure.documentdb.QueryIterable.(QueryIterable.java:57)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1184)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1155)
at com.microsoft.azure.cosmosdb.spark.CosmosDBConnection.queryDocuments(CosmosDBConnection.scala:169)
at com.microsoft.azure.cosmosdb.spark.rdd.CosmosDBRDDIterator.queryDocuments$1(CosmosDBRDDIterator.scala:204)
at com.microsoft.azure.cosmosdb.spark.rdd.CosmosDBRDDIterator.reader$lzycompute(CosmosDBRDDIterator.scala:336)
at com.microsoft.azure.cosmosdb.spark.rdd.CosmosDBRDDIterator.reader(CosmosDBRDDIterator.scala:141)
at com.microsoft.azure.cosmosdb.spark.rdd.CosmosDBRDDIterator.hasNext(CosmosDBRDDIterator.scala:349)
at org.apache.spark.util.Utils$.getIteratorSize(Utils.scala:1836)
at org.apache.spark.rdd.RDD$$anonfun$count$1.apply(RDD.scala:1162)
at org.apache.spark.rdd.RDD$$anonfun$count$1.apply(RDD.scala:1162)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2074)
at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2074)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
at org.apache.spark.scheduler.Task.run(Task.scala:109)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
at sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1561)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1391)
at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1291)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at com.microsoft.azure.documentdb.internal.directconnectivity.HttpTransportClient.invokeStore(HttpTransportClient.java:130)
... 44 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:167)
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1383)
... 57 more

can someone please help me in understanding the problem. thanks in advance.