After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 322935 - Threads are left idling
Threads are left idling
Status: RESOLVED WONTFIX
Product: gnome-vfs
Classification: Deprecated
Component: Async operations
2.15.x
Other All
: Normal normal
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
gnome[unmaintained]
Depends on:
Blocks:
 
 
Reported: 2005-12-01 14:39 UTC by Martyn Russell
Modified: 2018-08-17 13:49 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Cleans up idling threads after timeout (10.99 KB, patch)
2005-12-01 14:44 UTC, Martyn Russell
none Details | Review
My first take on that (7.08 KB, patch)
2005-12-01 18:46 UTC, Christian Kellner
none Details | Review
Next try, this time we killed a bunch of complicated code in job-queue as well (17.39 KB, patch)
2005-12-02 17:20 UTC, Christian Kellner
committed Details | Review
The whole gnome-vfs-job-queue.c file for easier patch review. (4.38 KB, text/x-csrc)
2005-12-02 17:29 UTC, Christian Kellner
  Details
gnome-vfs-job-queue.c again. a few cleanups (4.21 KB, text/x-csrc)
2005-12-02 18:06 UTC, Christian Kellner
  Details

Description Martyn Russell 2005-12-01 14:39:42 UTC
Please describe the problem:
If you do a LOT of async operations (a good example is using the
gnome_vfs_async_load_directory()) then 'n' threads are created depending on
priority and the number of operations.

If you create 10 threads and all operations have finished, those 10 threads are
left in the async thread pool waiting for more work.

They should really be cleaned up if they are not needed after a period of time.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Martyn Russell 2005-12-01 14:44:30 UTC
Created attachment 55476 [details] [review]
Cleans up idling threads after timeout

OK, so this patch adds a timeout to every thread when it enters the thread job
pool (which is there so that when new jobs come along they can be picked out of
the pool instead of creating a new thread).

This timeout is 15 seconds.  After those 15 seconds, the thread flag
'exit_requested' is set to TRUE, and the thread is woken up to process the
state change to exit normally (as it would if calling gnomevfs-shutdown()).

Note: There is a programs/gnomevfs-async test application with this patch to
demonstrate this working.

To find out what threads are running, I use 'ps -eLf | grep gnomevfs-async'.

Note: Debugging statements are turned on for the job queue module.
Comment 2 Christian Kellner 2005-12-01 18:46:48 UTC
Created attachment 55491 [details] [review]
My first take on that

Make gnome-vfs use g_thread_pool (). It obsoletes gnome-vfs-thread-pool.[ch].
Make check works as expected and we get rid of a whole bunch of code that was
hard to maintain.
Comment 3 Christian Kellner 2005-12-02 17:20:16 UTC
Created attachment 55528 [details] [review]
Next try, this time we killed a bunch of complicated code in job-queue as well
Comment 4 Christian Kellner 2005-12-02 17:29:29 UTC
Created attachment 55530 [details]
The whole gnome-vfs-job-queue.c file for easier patch review.
Comment 5 Christian Kellner 2005-12-02 18:06:22 UTC
Created attachment 55533 [details]
gnome-vfs-job-queue.c again. a few cleanups
Comment 6 Christian Kellner 2005-12-02 18:29:52 UTC
I committed the GThreadPool patch to gnome-vfs HEAD.
Comment 7 Christian Neumair 2006-07-16 11:41:28 UTC
Christian: Can't we fix this bug just by limiting the idle time using

g_thread_pool_set_max_idle_time

?

One or two minutes should be enough.

Updating version.
Comment 8 Martyn Russell 2006-07-16 13:08:17 UTC
That was the idea I believe. I did the work in gthreadpool.c specifically for this.
Comment 9 Christian Kellner 2006-07-16 13:52:42 UTC
The thing is that g_thread_pool_set_max_idle_time (guint interval) will set the idle time not for a specific thread pool but for all threadpools (I am not sure if this was on purpose or was it the only choice to do it?). I am not sure it is a good idea to set the general max_idle_time for the application's threadpools in a library. Maybe I am paranoid here, but I guess nautilus and other gnome-vfs uses could as well use that function and also control gnome-vfs' threadpool. Opinions? Either way we should document it somewhere (where?).
Comment 10 André Klapper 2018-08-17 13:49:49 UTC
gnome-vfs got deprecated in 2008.

gnome-vfs is not under active development anymore and had its last code changes
in 2011. Its codebase has been archived:
https://gitlab.gnome.org/Archive/gnome-vfs/commits/master

gio (in glib) and gvfs are its successors. See https://developer.gnome.org/gio/stable/ch33.html and https://people.gnome.org/~gicmo/gio-migration-guide/ for porting info.

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect
reality. Feel free to open a task in GNOME Gitlab if the issue described in this task still applies to a recent + supported version of glib/gio/gvfs. Thanks!