Critical in g_object_ref across threads `g_object_ref: assertion 'old_val > 0' failed
I'm seeing this critical with stack below happening semi-regularly for a GObject created on the main loop and then handballed to another thread. The objects in question aren't being handled concurrently, they just recently passed across a thread boundary. The critical itself is caused by the return value from a call to g_atomic_int_add()
, so maybe something is wrong there?
Geary uses Gee.HashMap in several other places, but this is the only one I see this happening, so I don't think it's a bug in that.
Similar to #1733 (closed) but not involving lang bindings.
![crt] 10:00:32.0628 GLib-GObject: g_object_ref: assertion 'old_val > 0' failed
Thread 85 "pool-geary" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fff577fe700 (LWP 25653)]
_g_log_abort (breakpoint=1) at ../../../glib/gmessages.c:554
554 ../../../glib/gmessages.c: No such file or directory.
(gdb)
(gdb) bt full
#0 0x00007ffff7d348e5 in _g_log_abort (breakpoint=1) at ../../../glib/gmessages.c:554
debugger_present = 1
#1 0x00007ffff7d35bb9 in g_logv
(log_domain=0x7ffff7e48300 "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL, format=<optimised out>, args=args@entry=0x7fff577fd560) at ../../../glib/gmessages.c:1373
domain = 0x0
data = 0x0
depth = 1
log_func = 0x7ffff7d358b0 <g_log_default_handler>
domain_fatal_mask = <optimised out>
masquerade_fatal = 0
test_level = <optimised out>
was_fatal = <optimised out>
was_recursion = <optimised out>
msg = 0x7fff4000b9e0 "g_object_ref: assertion 'old_val > 0' failed"
msg_alloc = 0x7fff4000b9e0 "g_object_ref: assertion 'old_val > 0' failed"
i = 3
#2 0x00007ffff7d35d83 in g_log
(log_domain=log_domain@entry=0x7ffff7e48300 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff7d86713 "%s: assertion '%s' failed")
at ../../../glib/gmessages.c:1415
args =
{{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fff577fd640, reg_save_area = 0x7fff577fd580}}
#3 0x00007ffff7d3657d in g_return_if_fail_warning
(log_domain=log_domain@entry=0x7ffff7e48300 "GLib-GObject", pretty_function=pretty_function@entry=0x7ffff7e4b9b8 <__FUNCTION__.15483> "g_object_ref", expression=expression@entry=0x7ffff7e4a75b "old_val > 0") at ../../../glib/gmessages.c:2771
#4 0x00007ffff7e1e89a in g_object_ref (_object=0x555558472cd0)
at ../../../gobject/gobject.c:3251
__FUNCTION__ = "g_object_ref"
object = 0x555558472cd0
old_val = <optimised out>
__FUNCTION__ = "g_object_ref"
#5 0x00007ffff7e1e89a in g_object_ref (_object=_object@entry=0x555558472cd0)
at ../../../gobject/gobject.c:3243
object = 0x555558472cd0
old_val = <optimised out>
__FUNCTION__ = "g_object_ref"
#6 0x00007ffff7ea17ca in _g_object_ref0 (self=0x555558472cd0) at hashmap.c:2307
result = <optimised out>
self = 0x555559ed58f0 [GeeHashMap]
--Type <RET> for more, q to quit, c to continue without paging--
keys = 0x0
_tmp0_ = 0x555558472cd0
_tmp1_ = <optimised out>
_tmp2_ = <optimised out>
#7 0x00007ffff7ea17ca in gee_hash_map_real_get_keys (base=0x555559ed58f0 [GeeHashMap])
at hashmap.c:2307
result = <optimised out>
self = 0x555559ed58f0 [GeeHashMap]
keys = 0x0
_tmp0_ = 0x555558472cd0
_tmp1_ = <optimised out>
_tmp2_ = <optimised out>
#8 0x0000555555a94864 in ___lambda112_ (_data93_=0x555559c6e800, error=0x7fff577fd850)
at ../src/engine/imap-engine/imap-engine-minimal-folder.vala:595
_email_it = 0x0
_tmp1_ = 0x0
_tmp3_ = 0x555500000007
_tmp5_ = 0x90
_tmp0_ = 0x555559ed58f0
_tmp2_ = 0x60
_tmp4_ = 0x7fff4000d448
_data92_ = 0x55555a177630
self = 0x555557600660 [GearyImapEngineOtherFolder]
#9 0x0000555555a94cae in ____lambda112__geary_nonblocking_concurrent_concurrent_callback
(cancellable=0x55555abab8a0 [GCancellable], self=0x555559c6e800, error=0x7fff577fd850)
at ../src/engine/imap-engine/imap-engine-minimal-folder.vala:594
#10 0x000055555594e7bf in geary_nonblocking_concurrent_concurrent_operation_execute
(self=0x55555a15edb0 [GearyNonblockingConcurrentConcurrentOperation])
at ../src/engine/nonblocking/nonblocking-concurrent.vala:59
_tmp3_ = 0x555555a94c83 <____lambda112__geary_nonblocking_concurrent_concurrent_callback>
_tmp3__target = 0x555559c6e800
_tmp4_ = 0x55555abab8a0 [GCancellable]
_tmp0_ = 1
_tmp1_ = 0x55555abab8a0 [GCancellable]
_inner_error0_ = 0x0
__func__ = "geary_nonblocking_concurrent_concurrent_operation_execute"
#11 0x000055555594df55 in geary_nonblocking_concurrent_on_work_ready
(self=0x55555711fb10 [GearyNonblockingConcurrent], op=0x55555a15edb0 [GearyNonblockingConcurrentConcurrentOperation]) at ../src/engine/nonblocking/nonblocking-concurrent.vala:140
__func__ = "geary_nonblocking_concurrent_on_work_ready"
#12 0x000055555594d4fe in _geary_nonblocking_concurrent_on_work_ready_gfunc