Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2083

SseBroadcasterImpl.notifyOnCloseListeners removes wrong sink from outputQueue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 3.6.3.Final, 4.0.0.CR1
    • 3.6.2.Final, 4.0.0.Beta6
    • None
    • None
    • Hide

      Basically:

      1) create broadcaster
      2) register two sinks
      3) close second sink (closing client for instance)
      4) first client stops to receive events/broadcaster.outputQueue is empty

      See test case from the attached project.

      Show
      Basically: 1) create broadcaster 2) register two sinks 3) close second sink (closing client for instance) 4) first client stops to receive events/broadcaster.outputQueue is empty See test case from the attached project.
    • Workaround Exists
    • Hide

      Implement SseEventSink so that new implementation delegates everything to original SseEventSink and overrides equals

      Show
      Implement SseEventSink so that new implementation delegates everything to original SseEventSink and overrides equals

      Dear JBossDevelopers,

      I have found a naughty bug in SseBroadcasterImpl: when notifyOnCloseListeners is called it removes wrong sink from the queue, namely it removes always the first one due to GenericType.equals implementation which is:

      boolean result = this == obj;
              if (!result && obj instanceof GenericType) {
                  GenericType<?> that = (GenericType)obj;
                  return this.type.equals(that.type);//always true in case SseEventSink
              } else {
                  return result;
              }
      

      This case is reproduced in the following test project: [link](https://github.com/Ingvord/resteasy-sse-bug-report). It also provides a workaround.

              rhn-support-asoldano Alessio Soldano
              ingvord Igor Khokhriakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: