Skip to content

fix: improve RADIUS client error handling and socket cleanup#6783

Merged
CommanderStorm merged 3 commits intolouislam:masterfrom
sharpenteeth:improve-ping-error-handling
Jan 22, 2026
Merged

fix: improve RADIUS client error handling and socket cleanup#6783
CommanderStorm merged 3 commits intolouislam:masterfrom
sharpenteeth:improve-ping-error-handling

Conversation

@sharpenteeth
Copy link
Copy Markdown
Contributor

Changes

This PR improves error handling and resource cleanup in the RADIUS client implementation.

Improvements

  1. Enhanced error messages (server/util-server.js):

    • Preserves error stack traces for better debugging
    • Adds hostname and port context to error messages
    • Maintains original error information for troubleshooting
  2. Fixed race conditions and memory leaks (server/radius-client.js):

    • Added proper socket cleanup function to prevent multiple cleanup calls
    • Introduced socketClosed flag to prevent operations on closed sockets
    • Improved timeout handling to ensure resources are properly released
    • Fixed potential race conditions between timeout callbacks and response handlers

Benefits

  • Better error messages help identify RADIUS authentication issues faster
  • Prevents potential memory leaks from improperly closed sockets
  • Eliminates race conditions that could cause unexpected behavior
  • More robust error handling improves overall reliability

Testing

These changes maintain backward compatibility and improve error handling without changing the API contract.

- Enhanced error messages in util-server.js to preserve stack traces and provide better context with hostname and port information
- Fixed potential race conditions in radius-client.js by adding proper socket cleanup and preventing multiple cleanup calls
- Added socketClosed flag to prevent operations on closed sockets
- Improved timeout handling to prevent memory leaks and ensure proper resource cleanup
@github-actions
Copy link
Copy Markdown
Contributor

Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
As this is your first contribution, please be sure to check out our Pull Request guidelines.
In particular: - Mark your PR as Draft while you’re still making changes - Mark it as Ready for review once it’s fully ready
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

@sharpenteeth sharpenteeth changed the title Improve RADIUS client error handling and socket cleanup fix: improve RADIUS client error handling and socket cleanup Jan 21, 2026
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shure, thanks

@CommanderStorm CommanderStorm enabled auto-merge (squash) January 22, 2026 12:53
@CommanderStorm CommanderStorm merged commit 236d742 into louislam:master Jan 22, 2026
24 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@dive2tech congrats on your first contribution to Uptime Kuma! 🐻
We hope you enjoy contributing to our project and look forward to seeing more of your work in the future! If you want to see your contribution in action, please see our nightly builds here.

@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 29, 2026
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