-
Notifications
You must be signed in to change notification settings - Fork 382
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
socket.gaierror: [Errno -2] Name or service not known #1198
Comments
I tried to force the repeatability by disabling the shutdown functions and termination signal.
|
We are experiencing a similar issue. Issue with more details: |
It seems that I forgot to post my workaround :) retries = 8
for attempt in range(retries):
try:
log("Trying to connect to IoT Edge environment")
client = IoTHubModuleClient.create_from_edge_environment()
client.on_message_received = receive_message_handler
client.on_twin_desired_properties_patch_received = receive_twin_patch_handler
client.on_method_request_received = method_request_handler
break
except Exception as ex:
log(f"ERROR: Attempt {attempt + 1} failed: {ex}")
if attempt < retries - 1:
log("New try in {0} seconds.".format(2 ** attempt))
time.sleep(2 ** attempt) # Exponential delay
else:
log("Maximum number of attempts reached. Raising exception to higher level.")
# Cleanup if failure occurs
GPIO.cleanup()
raise ex
return client It rarely goes to 5th try |
Context
Description of the issue
Hello guys,
HI have been having that same issue for a long time now, and only on python modules, most of the time the module cannot start, whenever the module is hard shutdown, without executing the shutdown function, for example when the device is unplugged. After many retries it finally succeeds, but sometimes it takes hours of restarts
Code sample exhibiting the issue
main.py
As I saw in another post, try to add time.sleep(5), but didn't work
Console log of the issue
Before adding the time.sleep(5)
After adding the time.sleep(5)
The text was updated successfully, but these errors were encountered: