Randomly losing connections under emacs-ipython-notebook with version 1.11
millejoh opened this issue · 5 comments
I have haphazardly documented in millejoh/emacs-ipython-notebook#559. The problems seem to start sometime after commit 0d96ba2.
Unfortunately I have very little information to contribute as all the debug buffer states is [WS] State change to connection broken by remote peer
. This does appear to be an issue with the current release (1.11) of websocket, though, since if I revert to an earlier version I stop seeing the disconnects.
Let me know if there is anything else I can do to help track down the cause of this.
I'll see if I can reproduce. None of the commits recently look like they should effect connections at all, although maybe the recent change in error handling behavior caused some hidden problem to surface. Anyway, if I can reproduce it, I'll fix it.
I ran into this issue as well. The server I was communicating with was closing the websocket connection due to an invalid frame being sent. It looks like encode-coding-string
causes issues if used in websocket-mask
that are dependent on the specific byte pattern used for the masking.
Here is a test case that will always fail when encode-coding-string
is used in websocket-mask
(cl-letf ((text "{\"parent_header\":{},\"header\":{\"msg_id\":\"a2940bc8-619e-4872-97bd-4c8d6fb93017\",\"msg_type\":\"history_request\",\"version\":\"5.3\",\"username\":\"n\",\"session\":\"409cf442-74ba-462f-8183-6652503005af\",\"date\":\"2019-06-20T02:17:43.925049-0500\"},\"content\":{\"output\":false,\"raw\":false,\"hist_access_type\":\"tail\",\"n\":100},\"metadata\":{},\"buffers\":[],\"channel\":\"shell\"}")
((symbol-function #'websocket-genbytes)
(lambda (&rest _) "\10\206\356\224")))
(let ((frame (websocket-read-frame
(websocket-encode-frame
(make-websocket-frame :opcode 'text
:payload (encode-coding-string text 'raw-text)
:completep t)
t))))
(should frame)
(should (equal (websocket-frame-payload frame) text))))