Skip to content

Error: grpc_wait_for_shutdown_with_timeout() timed out. #38490

@Ams-tee

Description

@Ams-tee

I encountered an issue with gRPC where the process times out during shutdown. Here are the details:

Python version: 3.X

gRPC version: [insert version number]

Operating System: Windows

Steps to Reproduce:

Create a new Python script and configure gRPC with the provided API key.

Run the following code:
import google.generativeai as genai
from docx import Document
from datetime import datetime

API_KEY = "MY_API_KEY_HERE"

Configure the API

genai.configure(api_key=API_KEY)

Define the prompt

prompt = (
"مرحبًا يا عشاق التاريخ والغموض! اليوم، سنستكشف قصة غامضة من العصور الوسطى..."
)

Initialize the chat model

model = genai.GenerativeModel('gemini-1.5-flash')
chat = model.start_chat(history=[])

Send the prompt to the model and get the response

response = chat.send_message(prompt)

Create a new Word document

doc = Document()

Add a title and the response to the document

doc.add_heading('Script for YouTube Video', 0)
doc.add_paragraph(response.text)

Generate a filename based on the current date

filename = datetime.now().strftime("script.docx")

Save the document

doc.save(filename)

print(f"Script saved as {filename}")

Error Message:

E0000 00:00:1737134222.323849 32148 init.cc:232] grpc_wait_for_shutdown_with_timeout() timed out.

Additional Information:

The script finishes with exit code 0.

The warning message indicates that all log messages before absl::InitializeLog() is called are written to STDERR.

This issue persists despite updating grpcio and grpcio-tools libraries.

The problem occurs in a PyCharm environment with a virtual environment (venv).

Please let me know if you need any additional information or if there's a workaround for this issue. Thank you!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions