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
Fix stale socket rebinding and re-enable python tests for Windows #6590
Conversation
When running the rpc tests in Wine, nodes often fail to listen on localhost due to a stale socket from a previous run. This aligns the behavior with other platforms.
Grr, I forgot to mention here that this is only known to fix issues with running the Windows tests on Linux via Wine. This isn't a substitute for #6548 which aims to fix them when running natively. Imo it'd be easier to make sure they work with Travis first, so we can ensure that any fixes for native Windows don't cause any regressions. |
Cory, From you pull request I downloaded and built on native windows and can however, I saw that the tests for windows, "on linux" did pass, so that was good. The only request I have is that you try running that build with your On 25/08/2015 9:23 AM, Cory Fields wrote:
|
The issue that this fixes is 100% reproducible, it happens every time without the fix, and never with it. I'll admit that I'm puzzled as to why it doesn't happen on native Windows, though. Maybe it has to do with how quickly the processes are spun up. I think it's safe to say they're separate issues. |
That's great...when this fix get's merged I'll make the changes to the "enable python scripts for windows" without the travis.yml updates. |
IMHO this change wont hurt even when applied to native Windows. I'm going to integrate it into my local build and will run my 2 partially online nodes with it applied and see what happens ;). Perhaps there are other ifdef cases that apply settings/state for Linux but not Windows... |
setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int)); | ||
#else | ||
setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&nOne, sizeof(int)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified that this is the correct type: type of SO_REUSEADDR
's value is a BOOL
according to MS' API docs, and BOOL
is a typedef of int
. nOne
is an int
.
utACK |
bd30c3d rpc-tests: re-enable rpc-tests for Windows (Cory Fields) a193387 net: Set SO_REUSEADDR for Windows too (Cory Fields)
The fix is debatable, but it points out the real issue: when testing with Windows, stale sockets from previous runs cause the current tests' listen sockets to be unavailable, leading to nodes that never sync. I'm sure that translates to real-world issues as well, for example watchdog scripts would likely fail to work as intended. I'm not sure if there's a more proper way to fix the problem for Windows, so I just copied the behavior we already use for Unix.
This may be part of the root cause of #6554, but I'm not sure about that.
With that fixed, these test run fine locally. Note that they do take quite a while to run though, so we might not want to enable them on Travis for every PR/push.