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 733780 - Saving playlist state sometimes hangs totem
Saving playlist state sometimes hangs totem
Status: RESOLVED OBSOLETE
Product: totem
Classification: Core
Component: Movie player
3.12.x
Other Linux
: Normal normal
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
: 734860 774988 788926 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-07-26 12:03 UTC by Mikhail
Modified: 2018-05-24 10:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
$ GST_DEBUG_NO_COLOR=1 GST_DEBUG=*:2 totem /home/mikhail/Videos/Загрузка.\ Подлинная\ история\ Интернета/Загрузка.\ Битва\ Браузеров.avi 2> log10 (1.38 MB, text/plain)
2014-07-26 12:03 UTC, Mikhail
  Details
kernel log (237.39 KB, text/x-log)
2014-07-26 12:06 UTC, Mikhail
  Details
0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch (1.51 KB, patch)
2017-10-20 10:54 UTC, Daniel van Vugt
rejected Details | Review

Description Mikhail 2014-07-26 12:03:28 UTC
Created attachment 281763 [details]
$ GST_DEBUG_NO_COLOR=1 GST_DEBUG=*:2 totem /home/mikhail/Videos/Загрузка.\ Подлинная\ история\ Интернета/Загрузка.\ Битва\ Браузеров.avi 2> log10

Demonstration
part1: https://drive.google.com/file/d/0B0nwzlfiB4aQRk1vdzhxenFXZlU/edit?usp=sharing
part2: https://drive.google.com/file/d/0B0nwzlfiB4aQQUNMYnh0TVVNTjA/edit?usp=sharing
Comment 1 Mikhail 2014-07-26 12:06:07 UTC
Created attachment 281764 [details]
kernel log
Comment 2 Bastien Nocera 2014-07-26 12:26:10 UTC
Can you please attach the output of a backtrace of the hang (run under gdb, when it's hung, press Ctrl+C in the gdb, and then "thread apply all bt"), and give the version of the GStreamer packages you're using?
Comment 3 Mikhail 2014-07-26 12:26:55 UTC
This occurs every time when I try play video after OS boot....


Some time later this problem disappear

Demonstration: https://drive.google.com/file/d/0B0nwzlfiB4aQcGpvb05vLWR1UHc/edit?usp=sharing
Comment 4 Mikhail 2014-07-26 12:29:10 UTC
$ rpm -qa | grep gstreamer
gstreamer1-plugins-ugly-1.2.4-1.fc20.x86_64
libnice-gstreamer1-0.1.4-2.fc20.x86_64
gstreamer-plugins-good-0.10.31-10.fc20.x86_64
gstreamer-0.10.36-6.fc20.i686
gstreamer-plugins-espeak-0.4.0-2.fc19.x86_64
gstreamer-0.10.36-6.fc20.x86_64
gstreamer-plugins-base-0.10.36-6.fc20.i686
gstreamer-plugin-crystalhd-3.10.0-6.fc20.x86_64
gstreamer1-1.2.4-1.fc20.x86_64
gstreamer-plugins-bad-free-0.10.23-20.fc20.x86_64
gstreamer1-plugins-bad-free-1.2.4-1.fc20.x86_64
gstreamer1-plugins-bad-freeworld-1.2.4-1.fc20.x86_64
gstreamer-plugins-ugly-0.10.19-14.fc20.x86_64
gstreamer1-libav-1.2.4-1.fc20.x86_64
gstreamer1-vaapi-0.5.8-3.fc20.x86_64
gstreamer1-plugins-base-1.2.4-1.fc20.x86_64
PackageKit-gstreamer-plugin-0.9.4-1.fc20.x86_64
gstreamer-plugins-base-0.10.36-6.fc20.x86_64
gstreamer1-plugins-good-1.2.4-2.fc20.x86_64
gstreamer-ffmpeg-0.10.13-12.fc20.x86_64
gstreamer-tools-0.10.36-6.fc20.x86_64
Comment 5 Bastien Nocera 2014-07-26 13:39:59 UTC
Can you please paste the backtrace as requested?

And remove the gstreamer-plugin-crystalhd as well, it's known to cause problems.
Comment 6 Mikhail 2014-08-08 18:39:38 UTC
Program received signal SIGINT, Interrupt.
0x00007ffff0492e9d in fsync () at ../sysdeps/unix/syscall-template.S:81
81	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fae9c0 (LWP 26908))

  • #0 fsync
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 _g_local_file_output_stream_really_close
    at glocalfileoutputstream.c line 220
  • #2 g_output_stream_internal_close
    at goutputstream.c line 647
  • #3 g_output_stream_close
    at goutputstream.c line 712
  • #4 g_output_stream_dispose
    at goutputstream.c line 118
  • #5 g_object_unref
    at gobject.c line 3075
  • #6 totem_pl_parser_save_xspf
    at totem-pl-parser-xspf.c line 217
  • #7 totem_pl_parser_save
    at totem-pl-parser.c line 1159
  • #8 totem_playlist_save_session_playlist
    at totem-playlist.c line 345
  • #9 totem_session_save
    at totem-session.c line 103
  • #10 save_session_timeout_cb
    at totem-object.c line 693
  • #11 g_timeout_dispatch
    at gmain.c line 4472
  • #12 g_main_dispatch
    at gmain.c line 3064
  • #13 g_main_context_dispatch
    at gmain.c line 3663
  • #14 g_main_context_iterate
    at gmain.c line 3734
  • #15 g_main_context_iteration
    at gmain.c line 3795
  • #16 g_application_run
    at gapplication.c line 2114
  • #17 main
    at totem.c line 282
