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 657680 - Ensure that persona sets are immutable to clients
Ensure that persona sets are immutable to clients
Status: RESOLVED INVALID
Product: folks
Classification: Platform
Component: folks-inspect
git master
Other Linux
: Normal normal
: gnome-3.6
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2011-08-30 09:21 UTC by Raul Gutierrez Segales
Modified: 2012-07-23 23:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Request for comment patch (2.01 KB, patch)
2011-09-19 16:32 UTC, Raul Gutierrez Segales
rejected Details | Review

Description Raul Gutierrez Segales 2011-08-30 09:21:45 UTC
This is reproducible 1/3 or 1/4 of the times:

$ folks-inspect
> personas

**
ERROR:hashmap.c:2322:gee_hash_map_node_iterator_next: assertion failed: (self->_stamp == self->_map->priv->_stamp)

Program received signal SIGABRT, Aborted.
0x00000033a5c352d5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
  • #0 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 __GI_abort
    at abort.c line 93
  • #2 g_assertion_message
  • #3 g_assertion_message_expr
    at gtestutils.c line 1436
  • #4 gee_hash_map_node_iterator_next
    at hashmap.c line 2322
  • #5 gee_hash_map_node_iterator_next
    at hashmap.c line 2318
  • #6 folks_inspect_commands_personas_real_run
    at command-personas.c line 171
  • #7 folks_inspect_command_run
    at inspect.c line 1075
  • #8 folks_inspect_client_run_interactive
    at inspect.c line 692
  • #9 folks_inspect_client_main
    at inspect.c line 315
  • #10 __libc_start_main
    at libc-start.c line 226
  • #11 _start

Comment 1 Philip Withnall 2011-08-30 18:05:47 UTC
Assuming you're running the `personas` command as soon as you're starting folks-inspect, I suspect this is crashing because the individual whose personas are being listed at that moment has their list of personas modified, this invalidating folks-inspect's iterator.

This is basically the same problem as covered in bug #653233: we should be replacing the container properties of objects (such as sets of personas) with new ones, rather than clearing and re-filling them when they change. That way, we don't interfere with clients who already have a pointer to the existing set. (In contrast, bug #653233 concerns the opposite direction.)
Comment 2 Raul Gutierrez Segales 2011-08-30 19:38:24 UTC
(In reply to comment #1)
> Assuming you're running the `personas` command as soon as you're starting
> folks-inspect, I suspect this is crashing because the individual whose personas
> are being listed at that moment has their list of personas modified, this
> invalidating folks-inspect's iterator.

Yup - that is exactly the case.
Comment 3 Travis Reitter 2011-09-05 16:49:35 UTC
(Punting bugs to 0.6.4)
Comment 4 Raul Gutierrez Segales 2011-09-19 16:32:39 UTC
Created attachment 196965 [details] [review]
Request for comment patch

Have you considered alternate approaches? I was thinking we could, for efficiency's sake, just return a freshly created Set of references for the public getter (in the case of Folks.Individuals#personas we'd return a new Set<Personas>). 

By doing so we'll only be incurring in extra costs when the getter is accessed, instead of instantiating a fresh new Set<> every time we have to deal with a related signal.

The attached patch is just an RFC attempt, though it fixes the problem of folks-inspect crashing on the first run. One problem of this approach is that we'd be changing the ownership transfer for these getters.
Comment 5 Philip Withnall 2011-09-19 18:49:19 UTC
(In reply to comment #4)
> The attached patch is just an RFC attempt, though it fixes the problem of
> folks-inspect crashing on the first run. One problem of this approach is that
> we'd be changing the ownership transfer for these getters.

Changing the ownership transfer for the getters is an API break, and a particularly nasty one which I think would be best to avoid if possible.

Do you have any figures for how many times (e.g.) the getter for IndividualAggregator.individuals is called compared to the number of times we modify that Set in response to related signals? It would be good to know the numbers so we're not just guessing about which case to optimise.
Comment 6 Travis Reitter 2011-10-11 20:36:58 UTC
(mass bump to gnome-3.4 milestone in our new milestone scheme; search this string mass move bug mail)
Comment 7 Travis Reitter 2011-11-09 00:12:19 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > The attached patch is just an RFC attempt, though it fixes the problem of
> > folks-inspect crashing on the first run. One problem of this approach is that
> > we'd be changing the ownership transfer for these getters.
> 
> Changing the ownership transfer for the getters is an API break, and a
> particularly nasty one which I think would be best to avoid if possible.
> 
> Do you have any figures for how many times (e.g.) the getter for
> IndividualAggregator.individuals is called compared to the number of times we
> modify that Set in response to related signals? It would be good to know the
> numbers so we're not just guessing about which case to optimise.

I'll second this (in an effort to bump the attention on this bug). Raul isn't the only person running into this now (though I haven't seen it myself).
Comment 8 Philip Withnall 2012-05-03 19:12:10 UTC
Comment on attachment 196965 [details] [review]
Request for comment patch

Rejecting patch, as it’s out of date and served its purpose as an RFC.
Comment 9 Jeremy Whiting 2012-07-18 18:58:20 UTC
Didn't make gnome-3.4 release, punting to gnome-3.6 milestone
Comment 10 Jeremy Whiting 2012-07-23 19:18:14 UTC
Philip,

Is the best solution to this bug to make an api change as Raul suggested with his rfc patch?  if so I'll set the milestone to the next abi break and get a new branch ready for this.
Comment 11 Philip Withnall 2012-07-23 23:46:20 UTC
(In reply to comment #10)
> Philip,
> 
> Is the best solution to this bug to make an api change as Raul suggested with
> his rfc patch?  if so I'll set the milestone to the next abi break and get a
> new branch ready for this.

Some random thoughts:
 • Breaking API is bad.
 • Atomically replacing the object instance behind IndividualAggregator.individuals would work, but would incur a lot of extra allocations/deallocations. Folks already has a problem with memory overhead, so I don’t think we should be making it worse.
 • This behaviour looks very bad.
 • However at the time, folks-inspect ran the IndividualAggregator in a second thread, and accessed its members from the main thread. As shown with the recent locking changes, we don’t really support this access model at all.
 • folks-inspect now uses a single thread, so I don’t think this bug will actually be reproducible (please correct me if I’m wrong).

As such, I suggest we close it as INVALID. Thoughts?
Comment 12 Jeremy Whiting 2012-07-23 23:56:49 UTC
Agreed, closing now.