This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200-LAUNCHXL: CC3200 Websock handshake request problem

Part Number: CC3200-LAUNCHXL
Other Parts Discussed in Thread: CC3200

One issue has surfaced on my board wherein i can see very rare the websocket connection is not getting established!

CC3200 board is acting as webserver and IOS enabled device is acting as webclient.

When i debugged further its found that during error case the complete Websock handshake request is not received. So server continues to wait for complete packet and doesn't change the state machine.

Surprisingly the problem exist until i restart the CC3200 LaunchXL board.

Note: Websock camera application of SDK is used.

Can someone guide here? I am planning to use a sniffer next.

  • Hi @parth,

    Where in the code do you observe this failure? Is there an error code that is returned at some point during the failure case?
    If this case is rare and caused by a bad handshake, perhaps a timeout can help in recovering from this error.

    Please point me to where in the code you see the application is encountering this issue, so that I can examine it further and see what might be causing the issue.

    Regards,
    Michael
  • Hi Michael,

    I am trying to reproduce the issue again, will update asap!

    Another issue appeared now frequently if stress the system and try to send connect and websock message very fast from IOS device.

    FAULT_ISR appears due to "bus fault" but the memory at address 0xE000.ED38 point to 0x00c1dd89(varies) which is invalid memory. How to find the root cause of this? This issue can be easily reproduced!

    Reproduction step: websock connect <> disconnect continuously multiple time will result fault.

    Can you please share your thoughts!

    Regards,
    Partha

  • Hi Partha,

    For the bus fault error, are you connecting + disconnecting rapidly using the web interface at camera_demo.html? I can't seem to replicate it on my end using the web interface on chrome.

    If you haven't done so already, you can try compiling your project while enabling the UART debug interface. By default, the websockets project has the NOTERM symbol defined, which suppresses the UART debug output. If you remove that define, then you'll be able to see debug messages print on the CC3200 COM port, which might help you pinpoint the problem.

    Regards,
    Michael
  • Hi Michael,

    Yes the issue is seen on rapid connect disconnect.

    Did you enable logs while testing? I am unable to reproduce crash issue with logs enabled.

    Is there a possibility if HTTP connection will increase beyond 10 and may result crash?

    One observation is that the HTTP connections are not cleared when the

    SL_WLAN_STA_DISCONNECTED_EVENT is received!

    **********Few more debug and I found **************

    Sometime the http max socket limit reaches to 7 and they are not cleared.

    Below logs are from gstate: connection reached 7 and due to bad application I guess the complete header didn't reach and stack halts.

    Note: IOS library socketstram is used.

    /***************************************************************************************************/

    g_state struct HttpGlobalState {listenSocket=16,uOpenConnections=7,connections=[{connectionState=WebSocketRequest,dataSocket=...,...,packetRecv=... 0x20032408 
     listenSocket int 16 0x20032408 
     uOpenConnections unsigned short 7 0x2003240C 
     connections struct HttpConnectionData[10] [{connectionState=WebSocketRequest,dataSocket=20,request={uFlags=80,uConnection=...,handler=...,... 0x20032410 
      [0] struct HttpConnectionData {connectionState=WebSocketRequest,dataSocket=20,request={uFlags=80,uConnection=0,requestContent=...,handler=... 0x20032410 
       connectionState enum HttpConnectionState WebSocketRequest 0x20032410 
       dataSocket int 20 0x20032414 
       request struct HttpRequest {uFlags=80,uConnection=0,requestContent={uLength=0,pData=0x00000000 {0 '\x00'}}} 0x20032418 
       handler enum HttpHandler None 0x20032424 
       headerStart unsigned char[320] [151 '\x97',0 '\x00',0 '\x00',151 '\x97',151 '\x97'...] 0x20032425 
       uContentLeft unsigned long 0 0x20032568 
       timeout unsigned long 0 0x2003256C 
       uSavedBufferSize unsigned short 99 0x20032570 
       HttpAuth unsigned char 0 '\x00' 0x20032572 

    Regards,

    Partha

  • Hi Michael,

    I am able to capture logs attached here

    Binary data
    
                                                                       
    Http accept retry -11
                                                              
    Http receive retry -11
                                                             
    Http accept retry -11
     
                                                            
                          
                                                            
     Http Client Data received 10
                                                      
    Final datablock received 
        
                                                     
    Opcode is 9
                  
                                                         
    Ping received
                                                                      
    You were Pinged
                                                                    
    line: ŠPING 
      
                                                                   
    Http accept retry -11
                                                              
                          
                                                            
     Http Client Data received 8
                                                       
    Final datablock received 
       
                                                      
    Opcode is 8
                  
                                                         
    Client has requested connection to be closed
                                       
    line: ˆ1000ok! 
                                
                                      
    Close connection
    
                                                                  
                     
                                                                 
     Http client socket closed
                                                         
    Http accept retry -11
         
                                                        
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Http accept retry -11
    
                                                             
    Accepting new connection number 0 
                                                 
                                       
                                               
     Http Client Data received 278
                                                     
    line: GET / HTTP/1.1 
             
                                                    
    method Header: get / http/1.1 
                                                     
    line: Origin: ws://192.168.1.77 
                                                   
    line: Host: 192.168.1.77:80 
        
                                                  
    line: Sec-WebSocket-Version: 13 
                                                   
    line: Connection: Upgrade 
          
                                                  
    line: Upgrade: websocket 
     
                                                        
    line: Sec-WebSocket-Key: bGN0bHl3eGRxa21ydGZudg== 
                                 
    key: line: Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits;
     server_max_window_bits=15 
                                                        
    line:  
                        
                                                       
    line: HTTP/1.1 101 Web Socket Protocol Handshake
                                  
    Upgrade: websocket
                                                                
    Connection: Upgrade
                                                               
    Sec-websocket-accept: /onHx6CW3hKf5M3+CbZLB/xuwW8=
                                
    Server: CC3200
                                                                    
    Access-Control-Allow-Origin: ws://192.168.1.77
                                    
    Access-Control-Allow-Credentials: true
                                            
    Access-Control-Allow-Headers: content-type
                                        
    Access-Control-Allow-Headers: authorization
                                       
    Access-Control-Allow-Headers: x-websocket-version
                                 
    Access-Control-Allow-Headers: x-websocket-protocol
                                
    Access-Control-Allow-Headers: x-websocket-extensions
                              
                                                          
                            
     
                                                                                  
    [New Websock connection ] Close old connection  0
                                  
    [New Websock connection ] New connection handle 0
    
                                 
    Http accept retry -11
                                
                                 
                          
                                                            
     Http Client Data received 8
                                                       
    Final datablock received 
       
                                                      
    Opcode is 8
                  
                                                         
    Client has requested connection to be closed
                                       
    line: ˆ1000ok 
                                
                                      
    Close connection
    
                                                                  
                     
                                                                 
     Http client socket closed
                                                         
    Accepting new connection number 0 
                                                 
                                       
                                               
     Http Client Data received 278
                                                     
    line: GET / HTTP/1.1 
             
                                                    
    method Header: get / http/1.1 
                                                     
    line: Origin: ws://192.168.1.77 
                                                   
    line: Host: 192.168.1.77:80 
        
                                                  
    line: Sec-WebSocket-Version: 13 
                                                   
    line: Connection: Upgrade 
          
                                                  
    line: Upgrade: websocket 
     
                                                        
    line: Sec-WebSocket-Key: c2dvc3NydXdka2t4c3Zxbw== 
                                 
    key: line: Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits;
     server_max_window_bits=15 
                                                        
    line:  
                        
                                                       
    line: HTTP/1.1 101 Web Socket Protocol Handshake
                                  
    Upgrade: websocket
                                                                
    Connection: Upgrade
                                                               
    Sec-websocket-accept: kw==
                                                        
    Server: CC3200
                                                                    
    Access-Control-Allow-Origin: ws://192.168.1.77
                                    
    Access-Control-Allow-Credentials: true
                                            
    Access-Control-Allow-Headers: content-type
                                        
    Access-Control-Allow-Headers: authorization
                                       
    Access-Control-Allow-Headers: x-websocket-version
                                 
    Access-Control-Allow-Headers: x-websocket-protocol
                                
    Access-Control-Allow-Headers: x-websocket-extensions
                              
                                                          
                            
     
                                                                                  
    [New Websock connection ] Close old connection  0
                                  
    [New Websock connection ] New connection handle 0
    
                                 
    Accepting new connection number 1 
                   
                                 
                                       
                                               
     Http Client close 0
                                                               
    Close connection
        
                                                              
                     
                                                                 
     Http client socket closed
                                                         
                               
                                                       
     Http Client Data received 278
                                                     
    line: GET / HTTP/1.1 
             
                                                    
    method Header: get / http/1.1 
                                                     
    line: Origin: ws://192.168.1.77 
                                                   
    line: Host: 192.168.1.77:80 
        
                                                  
    line: Sec-WebSocket-Version: 13 
                                                   
    line: Connection: Upgrade 
          
                                                  
    line: Upgrade: websocket 
     
                                                        
    line: Sec-WebSocket-Key: bmt1ZHRmbnlscWl0cGRiZw== 
                                 
    key: line: Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits;
     server_max_window_bits=15 
                                                        
    line:  
                        
                                                       
    line: HTTP/1.1 101 Web Socket Protocol Handshake
                                  
    Upgrade: websocket
                                                                
    Connection: Upgrade
                                                               
    Sec-websocket-accept: q7AsCIIas2Jt+FHJiimu4GM+zAM=
                                
    Server: CC3200
                                                                    
    Access-Control-Allow-Origin: ws://192.168.1.77
                                    
    Access-Control-Allow-Credentials: true
                                            
    Access-Control-Allow-Headers: content-type
                                        
    Access-Control-Allow-Headers: authorization
                                       
    Access-Control-Allow-Headers: x-websocket-version
                                 
    Access-Control-Allow-Headers: x-websocket-protocol
                                
    Access-Control-Allow-Headers: x-websocket-extensions
                              
                                                          
                            
     
                                                                                  
    [New Websock connection ] Close old connection  0
                                  
    [New Websock connection ] New connection handle 1
    
                                 
    Http accept retry -11
                                
                                 
                          
                                                            
     Http Client Data received 8
                                                       
    Final datablock received 
       
                                                      
    Opcode is 8
                  
                                                         
    Client has requested connection to be closed
                                       
    line: ˆ1000ok— 
                                
                                      
    Close connection
    
                                                                  
                     
                                                                 
     Http client socket closed
                                                         
    Accepting new connection number 0 
                                                 
                                       
                                               
     Http Client Data received 278
                                                     
    line: GET / HTTP/1.1 
             
                                                    
    method Header: get / http/1.1 
                                                     
    line: Origin: ws://192.168.1.77 
                                                   
    line: Host: 192.168.1.77:80 
        
                                                  
    line: Sec-WebSocket-Version: 13 
                                                   
    line: Connection: Upgrade 
          
                                                  
    line: Upgrade: websocket 
     
                                                        
    line: Sec-WebSocket-Key: YXJucWdhZWdsdHdieWJiaQ== 
                                 
    key: line: Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits;
     server_max_window_bits=15 
                                                        
    line:  
                        
                                                       
    line: HTTP/1.1 101 Web Socket Protocol Handshake
                                  
    Upgrade: websocket
                                                                
    Connection: Upgrade
                                                               
    Sec-websocket-accept: 682iRcfBrOIVzI/o53kBp5jwMsM=
                                
    Server: CC3200
                                                                    
    Access-Control-Allow-Origin: ws://192.168.1.77
                                    
    Access-Control-Allow-Credentials: true
                                            
    Access-Control-Allow-Headers: content-type
                                        
    Access-Control-Allow-Headers: authorization
                                       
    Access-Control-Allow-Headers: x-websocket-version
                                 
    Access-Control-Allow-Headers: x-websocket-protocol
                                
    Access-Control-Allow-Headers: x-websocket-extensions
                              
                                                          
                            
     
                                                                                  
    [New Websock connection ] Close old connection  1
                                  
    [New Websock connection ] New connection handle 0
    
                                 
    Http accept retry -11
                                
                                 
                          
                                                            
     Http Client Data received 8
                                                       
    Final datablock received 
       
                                                      
    Opcode is 8
                  
                                                         
    Client has requested connection to be closed
                                       
    line: ˆ1000ok­ 
                                
                                      
    Close connection
    
                                                                  
                     
                                                                 
     Http client socket closed
                                                         
    Accepting new connection number 0 
                                                 
                                       
                                               
     Http Client Data received 278
                                                     
    line: GET / HTTP/1.1 
             
                                                    
    method Header: get / http/1.1 
                                                     
    line: Origin: ws://192.168.1.77 
                                                   
    line: Host: 192.168.1.77:80 
        
                                                  
    line: Sec-WebSocket-Version: 13 
     
    
    . Please check if its helpful to identify the issue.

    Which timeout do I need to increase? As it seems endofmarker in header is not received after few header in the packet. The issue exist until I restart the board.

    Regards,
    Partha