(gdb) 
(gdb) 
(gdb)
Comment 7 Mikhail 2014-08-08 18:55:56 UTC
Program received signal SIGINT, Interrupt.
0x00007ffff0492e9d in fsync () at ../sysdeps/unix/syscall-template.S:81
81	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fae9c0 (LWP 26908))

  • #0 fsync
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 _g_local_file_output_stream_really_close
    at glocalfileoutputstream.c line 220
  • #2 g_output_stream_internal_close
    at goutputstream.c line 647
  • #3 g_output_stream_close
    at goutputstream.c line 712
  • #4 g_output_stream_dispose
    at goutputstream.c line 118
  • #5 g_object_unref
    at gobject.c line 3075
  • #6 totem_pl_parser_save_xspf
    at totem-pl-parser-xspf.c line 217
  • #7 totem_pl_parser_save
    at totem-pl-parser.c line 1159
  • #8 totem_playlist_save_session_playlist
    at totem-playlist.c line 345
  • #9 totem_session_save
    at totem-session.c line 103
  • #10 save_session_timeout_cb
    at totem-object.c line 693
  • #11 g_timeout_dispatch
    at gmain.c line 4472
  • #12 g_main_dispatch
    at gmain.c line 3064
  • #13 g_main_context_dispatch
    at gmain.c line 3663
  • #14 g_main_context_iterate
    at gmain.c line 3734
  • #15 g_main_context_iteration
    at gmain.c line 3795
  • #16 g_application_run
    at gapplication.c line 2114
  • #17 main
    at totem.c line 282
(gdb) 
(gdb)
Comment 8 Mikhail 2014-08-08 19:01:47 UTC
Program received signal SIGINT, Interrupt.
0x00007ffff0492e9d in fsync () at ../sysdeps/unix/syscall-template.S:81
81	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fae9c0 (LWP 26908))

  • #0 fsync
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 _g_local_file_output_stream_really_close
    at glocalfileoutputstream.c line 220
  • #2 g_output_stream_internal_close
    at goutputstream.c line 647
  • #3 g_output_stream_close
    at goutputstream.c line 712
  • #4 g_output_stream_dispose
    at goutputstream.c line 118
  • #5 g_object_unref
    at gobject.c line 3075
  • #6 totem_pl_parser_save_xspf
    at totem-pl-parser-xspf.c line 217
  • #7 totem_pl_parser_save
    at totem-pl-parser.c line 1159
  • #8 totem_playlist_save_session_playlist
    at totem-playlist.c line 345
  • #9 totem_session_save
    at totem-session.c line 103
  • #10 save_session_timeout_cb
    at totem-object.c line 693
  • #11 g_timeout_dispatch
    at gmain.c line 4472
  • #12 g_main_dispatch
    at gmain.c line 3064
  • #13 g_main_context_dispatch
    at gmain.c line 3663
  • #14 g_main_context_iterate
    at gmain.c line 3734
  • #15 g_main_context_iteration
    at gmain.c line 3795
  • #16 g_application_run
    at gapplication.c line 2114
  • #17 main
    at totem.c line 282
