I’d faced a similar problem a few months back where the agent wasn’t able to process the large log file after a massive update in the 300 sec timeout window and was failing as a result. This issue was addressed by extending the timeout (to 1200 sec in my case).
Distributor and Log Reader Agent profile property: Query Timeout.
Here is the error profile to compare:
The process could not execute ‘sp_repldone/sp_replcounters’ on ‘DB’.
(Source: ODBC SQL Server Driver (ODBC); Error number: 0)
The process could not set the last distributed transaction.
(Source: DB (Agent); Error number: 22017)