Skip to content
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

Connect failed, create socket failed. #304

Closed
Hadatko opened this issue Jul 25, 2020 · 5 comments
Closed

Connect failed, create socket failed. #304

Hadatko opened this issue Jul 25, 2020 · 5 comments
Labels
feature-request A feature should be added or improved. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue

Comments

@Hadatko
Copy link

Hadatko commented Jul 25, 2020

Hi,
i am trying to connect to aws iot cloud using aws-iot-device-sdk-python-v2. Everytime i am starting app, or when reconnecting i am getting these errors finished by Connected message and application is working well. But i am curios why these errors happening? Looks like they are related to this repository. Demo code example: aws/aws-iot-device-sdk-python-v2#90

[ERROR] [2020-07-25T12:30:01Z] [00007f5d7b0ac700] [socket] - id=0x7f5d6c004e90 fd=6: connect failed with error code 101.
[INFO ] [2020-07-25T12:30:01Z] [00007f5d7b0ac700] [dns] - id=0x1004a40: recording failure for record 2600:1f00:6000::385:ab7e for a1tuyp21t3nvof-ats.iot.us-east-2.amazonaws.com, moving to bad list
[ERROR] [2020-07-25T12:30:01Z] [00007f5d7b0ac700] [channel-bootstrap] - id=0x1032890: failed to create socket with error 1049
[INFO ] [2020-07-25T12:30:01Z] [00007f5d7b0ac700] [socket] - id=0x7f5d6c004e90 fd=6: connection success
[aws] Connected!

@JonathanHenson
Copy link
Contributor

It looks like the ipv6 connect is failing (immediately because it’s an invalid route, hence the reuse of the same fd), and it’s connecting on the ipv4 address. This is expected behavior.

@Hadatko
Copy link
Author

Hadatko commented Jul 26, 2020

Ok. It is weird to have errors as expected behavior. Are you able to find out if device has ipv6 address before trying to use that?
Or find out which ip is used for internet connection..

@JonathanHenson
Copy link
Contributor

Well, we can change the log level, if that’s what’s concerning you. Since devices network configurations change (for example if a vpn tunnel is being used or if you change networks etc...) we’d rather not keep State that’s unnecessary about the network conditions: that’s just more opportunities for some rather nasty bugs.

@Hadatko
Copy link
Author

Hadatko commented Jul 26, 2020

It is up to you. I would prefer to get rid of errors in working application (that is confusing for me at least). If i would write something like that, if i understand this use case correctly it would looks like:

if !socketIPV6():
   print("INFO: Could not connect with ipv6. Trying ipv4")
   if !socketIPV4():
       print("ERROR: Could not connected to AWS even with ipv4")
       return
print("Connected")

@yasminetalby yasminetalby added p3 This is a minor priority issue feature-request A feature should be added or improved. needs-review This issue or pull request needs review from a core team member. labels Jun 23, 2023
@TingDaoK
Copy link
Contributor

Close the issue as we downgraded the log level for socket connection. #594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-review This issue or pull request needs review from a core team member. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

4 participants