(gdb) 
(gdb)
Comment 9 Mikhail 2014-08-08 19:06:41 UTC
Program received signal SIGINT, Interrupt.
0x00007ffff2b7aa22 in gdk_cairo_surface_paint_pixbuf (surface=surface@entry=0x7026910, pixbuf=pixbuf@entry=0x241bc00) at gdkcairo.c:242
242	              MULT(q[1], p[1], p[3], t2);
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fae9c0 (LWP 26908))

  • #0 gdk_cairo_surface_paint_pixbuf
    at gdkcairo.c line 242
  • #1 gdk_cairo_surface_create_from_pixbuf
    at gdkcairo.c line 303
  • #2 ensure_surface_from_pixbuf
    at gtkiconhelper.c line 591
  • #3 _gtk_icon_helper_ensure_surface
    at gtkiconhelper.c line 736
  • #4 _gtk_icon_helper_get_size
    at gtkiconhelper.c line 783
  • #5 gtk_cell_renderer_pixbuf_get_size
    at gtkcellrendererpixbuf.c line 444
  • #6 gd_toggle_pixbuf_renderer_get_size
    at libgd/gd-toggle-pixbuf-renderer.c line 155
  • #7 gtk_cell_renderer_real_get_preferred_size
    at gtkcellrenderer.c line 1256
  • #8 gtk_cell_renderer_real_get_preferred_width
    at gtkcellrenderer.c line 1295
  • #9 gtk_cell_renderer_get_preferred_width
    at gtkcellrenderer.c line 1479
  • #10 gtk_cell_area_request_renderer
    at gtkcellarea.c line 3584
  • #11 compute_size
    at gtkcellareabox.c line 1524
  • #12 gtk_cell_area_box_get_preferred_width
    at gtkcellareabox.c line 1813
  • #13 cell_area_get_preferred_size
    at gtkiconview.c line 1477
  • #14 gtk_icon_view_get_preferred_item_size
    at gtkiconview.c line 1540
  • #15 gtk_icon_view_get_preferred_width
    at gtkiconview.c line 1684
  • #16 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #17 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #18 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #19 gtk_scrolled_window_get_preferred_size
    at gtkscrolledwindow.c line 3110
  • #20 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #21 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #22 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #23 gtk_box_get_size
    at gtkbox.c line 1536
  • #24 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #25 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #26 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #27 gtk_stack_get_preferred_width
    at gtkstack.c line 1915
  • #28 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #29 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #30 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #31 gtk_box_get_size
    at gtkbox.c line 1536
  • #32 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #33 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #34 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #35 gtk_window_get_preferred_width
    at gtkwindow.c line 8369
  • #36 gtk_application_window_real_get_preferred_width
    at gtkapplicationwindow.c line 552
  • #37 gtk_widget_query_size_for_orientation
    at gtksizerequest.c line 180
  • #38 gtk_widget_compute_size_for_orientation
    at gtksizerequest.c line 390
  • #39 gtk_widget_get_preferred_width
    at gtksizerequest.c line 489
  • #40 _gtk_widget_get_preferred_size_and_baseline
    at gtksizerequest.c line 682
  • #41 gtk_widget_get_preferred_size
    at gtksizerequest.c line 747
  • #42 gtk_window_compute_hints
    at gtkwindow.c line 9740
  • #43 gtk_window_compute_configure_request
    at gtkwindow.c line 9094
  • #44 gtk_window_move_resize
    at gtkwindow.c line 9324
  • #45 gtk_window_check_resize
    at gtkwindow.c line 8108
  • #46 _g_closure_invoke_va
    at gclosure.c line 831
  • #47 g_signal_emit_valist
    at gsignal.c line 3215
  • #48 g_signal_emit
    at gsignal.c line 3363
  • #49 gtk_container_idle_sizer
    at gtkcontainer.c line 1757
  • #50 g_closure_invoke
    at gclosure.c line 768
  • #51 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #52 g_signal_emit_valist
    at gsignal.c line 3307
  • #53 g_signal_emit_by_name
    at gsignal.c line 3403
  • #54 gdk_frame_clock_paint_idle
    at gdkframeclockidle.c line 408
  • #55 gdk_threads_dispatch
    at gdk.c line 635
  • #56 g_timeout_dispatch
    at gmain.c line 4472
  • #57 g_main_dispatch
    at gmain.c line 3064
  • #58 g_main_context_dispatch
    at gmain.c line 3663
  • #59 g_main_context_iterate
    at gmain.c line 3734
  • #60 g_main_context_iteration
    at gmain.c line 3795
  • #61 g_application_run
    at gapplication.c line 2114
  • #62 main
    at totem.c line 282
