-
Notifications
You must be signed in to change notification settings - Fork 35
Throwing an exception, then hitting ctrl-D to reload may leak sockets #109
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
Comments
Hard reset on startup is a good idea, in the library or in code. But the reset pin connection varies by WIZnet board, and may not have been connected by the user (or set up in code). |
Aha!! There's no hardware problem that a good software engineer can't fix. ;) During PR will be incoming, it'll almost certainly need a rewrite, since I put a |
@dgnuff Were you using a W5500 or a W5100s? The software reset on the W5500 is currently unreliable, and I have an open PR that should fix it. So if you are using a W5500 I would be grateful for a quick test because I won't have access to one until late May 😳 |
I was using a Wiznet 5500, on an Ethernet Featherwing. I'm unable to test
on a Wiznet 5100 since I don't have a device that uses that chip.
…On Thu, Apr 20, 2023, 03:12 Martin Stephens ***@***.***> wrote:
@dgnuff <https://github.com/dgnuff> Were you using a W5500 or a W5100s?
—
Reply to this email directly, view it on GitHub
<#109 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGK73XEK56WESEVD4UOLLHLXCEDYZANCNFSM6AAAAAAWYFDRJQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
The W5500 I have with me isn't functioning, so I cannot test against a W5500 until I get home in late May. The fact that both you and @FoamyGuy experience problems after a soft reset on a W5500 makes me think that the issue lies in the chip initialisation for the W5500. I made a best guess edit on the PR that I have pending, but it made things worse. If you are using the Adafruit Ethernet Feather, the W5500 hardware reset pin is broken out, and is supported in the library:
This may solve your problem, if it does, please let me know. |
I can certainly adjust my code.py to specify the reset pin and see if that makes the problem go away. Even so, I have a software fix available that I'd like to consider submitting, since it will help people who are using W5500 chips that don't have the reset wired up. |
Thanks! I purloined a soldering iron and fixed my w5500, so I'm able to test on it. The problem is solved by soft resetting the w5500 during initialisation. The fix works on my pending DHCP PR and I've opened a PR to fix it in the current main branch. |
This came to light when I was diagnosing #108
Specifically, that issue causes the DHCP client to throw an exception and terminal the application. What I noticed was that it would only do that the first time after powering on the device. If I hit ctrl-D to reboot, the error changed as follows.
During normal flow of the DHCP client, with
debug = True
enabled I would typically see the following line repeated half a dozen to a dozen times while waiting for the DHCPOFFER from the server:However, if I were to wait for the exception and then hit ctrl-D, it would just repeat the following line over and over for ever:
Hitting ctrl-C to interrupt, and another ctrl-D to reload again produces:
I think you can see where this is going now. It eventually reaches:
after which the error changes to:
I don't know the inner details of this, but this has a really strong odor of a socket leak to me.
If there's some way to do so, you might want to consider a hard reset of the wiznet5k when the system comes up, to avoid this problem that might be an issue for other situations.
The text was updated successfully, but these errors were encountered: