Skip to content

firestore.googleapis.com:443 was not shutdown properly #2802

@yahortsaryk

Description

@yahortsaryk

Hello, we're using java client google-cloud-firestore 0.32.0-beta library in our backend app for pushing records into a Firestore instance.
Here is a java code snippet that reflects our processing flow:

`
FirestoreOptions firestoreOptions =
FirestoreOptions.getDefaultInstance().toBuilder()
.setProjectId(projectId)
.setCredentials(credentials)
.build();

        Firestore db = firestoreOptions.getService();
        final List<String> results = new ArrayList<>();
        List<Object> records = new ArrayList<>(); // get list of records
        for (Object record : records) {

            String path = "path/to/collection/" + record.id;
            final DocumentReference doc = db.document(path);
            ApiFuture<String> transaction = db.runTransaction(
                    new Transaction.Function<String>() {
                        @Override
                        public String updateCallback(Transaction transaction) throws Exception {
                            DocumentSnapshot snapshot = transaction.get(doc).get();

                            if (!snapshot.exists()) {
                                transaction.set(snapshot.getReference(), record);
                                return "New record is inserted";
                            }

                            if (condition) {
                                transaction.update(doc, "field", "new value");
                                return "Record is updated";
                            } else {
                                return "Record is skipped";
                            }
                        }
                    });

            results.add(transaction.get());
        }

`

However in our Logs entries we constantly see the following error:

io.grpc.internal.ManagedChannelImpl *~*~*~ Channel io.grpc.internal.ManagedChannelImpl-609 for target firestore.googleapis.com:443 was not shutdown properly!!! ~*~*~* Make sure to call shutdown()/shutdownNow() and awaitTermination().

I guess, it causes a memory leak in our app as we often see OOM exceptions and crashes. We suppose it can be related to this issue #2497 . Can you confirm that ? What can you suggest us as a fix ? (btw, we can't use batch updates as there are no ability to check specific conditions with batches)

Metadata

Metadata

Labels

api: firestoreIssues related to the Firestore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions