Uploaded image for project: 'Scala'
  1. Scala
  2. SCALA-431

ToSingleObservable throws IllegalStateException for createIndexes(): SingleResultCallback[util.List[String]]

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 2.4.1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      MongoDB 3.6.5, Scala 2.12.6

      Description

      Hi,

      I think I've found a breaking change in ToSingleObservable when upgrading from 2.3.0 to 2.4.0. This is used in MongoCollection.createIndexes().

      Previously, only the first result of a List[T] result was emitted (in our case the first index). In 2.4.0 onNext() instead has a check and throws an exception when additional results are available.

      https://github.com/mongodb/mongo-scala-driver/blob/r2.3.0/driver/src/main/scala/org/mongodb/scala/ObservableImplicits.scala#L450

      https://github.com/mongodb/mongo-scala-driver/blob/r2.4.0/driver/src/main/scala/org/mongodb/scala/ObservableImplicits.scala#L458

       

      Stacktrace

      }}
      {{java.lang.IllegalStateException: SingleObservable.onNext cannot be called with multiple results.java.lang.IllegalStateException: SingleObservable.onNext cannot be called with multiple results. at org.mongodb.scala.ObservableImplicits$ToSingleObservable$$anon$3.check(ObservableImplicits.scala:469) at org.mongodb.scala.ObservableImplicits$ToSingleObservable$$anon$3.onNext(ObservableImplicits.scala:458) at org.mongodb.scala.internal.SubscriptionCheckingObserver.onNext(SubscriptionCheckingObserver.scala:33) at com.mongodb.async.client.AbstractSubscription.onNext(AbstractSubscription.java:137) at com.mongodb.async.client.AbstractSubscription.processResultsQueue(AbstractSubscription.java:205) at com.mongodb.async.client.AbstractSubscription.tryProcessResultsQueue(AbstractSubscription.java:161) at com.mongodb.async.client.AbstractSubscription.addToQueue(AbstractSubscription.java:119) at com.mongodb.async.client.FlatteningSingleResultCallbackSubscription$1.onResult(FlatteningSingleResultCallbackSubscription.java:50) at com.mongodb.async.client.FlatteningSingleResultCallbackSubscription$1.onResult(FlatteningSingleResultCallbackSubscription.java:41) at com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:887) at com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:881) at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49) at com.mongodb.async.client.OperationExecutorImpl$2$1.onResult(OperationExecutorImpl.java:117) at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49) at com.mongodb.operation.OperationHelper$ReferenceCountedReleasingWrappedCallback.onResult(OperationHelper.java:359) at com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:205) at com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:202) at com.mongodb.operation.CommandOperationHelper$2.onResult(CommandOperationHelper.java:405) at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49) at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor$2.onResult(DefaultServer.java:227) at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49) at com.mongodb.internal.connection.CommandProtocolImpl$1.onResult(CommandProtocolImpl.java:85) at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection$1.onResult(DefaultConnectionPool.java:461) at com.mongodb.internal.connection.UsageTrackingInternalConnection$2.onResult(UsageTrackingInternalConnection.java:111) at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49) at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:379) at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:356) at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:651) at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:618) at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:494) at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:491) at com.mongodb.internal.connection.AsynchronousSocketChannelStream$BasicCompletionHandler.completed(AsynchronousSocketChannelStream.java:237) at com.mongodb.internal.connection.AsynchronousSocketChannelStream$BasicCompletionHandler.completed(AsynchronousSocketChannelStream.java:220) at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:281) at sun.nio.ch.WindowsAsynchronousSocketChannelImpl$ReadTask.completed(WindowsAsynchronousSocketChannelImpl.java:579) at sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:397) at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) 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)}}
      {{}}{{

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: