Scout24 / yum-repo-server

Server to host and manage yum repositories via REST API
GNU General Public License v3.0
115 stars 19 forks source link

RepoMetadataScheduler stops on/after Problems with MongoDB #59

Closed pluralistix closed 9 years ago

pluralistix commented 9 years ago

We've seen problems with the scheduled metadata-refreshs after having problems (e.g. not talking to master and retries used up) with the underlying MongoDB.

oli99sc commented 9 years ago

I will check the code. To help narrow down the issue, could you pelase provide a stacktrace in the logs which could give a hint about where the problem occured.

oli99sc commented 9 years ago

The RepoMetadataScheduler has a scheduled method which ensures (or tries to) that there is a RepoMetadataGeneratorJob for each scheduled repository. This class keeps track of scheduled jobs in a HashMap. The RepoMetadataGeneratorJobs are scheduled with a fixed delay in a ScheduledExecutorService. Unfortunately the documentation of ScheduledExecutorService says "If any execution of the task encounters an exception, subsequent executions are suppressed." Temporary problems with the connection to the mongodb instance can leads to an inconsisten state of the HashMap as it still contains jobs, that are no longer executed.

I am now working on a fix

oli99sc commented 9 years ago

commit includes testcase to reproduce error condition and prove fix helps