If multiple refreshes for the same repo run, it can unnecessarily block the task queue, especially if the repo is very large.
The task can check the repo status and abort if it says it's refreshing, then put a while loop around the refresh to check for any new unrecognized commits. One thing to note is that it has to execute at least once, even if no new commits, for the case of the user-started full refresh
Another case:
Due to bug [#5022], thousands of curl requests to
/auth/refresh_repo/p/projectname/code/
were issued. That resulted in thousands of tasks created like:With the only variation being _id and time_queue
Related
Tickets:
#5022Created #185: [#4927] Avoid multiple repo refreshes (3cp)
Related
Tickets:
#4927What do you mean by this? Should we check for new commits when repo refresh is finished and run refresh again or what? Could you explain this in more detail, please?
Yes, that's more or less correct. The problem that we're having is that, if many changes are done to a repo in a short period or a refresh takes a long time to complete (which is relatively common), we'll end up with all the task workers trying to refresh a single repo on the same set of commits, thus blocking all other tasks.
We want to add a check in the
allura.tasks.repo_tasks.refresh()
such that if the repo is currently in anything other than'ready'
state, the task will abort and not double-queue the refresh.However, if the refresh takes a while, new commits may have come in that have not been processed and for which the corresponding refresh task has already aborted. So the task needs to check for new, unknown commits (see
allura.model.repo_refresh.unknown_commits()
) and re-queue itself to pick up those missed changes.A while loop was just an initial thought; re-posting the task to the queue is a better implementation as it will allow other tasks to be processed during the break.
Thanks for clarifying.
Closed #185. Branch 42cc_4927.
We have ~ 17 refresh tasks currently in "busy" state, most of which were orphaned by hard restarts of taskd workers and need to be cleaned up or they will block the corresponding repos from being refreshed.
The command to find the "busy" refresh tasks is:
These will need to be compared to what the given workers are actually working on (obtained by sending a
USR1
signal to the worker and watchingallura.log
for the response) to clear out any that are not actually busy.