Bitlab
asked on
Websocket through haproxy reused connection causes "Not a valid frame" error.
Hello Experts.
Websocket-client connects to websocket-server through haproxy.
Sometimes transmission works, sometimes not.
Websocket-client is based on python2.6/site-packages/we bsocket_cl ient-0.7.0 -py2.6.egg /websocket .py
Websocket-server based on c++ library.
Haproxy version is 1.5.x
As you can see, websocket client reuses connection when python-script is reentered.
Note, if not to reuse the connection, there are no errors.
How get rid of this error?
#must we put here something to "flush" the "mysterios" ws "buffer"? ( See this comment in script )
Script, error-trace, haproxy.cfg and log are attached.
Thank you.
script-and-error.txt
haproxy-cfg-and-log.txt
Websocket-client connects to websocket-server through haproxy.
Sometimes transmission works, sometimes not.
Websocket-client is based on python2.6/site-packages/we
Websocket-server based on c++ library.
Haproxy version is 1.5.x
As you can see, websocket client reuses connection when python-script is reentered.
Note, if not to reuse the connection, there are no errors.
How get rid of this error?
#must we put here something to "flush" the "mysterios" ws "buffer"? ( See this comment in script )
Script, error-trace, haproxy.cfg and log are attached.
Thank you.
script-and-error.txt
haproxy-cfg-and-log.txt
ASKER
Thanks.
"reusing a connection which might not be terminated properly or is still used by someone" -
this kills a speed which is a purpose of keeping connection alive.
and how can it be terminated non-properly?
and who else can use the connection? the socket open between client, haproxy, and a server: there is no middle man
"reusing a connection which might not be terminated properly or is still used by someone" -
this kills a speed which is a purpose of keeping connection alive.
and how can it be terminated non-properly?
and who else can use the connection? the socket open between client, haproxy, and a server: there is no middle man
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, Sara.
Apparently your solution works: I increased timeouts to:
timeout client 2400s
timeout server 2400s
and there are no more errors. It may happen on the boundary of 2400, but at least I know now where to troubleshoot. It looks so simple now.
"if you do so, you never need to reuse but only use the one and ever alive connection managed by the thread. " I meant this when spoke about "reusing". I meant just checking that socket i is alive by
if ws == None:
means that connection is not closed.
Thanks a lot again.
Apparently your solution works: I increased timeouts to:
timeout client 2400s
timeout server 2400s
and there are no more errors. It may happen on the boundary of 2400, but at least I know now where to troubleshoot. It looks so simple now.
"if you do so, you never need to reuse but only use the one and ever alive connection managed by the thread. " I meant this when spoke about "reusing". I meant just checking that socket i is alive by
if ws == None:
means that connection is not closed.
Thanks a lot again.
reusing a connection which might not be terminated properly or is still used by someone, always makes trouble and it is difficult to impossible to handle this.
Sara