Uploaded image for project: 'Immutant'
  1. Immutant
  2. IMMUTANT-529

Websocket On-Close is Not Called in All Cases

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.0-beta2
    • Fix Version/s: 2.0.0-beta3
    • Labels:


      Occasionally, when deployed in a wildfly container, if multiple websockets are simultaneously closed, particularly with frames in transit, the "on-close" function is not triggered on the server side.

      <snip> from #immutant IRC:

      [09:50] <@tcrawley> do you have an on-error handler set as well? If so, does it get triggered in those situations?
      [09:55] <TomGoldsmith> tcrawley: I do indeed. It does not appear to get called. When I've noticed it most it seems as though the websocket is in the process of sending messages at the same time as another websocket, and I cut both off.
      [09:56] <@tcrawley> do you have an on-complete handler set for the send! call?
      [09:56] <TomGoldsmith> Keep in mind this also works inside the REPL, so there is something about the wildfly environment causing the issue.
      [09:56] <@tcrawley> there are differences between the underlying impl used in WF vs. out, so there may be a bug there
      [09:56] <TomGoldsmith> No on-complete handler. Wasn't aware of this.
      [09:57] <TomGoldsmith> I was going to set up a ping of sorts every 30 seconds or so to test that the connection is still open. I can try to collect some more information for you guys.
      [09:57] <@tcrawley> it's new in beta2 - (send! ch msg {:on-complete (fn [err] ...)})
      [09:57] <@tcrawley> that would be great if you could get more info
      [09:57] <TomGoldsmith> Nice that should come in handy.
      [09:58] <TomGoldsmith> Will do! I'll let you know if I can get a more consistent reproduction scenario.
      [09:58] <@tcrawley> thanks!
      [09:59] <@tcrawley> it looks like we close the connection from the server-side when an error occurs on send, and that direct close may not trigger on-close
      [10:03] <TomGoldsmith> That sounds like it might be the cause here. Or could be anyways.
      [10:08] <@tcrawley> let me know if the on-complete gets an error when on-close isn't triggered - that will be a clue


          Issue Links



              Unassigned Unassigned
              tomgoldsmith Tom Goldsmith (Inactive)
              ranumula Raju Anumula