-
Notifications
You must be signed in to change notification settings - Fork 436
aiplatform_v1.ModelGardenServiceClient gets stuck on first initialization when done concurrently #2805
Description
When initializing the aiplatform_v1.ModelGardenServiceClient class concurrently, we've encountered an issue where it gets stuck.
Upon further investigation, it stops at the following line where a GRPC channel is created in ModelGardenServiceGrpcTransport,
python-aiplatform/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py
Line 166 in 1704db8
| self._grpc_channel = type(self).create_channel( |
Following this further leads to where the cygrpc.Channel is created, where it appears that both threads stop.
https://github.com/grpc/grpc/blob/master/src/python/grpcio/grpc/_channel.py#L1973
Once initialization is successful for the first time without this issue, subsequent processes proceed without any problems even when done concurrently, suggesting that this issue only occurs on the first attempt.
Environment details
- OS type and version: macOS 12.6.6
- Python version: 3.10.9
- pip version: 23.2.1
google-cloud-aiplatformversion:1.35.0
Steps to reproduce
aiplatform_v1.ModelGardenServiceClientconcurrently
Code example
here is the code to reproduce issue.
# example
from google.cloud import aiplatform_v1
from concurrent.futures import ThreadPoolExecutor
def init_model_gardern_service_client(_):
# Create a client
client = aiplatform_v1.ModelGardenServiceClient()
def parallel_execution():
with ThreadPoolExecutor() as executor:
results = list(executor.map(init_model_gardern_service_client, [None]*2))
if __name__ == "__main__":
parallel_execution()Stack trace
There is no stacktrace as the process gets just stuck.