Skip to content

core-debugobjects-2023-04-24

  Prevent a race vs. statically initialized objects. Such objects are
  usually not initialized via an init() function. They are special cased
  and detected on first use under the assumption that they are already
  correctly initialized via the static initializer.

  This works correctly unless there are two concurrent debug object
  operations on such an object.

  The first one detects that the object is not yet tracked and tries to
  establish a tracking object after dropping the debug objects hash bucket
  lock. The concurrent operation does the same. The one which wins the
  race ends up modifying the state of the object which makes the other one
  fail resulting in a bogus debug objects warning.

  Prevent this by making the detection of a static object and the
  allocation of a tracking object atomic under the hash bucket lock. So the
  first one to acquire the hash bucket lock will succeed and the second one
  will observe the correct tracking state.

  This race existed forever but was only exposed when the timer wheel code
  added a debug_object_assert_init() call outside of the timer base locked
  region. This replaced the previous warning about timer::function being
  NULL which had to be removed when the timer_shutdown() mechanics were
  added.
Assets 2
Loading