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

CLOG looses connection data if websocket is interrupted multiple times #379

Open
svetlyak40wt opened this issue Aug 27, 2024 · 3 comments
Open

Comments

@svetlyak40wt
Copy link
Contributor

I've investigated how does CLOG tutorials work and was wondered how CLOG survives diconnections. That is how I found the problem.

  1. I started the 11 tutorial and opened the page in the browser.
  2. Set (setf clog-connection:*verbose-output* t)
  3. Opened clog-connection::*connection-data* in the inspector. And found there is one connection
  4. In a separate terminal started the command tcpkill -i lo port 8080 to drop websocket connections.
  5. In the REPL I've seen messages about connection closing and transferring (the full log is at the end of the issue.
  6. I stopped the tcpkill.
  7. I've refreshed view of the clog-connection::*connection-data* in the inspector. And it show no connections.
  8. When I tried to push button on the web page, the full page reload had place instead of the form submission.

Looking at the log, I might suppose that the cause of the problem in the order of how new connections are closed - they are dying before reconnection has happened. Also, seems the whole reconnection step should be done under the lock to protect connection-data integrity.

Full log:

Connection 1bcdf267afeadaa429875fc745d8289a    Ping                                                                                           
Connection 1bcdf267afeadaa429875fc745d8289a    Ping                                                                                           
Connection 1bcdf267afeadaa429875fc745d8289a    Ping                                                                                           
Connection close request #<SERVER {10078909E3}>.                                                                                              
Connection close request #<SERVER {10078909E3}> delayed 7 for reconnects.                                                                     
Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {1007941133}>                                                                  
Transfer id - #<SERVER {10078909E3}> => #<SERVER {1007941133}>Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {10079C09F3}>    
Transfer id - #<SERVER {1007941133}> => #<SERVER {10079C09F3}>Connection close request #<SERVER {10079C09F3}>.                                
Connection close request #<SERVER {10079C09F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {1007941133}>.                                                                                              
Connection close request #<SERVER {1007941133}> delayed 7 for reconnects.                                                                     
Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {10079E89F3}>                                                                  
Transfer id - #<SERVER {10079C09F3}> => #<SERVER {10079E89F3}>Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {1007A209F3}>    
Transfer id - #<SERVER {10079E89F3}> => #<SERVER {1007A209F3}>Connection close request #<SERVER {1007A209F3}>.                                
Connection close request #<SERVER {1007A209F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {10079E89F3}>.                                                                                              
Connection close request #<SERVER {10079E89F3}> delayed 7 for reconnects.                                                                     
Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {1007A409F3}>                                                                  
Transfer id - #<SERVER {1007A209F3}> => #<SERVER {1007A409F3}>Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {1007A689F3}>    
Transfer id - #<SERVER {1007A409F3}> => #<SERVER {1007A689F3}>Reconnection id - 1bcdf267afeadaa429875fc745d8289a to #<SERVER {1007AB09F3}>    
Transfer id - #<SERVER {1007A689F3}> => #<SERVER {1007AB09F3}>Connection close request #<SERVER {1007A409F3}>.                                
Connection close request #<SERVER {1007A409F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {1007A689F3}>.                                                                                              
Connection close request #<SERVER {1007A689F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {1007AB09F3}>.                                                                                              
Connection close request #<SERVER {1007AB09F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {10078909E3}>.                                                                                              
Connection close request #<SERVER {10078909E3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {10079C09F3}>.                                                                                              
Connection close request #<SERVER {10079C09F3}> delayed 7 for reconnects.                                                                     
Connection close request #<SERVER {1007A209F3}>.                                                                                              
Connection close request #<SERVER {1007A209F3}> delayed 7 for reconnects.                                                                     
Connection id 1bcdf267afeadaa429875fc745d8289a has closed. #<SERVER {1007AB09F3}>                                                             
Connection close request #<SERVER {1007AB09F3}>.                                                                                              
Connection close request #<SERVER {1007AB09F3}> delayed 7 for reconnects.
@rabbibotton
Copy link
Owner

I will take a look at this soon. In theory a disconnect for more than the set 7 seconds (that is configurable) can not be restored. If your application has long disconnects you can just set that number higher (setf clog-connection:reconnect-delay 7).

@svetlyak40wt
Copy link
Contributor Author

I've interrupted tcp killer within a few seconds. So, it should be enough time to recover.

But to ensure, I'll experiment with longer timeout.

@rabbibotton
Copy link
Owner

In fairness I need to take a good look at the ticket but super busy so could be I am off :)

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

2 participants