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 686810 - [regression] Infinite wait in g_task_run_in_thread_sync()
[regression] Infinite wait in g_task_run_in_thread_sync()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.35.x
Other Linux
: Normal major
: ---
Assigned To: gtkdev
gtkdev
: 680463 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-10-24 15:59 UTC by David Ronis
Modified: 2012-11-02 14:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtask: bump the max thread pool size up to 100 to avoid stalls/deadlocks (1.28 KB, patch)
2012-10-30 19:13 UTC, Dan Winship
committed Details | Review

Description David Ronis 2012-10-24 15:59:16 UTC
I've reported something like this before and it has been fixed for a month or so.   I started the git/master
(as of Oct 16) of evo and friends;  after a short while the status bar was filled with various processes that don't seem to end.  I've been updating various gnome components to their 3.7.0 versions, and I suspect that's what triggered the problem.

Here's a backtrace:

Thread 1 (Thread 0xb0a298a0 (LWP 12262))

  • #0 g_pointer_bit_unlock
    at gbitlock.c line 531
  • #1 g_datalist_unlock
    at gdataset.c line 219
  • #2 g_datalist_id_dup_data
    at gdataset.c line 878
  • #3 g_datalist_id_get_data
    at gdataset.c line 798
  • #4 g_object_get_qdata
  • #5 push_recursion_check
    at gtksizerequest.c line 50
  • #6 compute_size_for_orientation
    at gtksizerequest.c line 358
  • #7 gtk_widget_get_preferred_width
    at gtksizerequest.c line 552
  • #8 gtk_box_get_size
    at gtkbox.c line 1042
  • #9 compute_size_for_orientation
    at gtksizerequest.c line 359
  • #10 gtk_widget_get_preferred_width
    at gtksizerequest.c line 552
  • #11 gtk_frame_get_preferred_size
    at gtkframe.c line 893
  • #12 compute_size_for_orientation
    at gtksizerequest.c line 359
  • #13 gtk_widget_get_preferred_width
    at gtksizerequest.c line 552
  • #14 gtk_box_get_size
    at gtkbox.c line 1042
  • #15 compute_size_for_orientation
    at gtksizerequest.c line 359
  • #16 gtk_widget_get_preferred_width_for_height
    at gtksizerequest.c line 621
  • #17 gtk_box_size_allocate
    at gtkbox.c line 473
  • #18 shell_taskbar_size_allocate
    at e-shell-taskbar.c line 299
  • #19 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #20 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #21 _g_closure_invoke_va
    at gclosure.c line 840
  • #22 g_signal_emit_valist
    at gsignal.c line 3226
  • #23 g_signal_emit
    at gsignal.c line 3371
  • #24 gtk_widget_size_allocate
    at gtkwidget.c line 4926
  • #25 gtk_notebook_size_allocate
    at gtknotebook.c line 2577
  • #26 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #27 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #28 _g_closure_invoke_va
    at gclosure.c line 840
  • #29 g_signal_emit_valist
    at gsignal.c line 3226
  • #30 g_signal_emit
    at gsignal.c line 3371
  • #31 gtk_widget_size_allocate
    at gtkwidget.c line 4926
  • #32 gtk_box_size_allocate
    at gtkbox.c line 661
  • #33 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #34 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #35 _g_closure_invoke_va
  • #36 g_signal_emit_valist
    at gsignal.c line 3226
  • #37 g_signal_emit
    at gsignal.c line 3371
  • #38 gtk_widget_size_allocate
    at gtkwidget.c line 4926
  • #39 gtk_box_size_allocate
    at gtkbox.c line 661
  • #40 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #41 g_type_class_meta_marshalv
  • #42 _g_closure_invoke_va
    at gclosure.c line 840
  • #43 g_signal_emit_valist
    at gsignal.c line 3226
  • #44 g_signal_emit
    at gsignal.c line 3371
  • #45 gtk_widget_size_allocate
    at gtkwidget.c line 4926
  • #46 gtk_window_size_allocate
    at gtkwindow.c line 5621
  • #47 g_cclosure_marshal_VOID__BOXED
    at gmarshal.c line 1120
  • #48 g_type_class_meta_marshal
    at gclosure.c line 970
  • #49 g_closure_invoke
  • #50 signal_emit_unlocked_R
    at gsignal.c line 3497
  • #51 g_signal_emit_valist
    at gsignal.c line 3315
  • #52 g_signal_emit
    at gsignal.c line 3371
  • #53 gtk_widget_size_allocate
    at gtkwidget.c line 4926
  • #54 gtk_container_resize_children
    at gtkcontainer.c line 1877
  • #55 gtk_window_move_resize
    at gtkwindow.c line 7403
  • #56 gtk_window_check_resize
    at gtkwindow.c line 6313
  • #57 gtk_window_check_resize
    at gtkwindow.c line 6306
  • #58 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #59 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #60 _g_closure_invoke_va
    at gclosure.c line 840
  • #61 g_signal_emit_valist
    at gsignal.c line 3226
  • #62 g_signal_emit
    at gsignal.c line 3371
  • #63 gtk_container_check_resize
    at gtkcontainer.c line 1823
  • #64 gtk_container_idle_sizer
    at gtkcontainer.c line 1686
  • #65 gdk_threads_dispatch
    at gdk.c line 788
  • #66 g_idle_dispatch
    at gmain.c line 4806
  • #67 g_main_dispatch
    at gmain.c line 2715
  • #68 g_main_context_dispatch
    at gmain.c line 3219
  • #69 g_main_context_iterate
    at gmain.c line 3290
  • #70 g_main_loop_run
    at gmain.c line 3484
  • #71 gtk_main
    at gtkmain.c line 1160
  • #72 main
    at main.c line 705

