Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirebaseServerAppImpl: guard use of FinalizationRegistry based on its availability. #8335

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

DellaBitta
Copy link
Contributor

Discussion

The code had already guarded use of the FinalizationRegstiry during the initialization of FirebaseServerApp in initializeServerApp if the releaseOnDeref configuration parameter was defined. This gating was to provide functionality in older node versions. However, there was other code that would errantly attempt to allocate a FinalizationRegstiry in FirebaseServerAppImpl regardless of the existence of releaseOnDeref field, and this caused issues in some edge environments.

This change fixes that issue.

Testing

I had tested this previously using Node v14.14.0, which is the release version previous to the reported addition of the FinalizationRegistry, and our code had worked. However, it appears that 14.14.0 actually includes the FinalizationRegistry, so my tests completed successfully when they shouldn't have.

I was able to reproduce this problem in Node 14.0.0, and that's the version I used to test this fix.

API Changes

N/A.

@DellaBitta DellaBitta requested a review from a team as a code owner June 25, 2024 14:25
Copy link

changeset-bot bot commented Jun 25, 2024

🦋 Changeset detected

Latest commit: 17bff19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/app Patch
firebase Patch
@firebase/app-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jamesdaniels
Copy link
Member

Do we want to throw if releaseOnDeref is used an finalization registery is not available?

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 25, 2024

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (e7260e2)Merge (1d53195)Diff
    browser18.1 kB18.2 kB+113 B (+0.6%)
    esm523.7 kB23.8 kB+114 B (+0.5%)
    main24.8 kB24.9 kB+114 B (+0.5%)
    module18.1 kB18.2 kB+113 B (+0.6%)
  • firebase

    TypeBase (e7260e2)Merge (1d53195)Diff
    firebase-app-compat.js31.4 kB31.6 kB+111 B (+0.4%)
    firebase-app.js102 kB102 kB+166 B (+0.2%)
    firebase-compat.js786 kB786 kB+111 B (+0.0%)
    firebase-performance-standalone-compat.es2017.js93.3 kB93.4 kB+111 B (+0.1%)
    firebase-performance-standalone-compat.js70.4 kB70.5 kB+108 B (+0.2%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/kieaJADt9k.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 25, 2024

Size Analysis Report 1

Affected Products

  • @firebase/app

    • initializeServerApp

      Size

      TypeBase (e7260e2)Merge (1d53195)Diff
      size11.3 kB11.4 kB+113 B (+1.0%)
      size-with-ext-deps25.1 kB25.3 kB+113 B (+0.4%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/XbflkKfrU3.html

@DellaBitta
Copy link
Contributor Author

Do we want to throw if releaseOnDeref is used an finalization registery is not available?

We already do in initializeServerApp.

@DellaBitta DellaBitta requested a review from hsubox76 June 26, 2024 20:03
@DellaBitta DellaBitta requested review from a team as code owners June 28, 2024 13:58
@DellaBitta DellaBitta merged commit ed1c993 into master Jun 28, 2024
44 checks passed
@DellaBitta DellaBitta deleted the ddb-finalization-registry branch June 28, 2024 19:40
@google-oss-bot google-oss-bot mentioned this pull request Jul 2, 2024
tom-andersen pushed a commit that referenced this pull request Jul 24, 2024
… availability. (#8335)

There was code that would errantly attempt to allocate a FinalizationRegstiry in FirebaseServerAppImpl regardless of the existence of releaseOnDeref field, and this caused issues in some edge environments.

This change fixes that issue.
@firebase firebase locked and limited conversation to collaborators Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants