Bugzilla – Attachment 49141 Details for
Bug 113626
beagle creates lots of tmp files in /tmp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
a patch which fixes this problem
01-bnc-113626-leaked-tmp-files.patch (text/plain), 8.49 KB, created by
Jon Trowbridge
on 2005-09-08 02:39:05 UTC
(
hide
)
Description:
a patch which fixes this problem
Filename:
MIME Type:
Creator:
Jon Trowbridge
Created:
2005-09-08 02:39:05 UTC
Size:
8.49 KB
patch
obsolete
>Index: Filters/FilterPdf.cs >=================================================================== >RCS file: /cvs/gnome/beagle/Filters/FilterPdf.cs,v >retrieving revision 1.13 >retrieving revision 1.14 >diff -u -p -r1.13 -r1.14 >--- Filters/FilterPdf.cs 27 Jul 2005 14:29:15 -0000 1.13 >+++ Filters/FilterPdf.cs 6 Sep 2005 20:55:40 -0000 1.14 >@@ -97,7 +97,7 @@ namespace Beagle.Filters { > Process pc = new Process (); > pc.StartInfo.FileName = "pdftotext"; > // FIXME: We probably need to quote special chars in the path >- pc.StartInfo.Arguments = String.Format ("-nopgbrk -enc UTF-8 \"{0}\" -", FileInfo.FullName); >+ pc.StartInfo.Arguments = String.Format ("-q -nopgbrk -enc UTF-8 \"{0}\" -", FileInfo.FullName); > pc.StartInfo.RedirectStandardInput = false; > pc.StartInfo.RedirectStandardOutput = true; > pc.StartInfo.UseShellExecute = false; >Index: Util/Scheduler.cs >=================================================================== >RCS file: /cvs/gnome/beagle/Util/Scheduler.cs,v >retrieving revision 1.27 >retrieving revision 1.29 >diff -u -p -r1.27 -r1.29 >--- Util/Scheduler.cs 25 Aug 2005 15:19:29 -0000 1.27 >+++ Util/Scheduler.cs 7 Sep 2005 05:28:52 -0000 1.29 >@@ -215,8 +215,10 @@ namespace Beagle.Util { > > public void Cancel () > { >- if (! cancelled) >+ if (! cancelled) { > DecrementAllTaskGroups (); >+ Cleanup (); // clean up after cancelled tasks >+ } > cancelled = true; > } > >@@ -284,7 +286,31 @@ namespace Beagle.Util { > > /////////////////////////////// > >+ // Clean-up is called whenever we know that a task will never >+ // be executed. It is never called on tasks for who DoTaskReal >+ // has been called (except when rescheduled). Cleanup is also >+ // called when a task is cancelled. >+ >+ public void Cleanup () >+ { >+ try { >+ DoCleanup (); >+ } catch (Exception ex) { >+ Logger.Log.Warn ("Caught exception cleaning up task '{0}'", Tag); >+ Logger.Log.Warn (ex); >+ } >+ } >+ >+ protected virtual void DoCleanup () >+ { >+ // Do nothing by default >+ } >+ >+ /////////////////////////////// >+ > // Sort from lowest to highest priority >+ // FIXME: This does not define a total ordering >+ // on the set of all tasks, so use it with care. > public int CompareTo (object obj) > { > Task other = obj as Task; >@@ -746,6 +772,7 @@ namespace Beagle.Util { > Hook pre_hook = null; > Hook post_hook = null; > ArrayList to_be_executed = new ArrayList (); >+ Hashtable max_priority_by_source = new Hashtable (); > > while (running) { > >@@ -766,15 +793,47 @@ namespace Beagle.Util { > // the next one to execute. > DateTime now = DateTime.Now; > DateTime next_trigger_time = DateTime.MaxValue; >+ >+ // Make a first pass over our tasks, finding the >+ // highest-priority item per source. >+ max_priority_by_source.Clear (); >+ foreach (Task task in tasks_by_tag.Values) { >+ if (task.Blocked || task.TriggerTime >= now) >+ continue; >+ if (max_priority_by_source.Contains (task.Source)) { >+ Priority p = (Priority) max_priority_by_source [task.Source]; >+ if (p < task.Priority) >+ max_priority_by_source [task.Source] = task.Priority; >+ } else { >+ max_priority_by_source [task.Source] = task.Priority; >+ } >+ } >+ >+ // Now make a second pass over the tasks and find >+ // the highest-priority item. We use the information >+ // from the first pass to correctly prioritize maintenance tasks. > Task next_task = null; > foreach (Task task in tasks_by_tag.Values) { > if (task.Blocked) > continue; >+ if (task.TriggerTime >= now) { >+ if (task.TriggerTime < next_trigger_time) >+ next_trigger_time = task.TriggerTime; >+ continue; >+ } >+ >+ // If this is a maintenance task and there is a high-priority >+ // task from the same source, skip it. >+ if (task.Priority == Priority.Maintenance) { >+ Priority p = (Priority) max_priority_by_source [task.Source]; >+ if (p > task.Priority) >+ continue; >+ } >+ > if (task.TriggerTime < now) { > if (next_task == null || next_task.CompareTo (task) < 0) > next_task = task; >- } else if (task.TriggerTime < next_trigger_time) >- next_trigger_time = task.TriggerTime; >+ } > } > > // If we didn't find a task, wait for the next trigger-time >@@ -910,6 +969,10 @@ namespace Beagle.Util { > foreach (Task task in shutdown_task_queue) > if (! task.Cancelled && ! task.Blocked) > task.DoTask (); >+ >+ // Call Cleanup on all of our unexecuted tasks >+ foreach (Task task in tasks_by_tag.Values) >+ task.Cleanup (); > > if (Debug) > Logger.Log.Debug ("Scheduler.Worker finished"); >Index: beagled/LuceneQueryable.cs >=================================================================== >RCS file: /cvs/gnome/beagle/beagled/LuceneQueryable.cs,v >retrieving revision 1.63 >retrieving revision 1.65 >diff -u -p -r1.63 -r1.65 >--- beagled/LuceneQueryable.cs 31 Aug 2005 22:04:21 -0000 1.63 >+++ beagled/LuceneQueryable.cs 7 Sep 2005 05:28:52 -0000 1.65 >@@ -110,6 +110,8 @@ namespace Beagle.Daemon { > > // Schedule an optimize, just in case > ScheduleOptimize (); >+ >+ Shutdown.ShutdownEvent += new Shutdown.ShutdownHandler (OnShutdownEvent); > } > > protected string IndexName { >@@ -141,6 +143,26 @@ namespace Beagle.Daemon { > > ///////////////////////////////////////// > >+ virtual protected void ShutdownHook () >+ { >+ >+ } >+ >+ private void OnShutdownEvent () >+ { >+ lock (request_lock) >+ pending_request.Cleanup (); >+ >+ try { >+ ShutdownHook (); >+ } catch (Exception ex) { >+ Logger.Log.Warn ("Caught exception in shutdown hook"); >+ Logger.Log.Warn (ex); >+ } >+ } >+ >+ ///////////////////////////////////////// >+ > virtual public bool AcceptQuery (Query query) > { > // Don't accept queries on empty indexes. >@@ -422,6 +444,11 @@ namespace Beagle.Daemon { > queryable.ConditionalFlush (); > } > } >+ >+ override protected void DoCleanup () >+ { >+ indexable.Cleanup (); >+ } > } > > public Scheduler.Task NewAddTask (Indexable indexable) >@@ -758,7 +785,7 @@ namespace Beagle.Daemon { > } > > if (please_add_a_new_task) { >- Logger.Log.Debug ("Adding child {0}", child.Uri); >+ //Logger.Log.Debug ("Adding child {0}", child.Uri); > Scheduler.Task task = NewAddTask (child); > ThisScheduler.Add (task); > } >Index: BeagleClient/Indexable.cs >=================================================================== >RCS file: /cvs/gnome/beagle/BeagleClient/Indexable.cs,v >retrieving revision 1.35 >retrieving revision 1.36 >diff -u -p -r1.35 -r1.36 >--- BeagleClient/Indexable.cs 2 Sep 2005 19:18:58 -0000 1.35 >+++ BeagleClient/Indexable.cs 6 Sep 2005 21:08:23 -0000 1.36 >@@ -269,7 +269,7 @@ namespace Beagle { > { > if (DeleteContent) { > if (contentUri != null) { >- Logger.Log.Debug ("Cleaning up {0}", contentUri.LocalPath); >+ //Logger.Log.Debug ("Cleaning up {0}", contentUri.LocalPath); > try { > File.Delete (contentUri.LocalPath); > } catch (Exception ex) >@@ -279,7 +279,7 @@ namespace Beagle { > contentUri = null; > } > if (hotContentUri != null) { >- Logger.Log.Debug ("Cleaning up {0}", hotContentUri.LocalPath); >+ //Logger.Log.Debug ("Cleaning up {0}", hotContentUri.LocalPath); > try { > File.Delete (hotContentUri.LocalPath); > } catch (Exception ex) >Index: beagled/IndexerRequest.cs >=================================================================== >RCS file: /cvs/gnome/beagle/beagled/IndexerRequest.cs,v >retrieving revision 1.1 >retrieving revision 1.2 >diff -u -p -r1.1 -r1.2 >--- beagled/IndexerRequest.cs 29 Aug 2005 05:34:03 -0000 1.1 >+++ beagled/IndexerRequest.cs 7 Sep 2005 05:28:52 -0000 1.2 >@@ -119,5 +119,15 @@ namespace Beagle.Daemon { > public bool IsEmpty { > get { return Count == 0 && ! OptimizeIndex; } > } >+ >+ public void Cleanup () >+ { >+ if (indexables_by_uri != null) >+ foreach (Indexable i in indexables_by_uri.Values) >+ i.Cleanup (); >+ else >+ foreach (Indexable i in indexables) >+ i.Cleanup (); >+ } > } > } >Index: beagled/RemoteIndexer.cs >=================================================================== >RCS file: /cvs/gnome/beagle/beagled/RemoteIndexer.cs,v >retrieving revision 1.30 >retrieving revision 1.31 >diff -u -p -r1.30 -r1.31 >--- beagled/RemoteIndexer.cs 29 Aug 2005 19:43:32 -0000 1.30 >+++ beagled/RemoteIndexer.cs 7 Sep 2005 05:28:52 -0000 1.31 >@@ -90,6 +90,7 @@ namespace Beagle.Daemon { > > if (response == null) { > Logger.Log.Error ("Something terrible happened --- Flush failed"); >+ request.Cleanup (); > return null; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 113626
: 49141