ha-unraid: unRAID Logs Full From Too Many Sessions

Describe the Bug

unRAID logs are getting “spammed” by integration and exhausting disk space for the log with many entries for this per second:

Feb 12 05:26:09 Tower sshd-session[11597]: Starting session: command for root from 192.168.100.143 port 55868 id 1 Feb 12 05:26:09 Tower sshd-session[11597]: Close session: user root from 192.168.100.143 port 55868 id 0

Expected Behavior

unRaid integration for HASS should not “spam” the unRAID log causing it to fill up and prevent other unRAID operations, such as new Docker installs.

Steps To Reproduce (if applicable)

Image


Screenshots

If applicable, add screenshots to help explain your problem.


Debug Log

Provide the debug log of the integration (Enable Debug Logging and Reload Integration).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 26 (8 by maintainers)

Most upvoted comments

Hi @Guruleenyc,

This issue has been significantly addressed through comprehensive SSH connection management improvements in the current version of the integration.

SSH Session Management Implementation Status

The integration now includes advanced connection pooling and session management to prevent SSH log spam:

Connection Pooling Features

  • Connection reuse: Maintains a pool of 3 persistent SSH connections with 10-minute lifetimes
  • Session persistence: Connections are reused across multiple commands instead of creating new sessions
  • Intelligent cleanup: Automatic connection health monitoring and cleanup of stale connections
  • Circuit breaker: Prevents connection storms during network issues

Batched Command Execution

  • Reduced session count: Multiple operations are batched into single SSH sessions
  • Optimized data collection: System stats, disk info, and Docker data collected in fewer commands
  • Smart scheduling: Commands are grouped to minimize connection overhead

Connection Lifecycle Management

  • Keepalive settings: 30-second keepalive intervals prevent premature disconnections
  • Connection health checks: Regular validation ensures connections remain active
  • Graceful degradation: Failed connections are properly cleaned up and replaced

How to Apply the Fix

Manual Update

  1. Download the latest version from the GitHub repository
  2. Copy the unraid folder to your Home Assistant custom_components directory
  3. Restart Home Assistant
  4. The new connection management will automatically reduce SSH session creation

Expected Results

After updating, you should see:

  • Dramatically reduced SSH log entries: Connection pooling eliminates session spam
  • Stable log file sizes: No more log exhaustion from integration activity
  • Improved performance: Fewer connection overhead and faster data updates
  • Better reliability: Circuit breaker prevents connection storms

Verification

To confirm the fix is working:

  1. Monitor Unraid logs: SSH session entries should be significantly reduced
  2. Check integration logs: Look for “Reusing existing connection” debug messages
  3. Observe log file growth: Log files should maintain reasonable sizes

@Guruleenyc @Rudder2 I did some research and will be releasing a fix this week.

@domalab are you saying that most of the existing 131 entities, many of which I have dependent automations for, will become unavailable for new entities?

Yes, the new code contains breaking changes unfortunately due to refactoring and fixing many bugs.

The current release’s entity naming pattern doesn’t follow home assistant’s best practises

Eg. Duplicate host names in entities naming. Eg duplicate server names “cube_cube”

  • sensor.unraid_server_cube_cube_array_disk1_usage
  • binary_sensor.unraid_server_cube_cube_array_disk1_health
  • switch.unraid_server_cube_cube_docker_code_server
  • button.unraid_server_cube_cube_run_delete_dangling_images_background

The updated code fixes the naming pattern.

  • sensor.cube_array_usage
  • binary_sensor.cube_array_status
  • switch.cube_code_server
  • button.cube_delete_dangling_images_background

And the Disk Update Interval and General Update intervals has changed from the current slider options to a dropdown list. This is to add minutes and hours option for disk update intervals and I did the same for general update intervals for consistency in the UI.

Image

I’m also looking at adding support for SSH keys and that will also be a breaking change as the integration setup flow will change to multi-step flow process - https://github.com/domalab/ha-unraid/issues/15

Maybe hold off for a while until it’s in place.

@Guruleenyc @Rudder2 I did some research and will be releasing a fix this week.

Any update?

@Guruleenyc @Rudder2 You can try the updated code and see if it works for you. You will need to manually copy the unraid folder and contents to you HA instance and overwrite existing code. Restart HA and see what happens.

Just an FYI You will still see ssh connection logs in unraid but the integration now only uses up to a maximum of 3 connections and then recycles same connections. Shouldn’t need to restart unraid sshd service anymore. You will also see warnings in the HA logs for High Memory usage from Unraid integration but that is normal as it now uses a small cache to improve sensor performance. It automatically clears the cache.

Your entity names will be updated to follow cleaner naming pattern, so you might or might not see old entities.

@Guruleenyc @Rudder2 I did some research and will be releasing a fix this week.

Any update?

@domalab Thank you! Your work is appreciated.

@domalab any update or progress on this bug? Due to this integration I am not able to SSH into my unraid server as a result of all the sessions being exhausted

No update. I don’t know how to fix it yet.

Yes it resolved the issue for me, since I put in that user script that you provided me I no longer have syslog spamming and filling up my log file location. But I’m running unraid version 6 12.14. I typically do not upgrade to bleeding edge major versions of Unraid until after they’ve been out GA for at least 30 days.

Thanks for letting me know it works.

Yes it resolved the issue for me, since I put in that user script that you provided me I no longer have syslog spamming and filling up my log file location. But I’m running unraid version 6 12.14. I typically do not upgrade to bleeding edge major versions of Unraid until after they’ve been out GA for at least 30 days.

@Guruleenyc Try this https://github.com/domalab/ha-unraid/wiki/Troubleshooting#ssh-session-log-spam

I tried this and it didn’t work for me on 7.0.1. Anything else to try?

@Rudder2 No idea to be honest. It’s working fine for me. @Guruleenyc is it working for you?

Unraid is releasing their offical API in a few weeks and I’m working on an integration based on that which is better.

Here’s the experimental version of the new integration if you want to take a look but still lots of features missing due to API not supporting it yet

https://github.com/domalab/ha-unraid-connect

Thank you! I’m surprised I missed this work around. I put the script in place and Will monitor