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

[Network] Prune / disconnect TCP connections gracefully #4574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Akkadius
Copy link
Member

@Akkadius Akkadius commented Dec 15, 2024

Description

This fixes an issue with our server TCP connections not closing gracefully. In the past we've used empty packet keepalives inter-process to have the server prune the connections immediately.

This PR should also significantly reduce keepalive load / chatter with servers with large amounts of processes.

Thanks to solar from Tak for code pairing on related issue #4573

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing

This is after killing 3 zone processes and below we see World disconnect the zoneserver on UV_EOF - we would see similarly for any other Server -> Server connection or Server -> Client that uses this connection class (Console, Websocket)

eqemu@83d7385f74ee:~/server$ pkill zone
  Zone |    Info    | Shutdown Shutting down... 
  Zone |    Info    | Shutdown Shutting down... 
  Zone |    Info    | Shutdown Shutting down... 
eqemu@83d7385f74ee:~/server$   Zone |    Info    | main Proper zone shutdown complete. 
  Zone |    Info    | main Proper zone shutdown complete. 
  Zone |    Info    | main Proper zone shutdown complete. 
 World |    Info    | operator() UV_EOF - Closing connection 
 World |    Info    | operator() Removed Zone Server connection from [85e3a0f1-4e45-4ae8-9dd6-69e7b8a83546] total zone_count [2] 
 World |    Info    | operator() UV_EOF - Closing connection 
 World |    Info    | operator() Removed Zone Server connection from [6146795f-f0b9-4e56-93a1-8c6535cc75b7] total zone_count [1] 
 World |    Info    | operator() UV_EOF - Closing connection 
 World |    Info    | operator() Removed Zone Server connection from [71d4c857-36a2-44e5-b8ad-24c0dca6b7cb] total zone_count [0] 

Inverse where we kill World and all zones close their connection to World

eqemu@83d7385f74ee:~/server$ pkill world
 World |    Info    | CatchSignal Caught signal [15] 
eqemu@83d7385f74ee:~/server$  World |    Info    | main World main loop completed 
 World |    Info    | main Shutting down zone connections (if any) 
 World |    Info    | main Zone (TCP) listener stopped 
 World |    Info    | main Signaling HTTP service to stop 
  Zone |    Info    | operator() UV_EOF - Closing connection 
  Zone |    Info    | operator() UV_EOF - Closing connection 
  Zone |    Info    | operator() UV_EOF - Closing connection 

Similar test with UCS

eqemu@83d7385f74ee:~/code/build$ pkill ucs
   UCS |    Info    | CatchSignal Caught signal [15] 
eqemu@83d7385f74ee:~/code/build$    UCS |    Info    | Shutdown Shutting down... 
 World |    Info    | operator() UV_EOF - Closing connection 
 World |    Info    | operator() Connection lost from UCS Server [f0c765cc-aa85-4162-8156-58c731e4809b] 
 World |    Info    | operator() Removing currently active UCS connection 

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I own the changes of my code and take responsibility for the potential issues that occur

regneq added a commit to EQMacEmu/Server that referenced this pull request Dec 15, 2024
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

Successfully merging this pull request may close these issues.

2 participants