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

Fix stale socket rebinding and re-enable python tests for Windows #6590

Merged
merged 2 commits into from Aug 26, 2015

Conversation

theuni
Copy link
Member

@theuni theuni commented Aug 25, 2015

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.

theuni added 2 commits Aug 25, 2015
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.
@theuni
Copy link
Member Author

theuni commented Aug 25, 2015

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.

@theuni theuni changed the title Re-enable python tests for Windows Fix stale socket rebinding and re-enable python tests for Windows Aug 25, 2015
@ptschip
Copy link
Contributor

ptschip commented Aug 25, 2015

Cory,

From you pull request I downloaded and built on native windows and can
confirm that those changes do "not" fix issue 6554

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
changes at least 2 more times. The reason is that the issue, at least
with 6554, is only intermittent and happens roughly 30 to 50% of the time.

On 25/08/2015 9:23 AM, Cory Fields wrote:

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 #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.


Reply to this email directly or view it on GitHub
#6590 (comment).

@theuni
Copy link
Member Author

theuni commented Aug 25, 2015

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.

@ptschip
Copy link
Contributor

ptschip commented Aug 25, 2015

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.

@Diapolo
Copy link

Diapolo commented Aug 25, 2015

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));
Copy link
Member

@laanwj laanwj Aug 26, 2015

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.

@laanwj
Copy link
Member

laanwj commented Aug 26, 2015

utACK

@laanwj laanwj merged commit bd30c3d into bitcoin:master Aug 26, 2015
1 check passed
laanwj added a commit that referenced this issue Aug 26, 2015
bd30c3d rpc-tests: re-enable rpc-tests for Windows (Cory Fields)
a193387 net: Set SO_REUSEADDR for Windows too (Cory Fields)
@theuni theuni mentioned this pull request Aug 29, 2015
5 tasks
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants