I’ve worked around it.
The problem is Apple. The same SMB version on Linux works. Whatever Apple did broke it.
It goes to sleep, and looks like it’s still connected, but when you try to access it, the system times out.
On Catalina, the solution was to use AFP, but they removed it since, so it’s no longer possible to create AFP shares. This means you are forced to use their buggy SMB, and as everyone can see from this thread, there’s no fixing it.
My workaround is an AppleScript app I created that touches a null file on the share every 5 minutes. This has completely stopped the share from timing out.
My problem was my media server and my MacMini on my TV. Kodi would just error out, but it should solve the problem for every case. It just prevents the share from going into a sleep state.
5 minutes seems to be the magic number. Any longer, and it will sleep and time out.
I am running my keep alive AppleScript from my Kodi MacMini TV box, not on the server itself.
Until Apple takes bugs seriously, and decides to fix it, this works, but don’t hold your breath. This bug has been around since Catalina. It was just easier to use AFP instead of SMB, but now they decide to remove what worked, and force us to use something that doesn’t. BTW: I’ve tried every other solution here as well as others before coming up with my solution. No other solution has worked. Some seemed to, but later failed. And no, my server doesn’t go to sleep. I get a lot of comments from people thinking I missed something, but I have tried them all. Many people don’t even understand that AFP was removed. Yes, you can connect to an AFP share from an older OS, or NAS, but you cannot create an AFP share from any OS greater than Catalina, it’s been removed.