Ensure that you’re properly closing browser tabs and other resources (like file handles) after each iteration.
Instead of processing all 5000 records in a single loop, consider breaking them into smaller chunks and processing them in parallel using the ‘Parallel For Each’ activity. This can help distribute the resource load and reduce the likelihood of Chrome freezing.
Adjust page load timeouts and retry mechanisms in your automation to handle situations where the web application might be slow or unresponsive.
Use the ‘Retry Scope’ activity in UiPath to handle intermittent issues.
You can try enclosing whole of it in try catch inside the loop and enclose that in retry scope…and then in catch perform the relogin steps and then the loop would be retried