wangshen2014 / pywebsocket

Automatically exported from code.google.com/p/pywebsocket
0 stars 0 forks source link

https/wss fails on Chrome and Safari, but not firefox. #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Connect to server with https and wss. Server is open to let client send an 
initial string which the server receives. Immediately after the sever reports 
receiving a null string and cuts the connection. Error log shows python has had 
a segmentation fault.
2. Do same steps with http and ws and the connection works fine.
3. Firefox still works but Chrome and safari show this error.

What is the expected output? What do you see instead?
Connection should be the same with http/ws and https/wss

What version of the product are you using? On what operating system?
Latest as of 1/27/12 and latest versions of browsers. Server is running on 
CentOS 4/5 64bit.

Please provide any additional information below.
As stated the connection is lost every time with a null string warning and then 
the error log shows python has a segmentation fault.

Original issue reported on code.google.com by sdid...@gmail.com on 27 Jan 2012 at 8:25

GoogleCodeExporter commented 9 years ago
Which mode are you using pywebsocket in? standalone or with Apache.

Could you please also give us stack trace or error log around the segmentation 
fault if possible? If you're using it with Apache, you can get more detailed 
log from pywebsocket by changing LogLevel of Apache to debug.

Original comment by tyoshino@chromium.org on 30 Jan 2012 at 8:20

GoogleCodeExporter commented 9 years ago
We are using with Apache.

Original comment by sdid...@gmail.com on 30 Jan 2012 at 2:58

GoogleCodeExporter commented 9 years ago
Stack trace to follow.

Original comment by sdid...@gmail.com on 30 Jan 2012 at 2:59

GoogleCodeExporter commented 9 years ago
Stack information:

apache error log (debug level):

[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake: Client's opening handshake resource: 
'/wss/mustang/client'
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake: Client's opening handshake headers: {'Origin': 
'https://bmw2', 'Upgrade': 'websocket', 'Sec-WebSocket-Version': '13', 'Host': 
'bmw2', 'Sec-WebSocket-Key': 'fL8MtY99Eb0es6DBZoLhZg==', 'Connection': 
'Upgrade'}
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake: Trying IETF HyBi latest protocol
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake.hybi.Handshaker: Sec-WebSocket-Key: 
'fL8MtY99Eb0es6DBZoLhZg==' (7c bf 0c b5 8f 7d 11 bd 1e b3 a0 c1 66 82 e1 66)
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake.hybi.Handshaker: Sec-WebSocket-Accept: 
'ZYQIvHVYArAA4ZV7pR6tvln1Om4=' (65 84 08 bc 75 58 02 b0 00 e1 95 7b a5 1e ad be 
59 f5 3a 6e)
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake.hybi.Handshaker: IETF HyBi protocol
[Mon Jan 30 08:06:14 2012] [debug] _apachemodule.c(65): 
mod_pywebsocket.handshake.hybi.Handshaker: Sent server's opening handshake: 
'HTTP/1.1 101 Switching Protocols\\r\\nUpgrade: websocket\\r\\nConnection: 
Upgrade\\r\\nSec-WebSocket-Accept: ZYQIvHVYArAA4ZV7pR6tvln1Om4=\\r\\n\\r\\n'
[Mon Jan 30 08:06:14 2012] [info] mod_pywebsocket.handshake: Established (IETF 
HyBi latest protocol)
[Mon Jan 30 08:06:15 2012] [notice] child pid 14612 exit signal Segmentation 
fault (11)

Our log has lines like:
######Made it to parse the packet
######Session ID is: C7D9EC1B-3D2C-416C-8472-09BE8BBCE6F2
######RU:  Got the session id: 11
######on to make the thread
###1###ready to make thread
###starting a queue for :client_queue_11
######thread made, name is: client_queue_11
######thread name inserted into DB sql was: UPDATE `Session` SET 
`WSQueueTableName` = 'client_queue_11' WHERE `User_ID` = '11';
###queue_out_to_client:  User_ID is: 11 sending message:
######Got an empty line, this will cause a socket close
###    !!!!!!!!   Send out message from thread failed:

The first two lines of our log indicate that the socket was open and the client 
sent his sessionID to the server with no problem.

Original comment by sdid...@gmail.com on 30 Jan 2012 at 3:15

GoogleCodeExporter commented 9 years ago
Firefox updated and now it also fails.

Original comment by sdid...@gmail.com on 7 Feb 2012 at 10:33

GoogleCodeExporter commented 9 years ago
Hmm, it works here with Apache. If possible, could you please tell me the 
interaction with mod_pywebsocket which caused segfault on your environment?

Maybe, you receive a packet by receive_message() call and parse the returned 
value into 
 C7D9EC1B-3D2C-416C-8472-09BE8BBCE6F2 and something. Then you called send_message() with some argument maybe containing 11.

That's all?

Original comment by tyoshino@chromium.org on 8 Feb 2012 at 4:05

GoogleCodeExporter commented 9 years ago
It appears that we may have a problem with our ssl certificate on the target 
machine. With https we can just tell it to ignore it, but on WSS it is not 
liking it. We are still looking at the issue and are about to update the 
certificate to verify.

Original comment by sdid...@gmail.com on 9 Feb 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Fixed the certificate and things got normal in a hurry. Sorry for posting the 
issue as the problem was between my keyboard and chair.

Original comment by sdid...@gmail.com on 12 Feb 2012 at 4:36

GoogleCodeExporter commented 9 years ago
Got it. Thanks.

Original comment by tyoshino@chromium.org on 22 Feb 2012 at 5:30

GoogleCodeExporter commented 9 years ago
We actually had problems again with the last release of the socket protocol. 
The issue it turns out was not pywebsockets but the CentOS distribution we were 
using. We changed over to Fedora and it worked like a champ with the same 
configuration. This is probably better posted in the CentOS user group but in 
case anyone else has the problem..... Thanks for your patience!

Original comment by sdid...@gmail.com on 28 Feb 2012 at 5:50