Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1934

onClose not called when network drops

XMLWordPrintable

    • Hide
      1. Create a websocket server and implement onClose and onError. Example based on provided "websockets": https://gist.github.com/alandipert/a787f784c1ec3c35063a86d3def2405f
      2. Proxy a TCP connection locally from port 8081 to 8080 with socat: socat -d -d -d TCP-LISTEN:8081,fork,reuseaddr TCP:localhost:8080
      3. Navigate to http://localhost:8081
      4. Notice the websocket connects and responds to messages
      5. Kill socat with `killall -9 socat` or similar
      6. Notice that the browser's onclose is called but not onClose on the server.

       

      Show
      Create a websocket server and implement onClose and onError. Example based on provided "websockets":  https://gist.github.com/alandipert/a787f784c1ec3c35063a86d3def2405f Proxy a TCP connection locally from port 8081 to 8080 with socat: socat -d -d -d TCP-LISTEN:8081,fork,reuseaddr TCP:localhost:8080 Navigate to http://localhost:8081 Notice the websocket connects and responds to messages Kill socat with `killall -9 socat` or similar Notice that the browser's onclose is called but not onClose on the server.  
    • Undefined

      We found an example of registering a close listener in addition to a "receive" listener: https://github.com/7erry/hazelcast-websocket-demo/blob/master/hazelcast-undertow/src/main/java/demo/hazelcast/undertow/ConnectionCallback.java#L46-L53

      This "close" listener is called at the right time, but we didn't expect to need a separate listener than our onClose/onError, given that a "clean" closure is received normally by listener.onClose.

      We found two wrappers in the wild that don't register a close listener and are subject to the same issue:

      1. https://github.com/jooby-project/jooby/blob/f32a916e98d2155acf4a8395c688e91105f455c6/modules/jooby-utow/src/main/java/io/jooby/internal/utow/UtowWebSocket.java#L165-L166
      2. https://github.com/luminus-framework/ring-undertow-adapter/blob/master/src/ring/adapter/undertow/websocket.clj#L73

      Please let us know if we're missing something, or if there's anything we can provide to help diagnose.

            rhn-cservice-bbaranow Bartosz Baranowski
            alan-14 Alan Dipert (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: