Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


sys protocol in websocket handler #454

maxlapshin opened this Issue · 11 comments

3 participants


I've got bad situation with leaking websocket handler:

(flussonic@> sys:get_status(pid(0,30511,29)).
22:38:01.936 <0.30511.29> api_handler:272 api_websocket msg: {system,{<0.30811.81>,#Ref<>},get_status}
** exception exit: {timeout,{sys,get_status,[<0.30511.29>]}}
in function sys:send_system_msg/2 (sys.erl, line 231)
(flussonic@> process_info(pid(0,30511,29)).

7> process_info(pid(0,30511,29),memory).

20 megabytes in small websocket =)

And I cannot inspect it with sys protocol.

If you are going to merge pull request, I can add support for sys protocol to websockets.


What I ultimately want is to have them be special processes, but not just websockets, all HTTP processes.


Special processes mean started with proc_lib and handling sys messages, they do neither of these things at this time.

If they are made special processes, that means we need to handle sys messages everywhere, not just in the websocket code. You could do it just in the websocket code to debug your issue but that would not be enough for a merge (though a PR is still welcome).


Yeah it would be a hackish way to make half of sys work, but then the other half would break horribly because it assumes the process was started using proc_lib. If you receive a system message saying the process should be suspended then your process will simply crash. We can't have that. Gotta go all the way.


No problem? You just have to handle system messages everywhere and not just with websockets like I said.


You might want to take a look at gen_process:


It's doing much more than we want. We just need the proc_lib:start and handling system messages. The "hard" part is to find the right way to do it while still keeping the code as efficient as it is now.


Yes probably, which features do you see as being unnecessary in your case?


Pretty much all of it. It doesn't work quite the same way here, the process goes through many different modules, a good number of them needing to receive messages and handle system events. There's no need for calling the process either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.