Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4027

Mono#doOnTerminate does not guarantee execution prior to Subscriber notification

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.2.2
    • Affects Version/s: 4.2.0
    • Component/s: Reactive Streams
    • None

      The sessions specification requires that an implicit session is available for re-use after the previous operation that is using it completes. Currently, we rely on the use of Mono:doOnTerminate to help provide that guarantee, as in current versions of Project Reactor there is a documented guarantee that the termination code will execute prior to Subscriber notification.

      But that guarantee is not included, and is violated, in the current minimum release of Project Reactor that we support (Californium). Therefore, until we update our minimum supported Project Reactor release, we should ensure that the driver behaves consistently and as expected when using that release. This is easy to do: instead of releasing the binding via Mono#doOnTerminate, wrap the sinkToCallback in another callback that releases the binding before notifying the Sink of completion.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: