Closed Bug 1531632 Opened 5 years ago Closed 5 years ago

putenv is called too late during initialization

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox66 wontfix, firefox67 fixed)

RESOLVED FIXED
Firefox 67
Tracking Status
firefox66 --- wontfix
firefox67 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(2 files)

This has at least two known side effects:

  • This prevents from the instrumentation part of PGO to use the LLVM_PROFILE_FILE environment variable
  • This prevents from using MOZ_DEBUG_LINKER to enable the linker debug log (which used to work before because putenv was called earlier).

There are at least two known side effects of initializing it after
loading libxul:

  • We can't set LLVM_PROFILE_FILE for the instrumentation part of PGO to
    make the compiler-rt static initializer pick it.
  • We can't set MOZ_DEBUG_LINKER to enable the linker debug log (which
    used to work when environment variables were set earlier).
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/85fce02180b6
Initialize environment variables before loading libxul. r=snorp

This appears in the log:

No implementation found for void org.mozilla.gecko.mozglue.GeckoLoader.putenv(java.lang.String) (tried Java_org_mozilla_gecko_mozglue_GeckoLoader_putenv and Java_org_mozilla_gecko_mozglue_GeckoLoader_putenv__Ljava_lang_String_2)

which is interesting, because it suggests libmozglue is not loaded, which I guess makes sense, but why is it a problem only on x86_64?

(In reply to Mike Hommey [:glandium] from comment #4)

This appears in the log:

No implementation found for void org.mozilla.gecko.mozglue.GeckoLoader.putenv(java.lang.String) (tried Java_org_mozilla_gecko_mozglue_GeckoLoader_putenv and Java_org_mozilla_gecko_mozglue_GeckoLoader_putenv__Ljava_lang_String_2)

which is interesting, because it suggests libmozglue is not loaded, which I guess makes sense, but why is it a problem only on x86_64?

I don't see that it attempted any tests on ARM, so I'm sure it fails there too.

Flags: needinfo?(snorp)
Flags: needinfo?(snorp)
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/b57ec6985cd1
Initialize environment variables before loading libxul. r=snorp

Snorp, help!

Flags: needinfo?(mh+mozilla)
Attached patch wait-init.diffSplinter Review

This fixes it for me. You need to wait for init() to be called, and it was happening too late (and doesn't need to wait for LIBS_READY state).

Flags: needinfo?(snorp)
Comment on attachment 9049174 [details] [diff] [review]
wait-init.diff

Review of attachment 9049174 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you!
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/bf9beb4c67a5
Initialize environment variables before loading libxul. r=snorp

Oh, I missed the removal of the state check.

Flags: needinfo?(mh+mozilla)
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/920cfaa83fd8
Initialize environment variables before loading libxul. r=snorp
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: