Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow websocket consumer problem #41

Open
majek opened this issue Nov 26, 2012 · 0 comments
Open

Slow websocket consumer problem #41

majek opened this issue Nov 26, 2012 · 0 comments

Comments

@majek
Copy link
Member

majek commented Nov 26, 2012

SockJS-erlang fails on slow websocket consumer.

For example:

=ERROR REPORT==== 26-Nov-2012::14:20:55 ===
** Handler sockjs_cowboy_handler terminating in websocket_handle/3
   for the reason exit:{noproc,
                           {gen_server,call,
                               [<0.158.0>,{received,[<<"18">>]},infinity]}}
** Message was {text,<<"[\"18\"]">>}
** Options were {service,"/amplify",#Fun<cowboy_test_server.2.61145267>,state,
                         "http://cdn.sockjs.org/sockjs-0.2.js",false,true,
                         5000,25000,131072,5000,
                         #Fun<sockjs_handler.0.34008514>}
** Handler state was {websocket,<0.158.0>,{#Ref<0.0.0.8840>,5000}}
** Request was {http_req,#Port<0.2609>,cowboy_tcp_transport,keepalive,
                         <0.157.0>,'GET',
                         {1,1},
                         {{127,0,0,1},59316},
                         [<<"localhost">>],
                         undefined,<<"localhost">>,8081,
                         [<<"amplify">>,<<"0">>,<<"0">>,<<"websocket">>],
                         [<<"0">>,<<"0">>,<<"websocket">>],
                         <<"/amplify/0/0/websocket">>,undefined,<<>>,[],
                         [{<<"Sec-Websocket-Version">>,<<"13">>},
                          {<<"Sec-Websocket-Key">>,
                           <<"FVKay/apSU2ZytGQBD2aBw==">>},
                          {<<"Origin">>,<<"localhost:8081">>},
                          {'Host',<<"localhost">>},
                          {'Connection',<<"Upgrade">>},
                          {'Upgrade',<<"websocket">>}],
                         [{'Upgrade',[<<"websocket">>]},
                          {'Connection',[<<"upgrade">>]}],
                         undefined,
                         [{websocket_version,13}],
                         waiting,<<>>,done,[],<<>>,
                         {#Fun<cowboy_http.urldecode.2>,crash}}
** Stacktrace: [{gen_server,call,3},
                {sockjs_session,received,2},
                {sockjs_ws_handler,session_received,2},
                {sockjs_cowboy_handler,websocket_handle,3},
                {cowboy_http_websocket,handler_call,7},
                {cowboy_http_protocol,upgrade_protocol,3}]

To reproduce pip install websocket-client and:

from websocket import create_connection
ws = create_connection("ws://localhost:8081/amplify/0/0/websocket")

result =  ws.recv()
print "Received '%s'" % result


for i in range(10000):
    ws.send('["18"]')


#    ws.send('["18"]')
result =  ws.recv()
majek added a commit that referenced this issue Nov 26, 2012
…5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
majek added a commit that referenced this issue Dec 14, 2012
…5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
gebi pushed a commit to gebi/sockjs-erlang that referenced this issue Apr 10, 2013
…ck in 5 seconds

Timeout mechanism is broken with regard to websockets. cowboy process might be overloaded by incoming messages (And session not being able to pick them up quickly enough). If that happens, it's quite likely that session process will receive a timeout after 5 seconds of not having the 'reply' call. This seems to be less of a big deal for non-ws transports as they don't neccesairly come via a signle bottleneck process - receiver is different than sender.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant