Created
August 18, 2011 22:34
-
-
Save piscisaureus/1155444 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bert: hey, here? | |
ryah: yes | |
Bert: why are you setting SO_REUSEADDR on sockets? | |
ryah: i've heard it's good | |
ryah: :) | |
Bert: aha | |
ryah: well, for servers it's nice | |
ryah: for clients it's more doubtful | |
ryah: i haven't actually tested to see if they can reuse the ephemeral ports more quickly | |
ryah: but htat's what ive been told | |
Bert: with that option set I do not get EADDRINUSE when I bind / listen on the same port | |
ryah: you should | |
ryah: it's still listening when you try the second one? | |
Bert: yes | |
ryah: that should return EADDRINUSE... | |
Bert: hmm | |
Bert: windows does not report any problems then | |
ryah: so which socket accepts the connections? | |
Bert: I'm trying to figure that out... according to MSDN it's indeterminate | |
ryah: squints. | |
Bert: opens google translate | |
ryah: http://bugs.python.org/issue2550 | |
ryah: god. | |
Bert: Ok. That option is dead on windows | |
ryah: yeah | |
ryah: now we're starting to get into the nitty gritty shit | |
ryah: expects more of that | |
Bert: maybe we can use it to create a pre-fork server ;p | |
ryah: i was thinking that oo :) | |
Bert: nope, does not work, first listening socket accepts them all | |
ryah: damn windows. | |
Bert: yes I think I'll move to linux | |
Bert: I added the addrinuse test. And what existential crisis you're talking about is a mistery to me. | |
ryah: user doens't free result of oio_strerror() , right? | |
Bert: hmm. whatever. | |
ryah: https://groups.google.com/forum/#!topic/commonjs/dg0GxUZqC1w | |
Bert: for normal strerror the uses needs to free the buffer. But we can just allocate a global buffer for him. | |
ryah: normal strerror i dont think they do | |
ryah: or at least ive never | |
Bert: you're right | |
Bert: clash of idioms sounds like unnecessary nitpicking to me ... but I might be just ignorant | |
Bert: I think it's weird that `man strerror` does not say anything about the result's lifetime. | |
ryah: building again on unix | |
ryah: tcp writealot isnt passing (of course) | |
ryah: also no timeout on the test runner | |
ryah: also addrinuse | |
ryah: `bind_error_addrinuse` failed: exit code 6. | |
ryah: Output from process `bind_error_addrinuse`: | |
ryah: Assertion failed in test/test-bind-error.c on line 56: r == -1 | |
ryah: very good | |
ryah: test driven development | |
ryah: so | |
ryah: the second bind also returns 0 for me | |
ryah: on the second listen it returns EADDRINUSE | |
Bert: what if you make the first server listen? | |
Bert: oh | |
ryah: % cat x.js | |
ryah: require('net').Server().listen(8000); | |
ryah: require('net').Server().listen(8000); | |
ryah: ^-- this node test throws an error | |
ryah: which is what we want | |
ryah: so i think that test should have oio_listen calls | |
Bert: I used to have them but for windows it doesn't matter | |
Bert: *it | |
Bert: e.g. it is the bind call that fails not listen() | |
Bert: and if I set REUSEADDR all calls just succeed | |
Bert: are we going to define this (please, no) | |
Bert: ? | |
Bert: Or should I change the test so that it passes when either bind or listen errs? | |
ryah: no, let's not let platform incompatibilities leak in | |
ryah: is trying to figure out how this works... | |
ryah: okay - pushed it | |
ryah: working on linux now | |
ryah: see if that works for you | |
ryah: i straced node and this is the order it calls it | |
Bert: ============================================================= | |
Bert: `delayed_accept` failed: exit code -2147483645. | |
Bert: Output from process `delayed_accept`: | |
Bert: Assertion failed in test\test-delayed-accept.c on line 57: r == 0 | |
Bert: | |
Bert: ============================================================= | |
Bert: `bind_error_addrinuse` failed: exit code -2147483645. | |
Bert: Output from process `bind_error_addrinuse`: | |
Bert: Assertion failed in test\test-bind-error.c on line 54: r == 0 | |
Bert: | |
Bert: ============================================================= | |
Bert: `fail_always` failed: exit code -2147483645. | |
Bert: Output from process `fail_always`: | |
Bert: Fatal error in test\test-fail-always.c on line 27: Yes, it always fails | |
Bert: | |
Bert: [% 100|+ 5|- 3]: Done. | |
ryah: enable the REUSEADDR | |
ryah: i accidentally pushed a change to test-list.h FYI | |
Bert: ============================================================= | |
Bert: `bind_error_addrinuse` failed: exit code -2147483645. | |
Bert: Output from process `bind_error_addrinuse`: | |
Bert: Assertion failed in test\test-bind-error.c on line 59: r == -1 | |
ryah: hm | |
Bert: likely linux defers the address checking until actual work is being done with the socket | |
Bert: I could stash the bind error then return it on bind() or connect() | |
Bert: err on listen() or connect() | |
ryah: sounds good | |
ryah: :) | |
Bert: what happens if you bind with an invalid sockaddr() -> error also comes out at listen() | |
Bert: ? | |
ryah: probably on the bind | |
ryah: add a test and i'll tell you | |
Bert: hmm.. then I need to know which errors are reported immediately and which are not | |
ryah: can we just put a bunch of tests for bind in that file? | |
Bert: sure | |
Bert: I intended that | |
ryah: cool - let's do that various bind/listen combos | |
ryah: meanwhile i need to get the timeout thing working with the test runner on unix | |
ryah: so i can actually fail the writealot | |
Bert: heh | |
Bert: I would guess that these errors would be deferred: | |
Bert: EACCESS, EADDRINUSE, EADDRNOTAVAIL | |
Bert: so | |
Bert: I added more tests | |
Bert: most of them fail on windows | |
Bert: I am not sure whether the EFAULT tests are appropriate. | |
Bert: If you pass total garbage as sockaddr* you must die. | |
Bert: It's 4am and I want to call it a day. If you got anything interesting out of those bind tests then please notify me by using the communication medium of your choice. | |
Bert: (though preferably not by pigeon mail or radioactive smoke signals) | |
ryah: ok | |
ryah: i'm flying away in the morning - so you won't hear from me for a while | |
Bert: ok | |
Bert: have fun | |
Bert: say hi from me ;p | |
ryah: will get bind test working before then | |
ryah: (on linux) | |
Bert: nice | |
ryah: hopefully write and timeouts too | |
Bert: bindd tests are not final | |
ryah: i'll write you an email before i go | |
Bert: tell me what works for you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment