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

deleteApp apparently doesn't complete teardown of Firestore connections #2825

Open
dandv opened this issue Jan 4, 2025 · 1 comment
Open

Comments

@dandv
Copy link

dandv commented Jan 4, 2025

Describe your environment

  • Operating System version: Fedora Linx 38
  • Firebase SDK version: 13.0.2
  • Firebase Product: admin SDK apparently / Firestore
  • Node.js version: 22.12.0
  • NPM version: 11.0.0
  • Deno version 2.1.4

Describe the problem

I'm running a simple Deno test of writing to a document in a Firestore collection. The test passes, but Deno detects leaks:

error: Leaks detected:
  - "http2Client" was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
  - "http2ClientConnection" was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
  - 2 intervals were started in this test, but never completed. This is often caused by not calling `clearInterval`.
  - 2 timers were started in this test, but never completed. This is often caused by not calling `clearTimeout`.
  - An async call to op_http2_poll_client_connection was started in this test, but never completed.

Steps to reproduce:

deno test --allow-all leaks-bug.ts

leaks-bug.ts

import { initializeApp, cert, deleteApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';
import { assertExists } from '@std/assert';

Deno.test('test', 
  async () => {
    // Initialize Cloud Firestore per https://firebase.google.com/docs/firestore/quickstart#initialize -> Node.js -> Initialize on your own server
    const app = initializeApp({ credential: cert('service-account-key.json') });
    const db = getFirestore(app);

    const doc = await db.collection('test').doc('test').set({ foo: 42 });
    assertExists(doc);  // passes
    await deleteApp(app);  // doesn't help
    await new Promise(resolve => setTimeout(resolve, 10 * 1000));  // doesn't help
  }
);
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants