Bug 1667966 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

During local xpcshell-test run with FULL DEBUG version of TB, I noticed the following errors.
(I run tests under Debian GNU/linux, but I suspect the bug appears on all the platform.)

```
620: Main Thread] WARNING: NS_ENSURE_TRUE(Preferences::InitStaticMembers()) failed: file /NEW-SSD/NREF-COMM-CENTRAL/mozilla/modules/libpref/Preferences.cpp, line 4287 
```

The number 620 at the beginning of the line above is the frequency of appearances.
That is rather many.

These error were not visible in June. So they are relatively new.
(I have not had a chance to test xpcshell test for a while due to some issues
related to runtime error caused by OS version string issue which has
been fixed lately. So I run xpcshell-test for the first time in a long time.)

These errors are only visible when you add --verbose flag to |mach xpcshell-test| command because the error/warning message IS NOT REPORTED to unsuspecting tryserver submitters. (and better still with --sequential so that the test results won't get mixed with parallel execution of subtests.)

The code in question is as follows.:"
https://searchfox.org/comm-central/source/mozilla/modules/libpref/Preferences.cpp#4287

```

// These preference getter wrappers allow us to look up the value for static
// preferences based on their native types, rather than manually mapping them to
// the appropriate Preferences::Get* functions.
// We define these methods in a struct which is made friend of Preferences in
// order to access private members.
struct Internals {
  template <typename T>
  static nsresult GetPrefValue(const char* aPrefName, T&& aResult,
                               PrefValueKind aKind) {
    nsresult rv = NS_ERROR_UNEXPECTED;
=>  NS_ENSURE_TRUE(Preferences::InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);

    if (Maybe<PrefWrapper> pref = pref_Lookup(aPrefName)) {
      rv = pref->GetValue(aKind, std::forward<T>(aResult));

#ifdef MOZ_GECKO_PROFILER
      if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
        PROFILER_ADD_MARKER_WITH_PAYLOAD(
            "PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
            (aPrefName, Some(aKind), Some(pref->Type()),
             PrefValueToString(aResult), TimeStamp::Now()));
      }
#endif
    }

    return rv;
  }
```
I am a bit perplexed what goes on. Maybe we are trying to reinvoke the initialization after it has already been done???

TIA
During local xpcshell-test run with FULL DEBUG version of TB, I noticed the following errors.
(I run tests under Debian GNU/linux, but I suspect the bug appears on all the platform.)

```
620: Main Thread] WARNING: NS_ENSURE_TRUE(Preferences::InitStaticMembers()) failed: file /NEW-SSD/NREF-COMM-CENTRAL/mozilla/modules/libpref/Preferences.cpp, line 4287 
```

The number 620 at the beginning of the line above is the frequency of appearances.
That is rather many.

These error were not visible in June. So they are relatively new.
(I have not had a chance to test xpcshell test for a while due to some issues
related to runtime error caused by OS version string issue which has
been fixed lately. So I run xpcshell-test for the first time in a long time.)

These errors are only visible when you add --verbose flag to |mach xpcshell-test| command because the error/warning message IS NOT REPORTED to unsuspecting tryserver submitters. (and better still with --sequential so that the test results won't get mixed with parallel execution of subtests.)

The code in question is as follows.:"
https://searchfox.org/comm-central/source/mozilla/modules/libpref/Preferences.cpp#4287

```

// These preference getter wrappers allow us to look up the value for static
// preferences based on their native types, rather than manually mapping them to
// the appropriate Preferences::Get* functions.
// We define these methods in a struct which is made friend of Preferences in
// order to access private members.
struct Internals {
  template <typename T>
  static nsresult GetPrefValue(const char* aPrefName, T&& aResult,
                               PrefValueKind aKind) {
    nsresult rv = NS_ERROR_UNEXPECTED;
    NS_ENSURE_TRUE(Preferences::InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);   <=== THIS LINE

    if (Maybe<PrefWrapper> pref = pref_Lookup(aPrefName)) {
      rv = pref->GetValue(aKind, std::forward<T>(aResult));

#ifdef MOZ_GECKO_PROFILER
      if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
        PROFILER_ADD_MARKER_WITH_PAYLOAD(
            "PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
            (aPrefName, Some(aKind), Some(pref->Type()),
             PrefValueToString(aResult), TimeStamp::Now()));
      }
#endif
    }

    return rv;
  }
```
I am a bit perplexed what goes on. Maybe we are trying to reinvoke the initialization after it has already been done???

TIA
During local xpcshell-test run with FULL DEBUG version of TB, I noticed the following errors.
(I run tests under Debian GNU/linux, but I suspect the bug appears on all the platform.)
These errors are only visible when you add --verbose flag to |mach xpcshell-test| command because the error/warning message IS NOT REPORTED to unsuspecting tryserver submitters. (and better still with --sequential so that the test results won't get mixed with parallel execution of subtests.)

```
620: Main Thread] WARNING: NS_ENSURE_TRUE(Preferences::InitStaticMembers()) failed: file /NEW-SSD/NREF-COMM-CENTRAL/mozilla/modules/libpref/Preferences.cpp, line 4287 
```

The number 620 at the beginning of the line above is the frequency of appearances. I summarized the errors/warnings and I took the above line from the summary.
620 is rather many.

These error were not visible in June. So they are relatively new.
(I have not had a chance to test xpcshell test for a while due to some issues
related to runtime error caused by OS version string issue which has
been fixed lately. So I run xpcshell-test for the first time in a long time.)

The code in question is as follows.:"
https://searchfox.org/comm-central/source/mozilla/modules/libpref/Preferences.cpp#4287

```

// These preference getter wrappers allow us to look up the value for static
// preferences based on their native types, rather than manually mapping them to
// the appropriate Preferences::Get* functions.
// We define these methods in a struct which is made friend of Preferences in
// order to access private members.
struct Internals {
  template <typename T>
  static nsresult GetPrefValue(const char* aPrefName, T&& aResult,
                               PrefValueKind aKind) {
    nsresult rv = NS_ERROR_UNEXPECTED;
    NS_ENSURE_TRUE(Preferences::InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);   <=== THIS LINE

    if (Maybe<PrefWrapper> pref = pref_Lookup(aPrefName)) {
      rv = pref->GetValue(aKind, std::forward<T>(aResult));

#ifdef MOZ_GECKO_PROFILER
      if (profiler_feature_active(ProfilerFeature::PreferenceReads)) {
        PROFILER_ADD_MARKER_WITH_PAYLOAD(
            "PreferenceRead", OTHER_PreferenceRead, PrefMarkerPayload,
            (aPrefName, Some(aKind), Some(pref->Type()),
             PrefValueToString(aResult), TimeStamp::Now()));
      }
#endif
    }

    return rv;
  }
```
I am a bit perplexed what goes on. Maybe we are trying to reinvoke the initialization after it has already been done???

TIA

Back to Bug 1667966 Comment 0