Log shipping Primary database log backup job failing/stuck
How can i troubleshoot this further?


Since you can't make it happen every time a backup occurs, I'd run procmon and filter against the folder you're sending the log backups. When it occurs, stop the procmon and investigate what applications are taking locks on the file. My guess, though, is going to be antivirus or some other filter driver filesystem watcher. The fact it happens more frequently on larger files is a giveaway.

If you know it's going to fail, or is currently having issues you could use process explorer and search for the file in the handles and see what processes are touching it.

This is happening at the windows/driver level, not the SQL Server application level.