Comment 1 Milan Crha 2012-10-24 20:09:06 UTC
Thanks for a bug report. I see most of the threads are waiting for a resolution of www.segalcentre.org, then one for newsletter.inpix.ca. The main thread is repainting the window. Is any process eating your CPU? Is evolution one of them? I saw high CPU usage of a spinner animation (the circle in the status bar indicating the process didn't freeze), which could block evolution from its usual behaviour. Maybe this is similar.
Comment 2 David Ronis 2012-10-24 20:16:37 UTC
Hi Milan (welcome back),

Evo was using a lot of CPU, but I neglected to look at it by thread.
Comment 3 Milan Crha 2012-10-25 10:12:46 UTC
(In reply to comment #2)
> Hi Milan (welcome back),

Thanks :)

> Evo was using a lot of CPU, but I neglected to look at it by thread.

Try to involve the sysprof or any similar tool, to see what is causing the high CPU usage. 3.6.0 of GTK has sever issue with spinner (or any other) animation, which was supposed to be fixed in 3.6.1, but not that well. See bug #684639 for more information on this. I also got high CPU usage while creating new message (when the composer is created), which seems to be due to CSS style context on the first look, but I'm not a gtk+ developer, thus I cannot tell for sure.
Comment 4 David Ronis 2012-10-25 16:28:12 UTC
The problem doesn't arise if I don't load images from the internet, which is consistent with your last comment.   I've reported something like this before in bug 680463.
Comment 5 Milan Crha 2012-10-29 13:05:13 UTC
*** Bug 680463 has been marked as a duplicate of this bug. ***
Comment 6 Milan Crha 2012-10-29 13:08:04 UTC
I see. Is the message a spam message or an expected delivery? I mean, would it be possible to share one such message, please? If it contains any private information in it, then feel free to zip it and send it to me privately, just mention the bug number in the subject, thus I'll not get it lost between my spam. Thanks in advance.
Comment 7 David Ronis 2012-10-29 16:13:42 UTC
The message wasn't spam, just an e-mail with a html link to an image.   Note that this is not completely reproducible, in that it seems to involve some networking problem which keeps the image from loading or
allowing me to kill the thread.
Comment 8 Milan Crha 2012-10-30 10:58:13 UTC
Thanks for the message (sent privately). It works for me, of course, but I use different glib version, where is no gtask.c available. Looking into the backtrace again, I suppose there is kind of a deadlock in g_task_run_in_thread_sync(), thus I'm moving this to glib/gio. I'm pasting here one of the threads too:

Thread 11 (Thread 0x9ef98b70 (LWP 12323))

  • #0 pthread_cond_wait
    from /opt/garnome-3.6.0/lib/libpthread.so.0
  • #1 g_cond_wait
    at gthread-posix.c line 746
  • #2 g_task_run_in_thread_sync
    at gtask.c line 1362
  • #3 lookup_by_name
    at gthreadedresolver.c line 83
  • #4 g_resolver_lookup_by_name
    at gresolver.c line 358
  • #5 resolve_sync_internal
    at soup-address.c line 823
  • #6 soup_address_address_enumerator_next
    at soup-address.c line 1104
  • #7 g_socket_address_enumerator_next
    at gsocketaddressenumerator.c line 85
  • #8 g_socket_client_connect
    at gsocketclient.c line 960
  • #9 soup_socket_connect_sync
    at soup-socket.c line 831
  • #10 soup_connection_connect_sync
    at soup-connection.c line 689
  • #11 get_connection
    at soup-session-sync.c line 175
  • #12 process_queue_item
    at soup-session-sync.c line 242
  • #13 soup_session_sync_send_message
    at soup-session-sync.c line 334
  • #14 soup_session_send_message
    at soup-session.c line 1500
  • #15 send_and_handle_redirection
    at e-http-request.c line 128
  • #16 handle_http_request
    at e-http-request.c line 324
  • #17 run_in_thread
    at gsimpleasyncresult.c line 871
  • #18 io_job_thread
    at gioscheduler.c line 89
  • #19 g_task_thread_pool_thread
    at gtask.c line 1225
  • #20 g_thread_pool_thread_proxy
    at gthreadpool.c line 309
  • #21 g_thread_proxy
    at gthread.c line 797
  • #22 start_thread
    from /opt/garnome-3.6.0/lib/libpthread.so.0
  • #23 clone
    from /opt/garnome-3.6.0/lib/libc.so.6

Comment 9 Dan Winship 2012-10-30 13:58:50 UTC
Well, that thread is waiting for a GCond to be triggered, so I need to see what the other threads are doing that's causing the GCond to not get triggered
Comment 10 Milan Crha 2012-10-30 17:58:25 UTC
check comment #0 for the full thread.
Comment 11 Dan Winship 2012-10-30 19:06:33 UTC
Oh, oops, misread your earlier comment about a private message and thought the stack trace came from that...

The problem is that currently GTask will only allow 10 outstanding threads at once, and there are at least 10 handle_http_request() threads, so no more g_task_run_in_thread() threads can be started, but now each of those handle_http_request() threads is stuck waiting for a DNS thread to finish, except that it can't even start...

temporary workaround: bump up the pool size. longer-term fix: bug 687223
Comment 12 Dan Winship 2012-10-30 19:13:41 UTC
Created attachment 227670 [details] [review]
gtask: bump the max thread pool size up to 100 to avoid stalls/deadlocks

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=686810 for now.
https://bugzilla.gnome.org/show_bug.cgi?id=687223 discusses a nicer
fix for later.
Comment 13 Colin Walters 2012-10-30 19:26:43 UTC
Review of attachment 227670 [details] [review]:

Why not 1000 or 10000?  Dunno.  100 is OK by me as long as we do the real fix eventually...
Comment 14 David Ronis 2012-10-30 19:29:53 UTC
Hi Dan,

The patch "fixes" the problem.  It might be useful to show a warning message if
the number of tasks ever hits the maximum (perhaps also with a query as to
whether to continue or not) until the more elegant fix is available.
Comment 15 Dan Winship 2012-11-02 14:20:42 UTC
Attachment 227670 [details] pushed as 7b1f8c5 - gtask: bump the max thread pool size up to 100 to avoid stalls/deadlocks