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 703073 - frequent crash in dconf_engine_change_notify
frequent crash in dconf_engine_change_notify
Status: RESOLVED FIXED
Product: dconf
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: dconf-maint
dconf-maint
Depends on:
Blocks:
 
 
Reported: 2013-06-25 19:01 UTC by Matthias Clasen
Modified: 2013-06-25 19:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
DConfChangeset: expose concept of "sealing" (4.34 KB, patch)
2013-06-25 19:03 UTC, Allison Karlitskaya (desrt)
committed Details | Review
engine: seal changesets on changes (1.51 KB, patch)
2013-06-25 19:04 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Matthias Clasen 2013-06-25 19:01:46 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=975687

This is showing up as a frequent f19 crash in retrace.fedoraproject.org

The stacktrace has one thread doing:

#0 dconf_engine_change_notify at dconfsettingsbackend.c:242
 #1 dconf_engine_emit_changes at dconf-engine.c:871
 #2 dconf_engine_change_completed at dconf-engine.c:948
 #3 dconf_gdbus_method_call_done at dconf-gdbus-thread.c:230
 #4 g_simple_async_result_complete at gsimpleasyncresult.c:777
 #5 g_dbus_connection_call_done at gdbusconnection.c:5333
 #6 g_simple_async_result_complete at gsimpleasyncresult.c:777
 #7 complete_in_idle_cb at gsimpleasyncresult.c:789
 #11 g_main_context_iteration at gmain.c:3762
 #12 dconf_gdbus_worker_thread at dconf-gdbus-thread.c:81

And the other:

  • #0 __GI___libc_malloc
    at malloc.c line 2858
  • #1 g_malloc
    at gmem.c line 159
  • #2 g_malloc_n
    at gmem.c line 400
  • #3 dconf_changeset_build_description
    at dconf-changeset.c line 456
  • #4 dconf_changeset_describe
    at dconf-changeset.c line 517
  • #5 dconf_engine_emit_changes
    at dconf-engine.c line 870
  • #6 dconf_engine_change_fast
    at dconf-engine.c line 1084
  • #7 dconf_settings_backend_write

Comment 1 Allison Karlitskaya (desrt) 2013-06-25 19:03:58 UTC
Created attachment 247765 [details] [review]
DConfChangeset: expose concept of "sealing"

DConfChangeset is a partially threadsafe type.

when first created, it is mutable and can only be used from one thread.
After it is filled in, the intention is that it can be shared between
threads as long as it isn't changed.

Previously, this transition was made when dconf_changeset_describe() was
called.  After that, it was not possible to make any more changes.

Formalise and document this concept and add an explicit call for it:
dconf_changeset_seal().
Comment 2 Allison Karlitskaya (desrt) 2013-06-25 19:04:02 UTC
Created attachment 247766 [details] [review]
engine: seal changesets on changes

When we do change operations, make sure we seal our DConfChangeset
before sharing it between threads.

This will ensure it gets sealed in only one thread instead of being
implicitly sealed in two different threads at the same time when each of
them calls dconf_changeset_describe().
Comment 3 Matthias Clasen 2013-06-25 19:08:54 UTC
Review of attachment 247765 [details] [review]:

Not sure how seriously you treat the docs for internal apis, but it might be nice to specify which apis require an unsealed DconfChangeset, and also which ones return an unsealed one - e.g. copy seems to return an unsealed changeset, even if the original was sealed.
Comment 4 Colin Walters 2013-06-25 19:13:05 UTC
Review of attachment 247765 [details] [review]:

::: common/dconf-changeset.c
@@ +546,3 @@
   n_items = g_hash_table_size (changeset->table);
 
+  if (!changeset->is_sealed)

This is a redundant conditional given that sealing is idempotent.  Better to not have callers peek at the internals too.
Comment 5 Colin Walters 2013-06-25 19:15:30 UTC
Review of attachment 247766 [details] [review]:

Makes sense to me.
Comment 6 Matthias Clasen 2013-06-25 19:18:08 UTC
Review of attachment 247766 [details] [review]:

::: engine/dconf-engine.c
@@ +1036,3 @@
     return FALSE;
 
+  dconf_changeset_seal (changeset);

Do you have to seal before calling changes_only_writable_keys, to prevent that from changing underneath you ?
Comment 7 Matthias Clasen 2013-06-25 19:22:43 UTC
Ignore the last comment - the idea of sealing is that as long as its still unsealed, it is private to your thread...
Comment 8 Allison Karlitskaya (desrt) 2013-06-25 19:28:32 UTC
Attachment 247765 [details] pushed as 40f887d - DConfChangeset: expose concept of "sealing"
Attachment 247766 [details] pushed as ba512dc - engine: seal changesets on changes