sendCustomMessage segfault, failing to work around it

I'm running a shiny app on a shiny server deployed as a Docker container. Nothing too eventful except that I recently added a session$sendCustomMessage call and now my server is segfaulting. Okay. Stack trace ends with the server trying to send a websocket message to the client, which makes sense given that I asked it to do so. I figure there is some bug in the bowels of httpuv and I was hoping that if I tell shiny not to use websockets maybe it would fall back on another method of communicating with the client and I could get on with my lifeā€¦ but no.

Here's the crash:

 *** caught segfault ***
address 0x8, cause 'memory not mapped'

 1: sendWSMessage(self$handle, FALSE, as.character(message))
 2: private$websocket$send(json)
 3: private$write(toJSON(msg))
 4: private$sendMessage(custom = data)

So what I did at this point was to add disable_protocols websocket to my shiny-server.conf. I can confirm that a. I am running my app under shiny server and b. the server is reading my configuration, because this is what I see in the app's HTML source:


And also, I did control-option-shift-A and websocket is indeed disabled in the protocol list.

However, with all that in place, when I do the thing that makes R crash in my app, it still crashes in exactly the same way. What am I missing here? Why is shiny server calling sendWSMessage even though the client clearly thinks that websockets are 100% off the table? And, more importantly, how can I make it stop?

(I am willing to accept increased latency in the custom messages getting from the server to the client in exchange for the server not crashing, but I would prefer not having to dive into the bowels of httpuv and figure out why it's crashing. On a bit of a timetable here.)


Even if you configure Shiny Server to use sockjs instead of real websockets to talk to the browser, that happens at a different level from Shiny and httpuv -- as far as Shiny and httpuv are concerned, it's still a websocket.

As for the segfault, if you could provide a reproducible example (ideally with the Dockerfile) and file it as an issue here, that would be very helpful:

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.