(gdb) 
(gdb) 
(gdb)
Comment 10 Bastien Nocera 2014-08-15 14:35:51 UTC
*** Bug 734860 has been marked as a duplicate of this bug. ***
Comment 11 Mikhail 2014-08-15 14:49:01 UTC
(In reply to comment #10)
> *** Bug 734860 has been marked as a duplicate of this bug. ***

Sorry, I am not sure that this backtrace are same.
Comment 12 Bastien Nocera 2014-08-16 09:44:14 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > *** Bug 734860 has been marked as a duplicate of this bug. ***
> 
> Sorry, I am not sure that this backtrace are same.

It is, except the first hang in this bug. The first hang is Totem populating the recent view that's not visible when you launch it with a video, see bug 728716.

The other ones are all hangs in totem_pl_parser_save().
Comment 13 Bastien Nocera 2014-08-17 19:17:00 UTC
You can work-around the problem by add a "return;" near the top of totem_playlist_save_session_playlist() in src/totem-playlist.c.
Comment 14 Bastien Nocera 2017-06-23 08:22:07 UTC
*** Bug 774988 has been marked as a duplicate of this bug. ***
Comment 15 Bastien Nocera 2017-10-13 14:19:54 UTC
*** Bug 788926 has been marked as a duplicate of this bug. ***
Comment 16 Daniel van Vugt 2017-10-20 10:54:57 UTC
Created attachment 361928 [details] [review]
0001-Avoid-fsync-that-causes-totem-hangs-stutter.patch

Here's a fix (for totem-pl-parser).

Some might call it a compromise but I felt that solutions involving threading were a messy overkill.
Comment 17 Marco Trevisan (Treviño) 2017-10-24 22:47:54 UTC
Review of attachment 361928 [details] [review]:

I think this is fine at app level, as a better long term fix, what about not adding a G_FILE_CREATE_DELETE_FIRST (or better naming) to do this when is set?

As per comment on code requesting the sync:

/* If the final destination exists, we want to sync the newly written
 * file to ensure the data is on disk when we rename over the destination.
 * otherwise if we get a system crash we can lose both the new and the
 * old file on some filesystems. (I.E. those that don't guarantee the 
 * data is written to the disk before the metadata.)
 */

It would probably nice to do this depending on the filesystem in use anyway.
Comment 18 Daniel van Vugt 2017-10-25 06:43:17 UTC
A G_FILE_CREATE_DELETE_FIRST would be unacceptable because it breaks the designed and documented robustness of g_file_replace...

https://developer.gnome.org/gio/stable/GFile.html#g-file-replace

So it's only appropriate to break that robustness on a per-app basis.
Comment 19 Bastien Nocera 2017-10-25 11:27:24 UTC
Review of attachment 361928 [details] [review]:

There's 2 ways of working around this. Either:
- adding an async version of totem_pl_parser_save(), which would populate an internal buffer in the main thread, and save it async'ly
- add a way to save to memory, and dump the file to disk in totem itself, where we can apply any work-arounds that would be good enough for the purpose, without breaking the reliability of saves for other library users

Marco, you're not a totem or totem-pl-parser developer, you have no authority to set patches to "accepted commit now". At best, you can review the patches and set them as "reviewed" or "needs-work" as a first pass review.
Comment 20 Daniel van Vugt 2017-10-26 05:29:51 UTC
I count at least 4 ways. The 2 you mention, plus:

- What I proposed above: Just delete the file first. A one line fix.

- Background the offending g_object_unref in a thread. And ensure it's finished before the next time round. There shouldn't be much contention in reality since it takes less than a second to complete and we only attempt it once every 10 seconds.

Since you seem to be leaning toward solutions that require API changes, I think we might just go with my above patch in Ubuntu for now. Although both options I've mentioned here avoid API changes across the project boundary.
Comment 21 Peter Oliver 2018-02-14 15:23:35 UTC
For the benefit of anyone else suffering from this, a workaround is:

    rm ~/.config/totem/session_state.xspf
    touch ~/.config/totem/session_state.xspf
    sudo chattr +i ~/.config/totem/session_state.xspf

The side effect is that Totem will no-longer resume a video when restarted from where it left off, but, for me, that’s a small price to pay for smooth playback.
Comment 22 GNOME Infrastructure Team 2018-05-24 10:57:27 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/totem/issues/116.