diff -Nur plague-0.4.4.1-orig/server/Builder.py plague-0.4.4.1/server/Builder.py --- plague-0.4.4.1-orig/server/Builder.py 2006-02-19 07:26:19.000000000 +0100 +++ plague-0.4.4.1/server/Builder.py 2008-01-09 04:00:08.000000000 +0100 @@ -103,6 +103,10 @@ (self._alive, target_list) = self._ping_builder() if self._alive: self._init_builder(target_list) + else: + # Treat the builder as timed out and ping it periodically + self._ping_timeout = time.time() + self._suspend_reason = SUSPEND_TIMEOUT def _init_builder(self, target_list): self._target_list = target_list diff -Nur plague-0.4.4.1-orig/server/BuildMaster.py plague-0.4.4.1/server/BuildMaster.py --- plague-0.4.4.1-orig/server/BuildMaster.py 2005-11-29 07:16:52.000000000 +0100 +++ plague-0.4.4.1/server/BuildMaster.py 2008-01-09 04:00:08.000000000 +0100 @@ -72,6 +72,9 @@ threading.Thread.__init__(self) self.setName("BuildMaster") + def _cleanup(self): + del self._cursor, self._dbcx + def _requeue_interrupted_jobs(self): """ Restart interrupted jobs from our db. """ self._cursor.execute("SELECT uid FROM jobs WHERE (status!='needsign' AND status!='failed' AND status!='finished') ORDER BY uid") @@ -416,3 +419,4 @@ while not self._have_work() and time.time() <= last_time + 5: time.sleep(0.25) + self._cleanup() diff -Nur plague-0.4.4.1-orig/server/DBManager.py plague-0.4.4.1/server/DBManager.py --- plague-0.4.4.1-orig/server/DBManager.py 2005-10-24 17:32:21.000000000 +0200 +++ plague-0.4.4.1/server/DBManager.py 2008-01-09 04:00:08.000000000 +0100 @@ -198,6 +198,10 @@ return dbcx + def __del__(self): + self._dbcx.close() + del self._dbcx + class mysqlEngineClass(BaseDBEngineClass): @@ -247,6 +251,10 @@ return dbcx + def __del__(self): + self._dbcx.close() + del self._dbcx + db_engines = { 'sqlite': sqliteEngineClass, diff -Nur plague-0.4.4.1-orig/server/PackageJob.py plague-0.4.4.1/server/PackageJob.py --- plague-0.4.4.1-orig/server/PackageJob.py 2006-03-13 05:10:49.000000000 +0100 +++ plague-0.4.4.1/server/PackageJob.py 2008-01-09 04:00:08.000000000 +0100 @@ -462,6 +462,9 @@ """ Called by the BuilderManager when it's started a new arch job for us """ self._archjobs_lock.acquire() jobarch = job.arch() + if not self.archjobs.has_key(jobarch): + log(("%s (%s/%s): Didn't have key for '%s', added it." % (self.uid, self.package, jobarch, jobarch))) + self.archjobs[jobarch] = None if self.archjobs[jobarch] != None: log("%s (%s/%s): Already have archjob for this arch (%s). New job UID is %s." % (self.uid, \ self.package, jobarch, self.archjobs[jobarch].jobid, job.jobid)) @@ -653,7 +656,10 @@ # the original SRPM. if not os.path.exists(srpm_file): shutil.copy(src_file, srpm_file) - os.remove(src_file) + try: + os.remove(src_file) + except OSError, e: + debugprint("%d: Error cleaning up job files - '%s'" % (self.uid, e)) # If there were no builder-built SRPMs, keep the original around if not os.path.exists(srpm_file): diff -Nur plague-0.4.4.1-orig/server/Repo.py plague-0.4.4.1/server/Repo.py --- plague-0.4.4.1-orig/server/Repo.py 2005-11-29 07:17:07.000000000 +0100 +++ plague-0.4.4.1/server/Repo.py 2008-01-09 04:00:08.000000000 +0100 @@ -120,7 +120,9 @@ (s, o) = commands.getstatusoutput('/usr/bin/createrepo -q -c %s -x "*.src.rpm" -x "*.debuginfo.rpm" %s' % (self._repo_cache_dir, self._repodir)) if s != 0: - print "Error: createrepo failed with exit status %d! Output: '%s'" % (s, o) + print "Repo Error (%s): createrepo failed with exit status %d! Output: '%s'" % (target_string, s, o) + + del target_string def _run_repo_script(self): target_str = self._target_cfg.target_string() diff -Nur plague-0.4.4.1-orig/server/UserInterface.py plague-0.4.4.1/server/UserInterface.py --- plague-0.4.4.1-orig/server/UserInterface.py 2005-11-28 18:46:21.000000000 +0100 +++ plague-0.4.4.1/server/UserInterface.py 2008-01-09 04:00:08.000000000 +0100 @@ -181,6 +181,7 @@ dbcx = self._db_manager.dbcx() curs = dbcx.cursor() except StandardError, e: + del curs, dbcx return (-1, "Unable to access job database: '%s'" % e) curs.execute(sql) job = dbcx.fetchone(curs) @@ -193,8 +194,7 @@ self._bm.requeue_job(uid) result = (0, "Success: Job %d has been requeued." % uid) - del curs - del dbcx + del curs, dbcx return result def _kill_job(self, email, job, jobid): @@ -315,6 +315,7 @@ dbcx = self._db_manager.dbcx() curs = dbcx.cursor() except StandardError, e: + del curs, dbcx return (-1, "Unable to access job database: '%s'" % e, []) curs.execute(sql) data = dbcx.fetchall(curs) @@ -363,8 +364,7 @@ if job['uid'] == ajrec['parent_uid']: job['archjobs'].append(copy.deepcopy(ajrec)) - del curs - del dbcx + del curs, dbcx return (0, "Success.", jobs) @@ -388,8 +388,7 @@ curs.execute(sql) job = dbcx.fetchone(curs) if not job: - del curs - del dbcx + del curs, dbcx return (-1, "Error: Invalid job UID.", {}) jobrec = {} jobrec['uid'] = job['uid'] @@ -436,8 +435,7 @@ ret_job = copy.deepcopy(jobrec) - del curs - del dbcx + del curs, dbcx return (0, "Success.", ret_job) @@ -473,6 +471,13 @@ return self._bm.is_paused() def finish(self, uid_list): + try: + dbcx = self._db_manager.dbcx() + curs = dbcx.cursor() + except StandardError, e: + del curs, dbcx + return (-1, "Unable to access job database: '%s'" % e) + uids = '' for uid in uid_list: uid = validate_uid(uid) @@ -486,16 +491,10 @@ if len(uids): sql = "UPDATE jobs SET status='finished' WHERE %s" % uids - try: - dbcx = self._db_manager.dbcx() - curs = dbcx.cursor() - except StandardError, e: - return (-1, "Unable to access job database: '%s'" % e) curs.execute(sql) dbcx.commit() - del curs - del dbcx + del curs, dbcx return (0, "Success.") def srpm_upload_dir(self, target_alias): @@ -538,6 +537,7 @@ dbcx = self._db_manager.dbcx() curs = dbcx.cursor() except StandardError, e: + del curs, dbcx return (-1, "Unable to access job database: '%s'" % e) curs.execute(sql) @@ -551,8 +551,7 @@ else: result = UserInterface.requeue(self, uid) - del curs - del dbcx + del curs, dbcx return result def kill_job(self, email, jobid): @@ -627,6 +626,7 @@ dbcx = self._db_manager.dbcx() curs = dbcx.cursor() except StandardError, e: + del curs, dbcx return (-1, "Unable to access job database: '%s'" % e) curs.execute(sql) @@ -656,8 +656,7 @@ final_uid_list.append(uid) - del curs - del dbcx + del curs, dbcx if error: return error diff -Nur plague-0.4.4.1-orig/server/User.py plague-0.4.4.1/server/User.py --- plague-0.4.4.1-orig/server/User.py 2005-08-15 05:18:20.000000000 +0200 +++ plague-0.4.4.1/server/User.py 2008-01-09 04:00:08.000000000 +0100 @@ -68,6 +68,7 @@ 'user_admin BOOLEAN, ' \ 'server_admin BOOLEAN)') dbcx.commit() + del curs, dbcx def new_authed_user(self, email, client_address): @@ -88,5 +89,6 @@ else: if self._cfg.get_bool("UI", "guest_allowed"): user = User('guest@guest', True) + del curs, dbcx return user diff -Nur plague-0.4.4.1-orig/www/job.psp plague-0.4.4.1/www/job.psp --- plague-0.4.4.1-orig/www/job.psp 2005-09-01 20:28:32.000000000 +0200 +++ plague-0.4.4.1/www/job.psp 2008-01-09 04:01:06.000000000 +0100 @@ -74,9 +74,11 @@ if job.has_key('result_msg') and job['result_msg'] and len(job['result_msg']): import urllib result_msg = urllib.unquote(str(job['result_msg'])) + if result_msg[-1] != '\n': + result_msg += '\n' result_msg = "

"+result_msg.replace("\n", "

")+"

" %> - Result:"<%=result_msg%>" + Result:<%=result_msg%> <% # endif %>