Thanks to visit codestin.com
Credit goes to github.com

Skip to content

unsubscribe prints warning in standard use case #173

Closed
@kylemcdonald

Description

@kylemcdonald

Environment details

  • OS type and version: Ubuntu 18.04
  • Python version: Python 3.7.7
  • pip version: pip 20.2.1
  • google-cloud-firestore version: 1.8.1

Steps to reproduce

  1. Create a Firestore collection called "docs" and a single document with the id "sample"
  2. Run the code below.

Code example

from google.cloud import firestore
import threading

firestore_client = firestore.Client()
doc_ref = firestore_client.collection('docs').document('sample')
callback_done = threading.Event()
def on_snapshot(doc_snapshot, changes, read_time):
    for doc in doc_snapshot:
        print(doc.to_dict())
        callback_done.set()
doc_watch = doc_ref.on_snapshot(on_snapshot)
callback_done.wait(10)
doc_watch.unsubscribe()

This code prints "Background thread did not exit." But I'm following the code from this documentation directly, so it seems like a bug that a warning would be printed on normal behavior.

Debug log

DEBUG:google.auth._default:Checking None for explicit credentials as part of auth process...
DEBUG:google.auth._default:Checking Cloud SDK credentials as part of auth process...
DEBUG:google.auth._default:Checking None for explicit credentials as part of auth process...
DEBUG:google.auth._default:Checking Cloud SDK credentials as part of auth process...
DEBUG:google.api_core.bidi:Started helper thread Thread-ConsumeBidirectionalStream
DEBUG:google.api_core.bidi:waiting for recv.
DEBUG:google.auth.transport.requests:Making request: POST https://oauth2.googleapis.com/token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): oauth2.googleapis.com:443
DEBUG:urllib3.connectionpool:https://oauth2.googleapis.com:443 "POST /token HTTP/1.1" 200 None
DEBUG:google.api_core.bidi:recved response.
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: 1
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: ADD
DEBUG:google.api_core.bidi:waiting for recv.
DEBUG:google.api_core.bidi:recved response.
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: document change
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: document change: CHANGED
DEBUG:google.api_core.bidi:waiting for recv.
DEBUG:google.api_core.bidi:recved response.
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: 3
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: CURRENT
DEBUG:google.api_core.bidi:waiting for recv.
DEBUG:google.api_core.bidi:recved response.
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: 0
DEBUG:google.cloud.firestore_v1.watch:on_snapshot: target change: NO_CHANGE
DEBUG:google.cloud.firestore_v1.watch:walk over add_changes
DEBUG:google.cloud.firestore_v1.watch:in add_changes
DEBUG:google.api_core.bidi:waiting for recv.
DEBUG:google.cloud.firestore_v1.watch:Stopping consumer.
INFO:google.cloud.firestore_v1.watch:RPC termination has signaled manager shutdown.
DEBUG:google.api_core.bidi:Cleanly exiting request generator.
DEBUG:google.api_core.bidi:Call to retryable <bound method ResumableBidiRpc._recv of <google.api_core.bidi.ResumableBidiRpc object at 0x7f6bc94633d0>> caused <_MultiThreadedRendezvous of RPC that terminated with:
	status = StatusCode.CANCELLED
	details = "Locally cancelled by application!"
	debug_error_string = "None"
>.
DEBUG:google.api_core.bidi:Terminating <bound method ResumableBidiRpc._recv of <google.api_core.bidi.ResumableBidiRpc object at 0x7f6bc94633d0>> due to <_MultiThreadedRendezvous of RPC that terminated with:
	status = StatusCode.CANCELLED
	details = "Locally cancelled by application!"
	debug_error_string = "None"
>.
DEBUG:google.api_core.bidi:recved response.
WARNING:google.api_core.bidi:Background thread did not exit.
DEBUG:google.cloud.firestore_v1.watch:Finished stopping manager.

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/python-firestore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions