Closed Bug 1959771 Opened 2 months ago Closed 2 months ago

Global Glean object init race with `PRE_INIT_*` patterns

Categories

(Data Platform and Tools :: Glean: SDK, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: chutten, Unassigned)

References

Details

Attachments

(1 file)

glean_core has a pattern in its General APIs that, to handle APIs being called before Glean has been init, we save the provided information to PRE_INIT_ static data, and process it later.

To determine the difference between "before Glean has been init" and "later", we use was_initialize_called. If it has, we assume it's "later" so we can call with_glean(_mut).

However, this creates a race where initialize has been called (and the "glean.init" thread spawned, and so forth), but the global Glean object has not yet been set up (ie, setup_glean has yet to return (or even be called) in the "glean.init" thread).

A more correct and safer definition of "later" would be to check if the Global Glean has been initialized. An actually correct and safe one would be to check if the PRE_INIT_ static data has been consumed.

Duplicate of this bug: 1959515
No longer duplicate of this bug: 1959515
See Also: → 1959515
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size:

OSZAR »