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

unit tests stuck on WIndows 7 (64-bit) with MSVC2012 #189

Closed
bbigras opened this issue Nov 19, 2013 · 3 comments
Closed

unit tests stuck on WIndows 7 (64-bit) with MSVC2012 #189

bbigras opened this issue Nov 19, 2013 · 3 comments

Comments

@bbigras
Copy link
Contributor

bbigras commented Nov 19, 2013

If I try to build RUN_TESTS or if I use ctest -V the tests seems to get stuck indefinitely.

ctest -V works fine on WIndows 8 with MSVC2008.

D:\nanomsg\build [master]> ctest -V
UpdateCTestConfiguration  from :D:/nanomsg/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :D:/nanomsg/build/DartConfiguration.tcl
Test project D:/nanomsg/build
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
      Start  1: inproc

1: Test command: D:\nanomsg\build\Release\inproc.exe
1: Test timeout computed to be: 9.99988e+006
<stuck here with a blinking cursor>
@tailhook
Copy link
Member

Reproduced on my test machine. The following patch fixes the problem:

diff --git a/src/core/sock.c b/src/core/sock.c
index 2f5b435..65649ea 100644
--- a/src/core/sock.c
+++ b/src/core/sock.c
@@ -712,8 +712,8 @@ static void nn_sock_onleave (struct nn_ctx *self)
         else {
             if (sock->flags & NN_SOCK_FLAG_IN) {
                 sock->flags &= ~NN_SOCK_FLAG_IN;
-                nn_efd_unsignal (&sock->rcvfd);
             }
+            nn_efd_unsignal (&sock->rcvfd);
         }
     }

@@ -728,8 +728,8 @@ static void nn_sock_onleave (struct nn_ctx *self)
         else {
             if (sock->flags & NN_SOCK_FLAG_OUT) {
                 sock->flags &= ~NN_SOCK_FLAG_OUT;
-                nn_efd_unsignal (&sock->sndfd);
             }
+            nn_efd_unsignal (&sock->sndfd);
         }
     }
 }

The problem is: it seem the send on windows is non-atomic even on localhost sockets (similar thing may be on non windows boxes too). So there is a moment where byte is already sent but not yet available for the receiver. At this moment we do nn_efd_unsignal and clear NN_SOCK_FLAG_OUT. So there is no chance to unsignal any more and we're in busy loop in nn_send because nn_efd_wait returns true.

The patch above will probably degrade performance too much, so I'm still searching for a real solution.

@tailhook
Copy link
Member

ctest -V works fine on WIndows 8 with MSVC2008.

can you try many times? It occasionally works on our test machine too (Vista AFAICS)

@bbigras
Copy link
Contributor Author

bbigras commented Nov 21, 2013

It's weird. After a couple of times many .exe started to crash (not in the same way as on my work machine where the test would never finish).

C:\Users\Bruno\nanomsg\build [master]> ctest -V
UpdateCTestConfiguration  from :C:/Users/Bruno/nanomsg/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :C:/Users/Bruno/nanomsg/build/DartConfiguration.tcl
Test project C:/Users/Bruno/nanomsg/build
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
      Start  1: inproc

1: Test command: C:\Users\Bruno\nanomsg\build\Debug\inproc.exe
1: Test timeout computed to be: 9.99988e+006
1:
1: This application has requested the Runtime to terminate it in an unusual way.
1: Please contact the application's support team for more information.
1: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 1/29 Test  #1: inproc ...........................***Failed    2.38 sec
test 2
      Start  2: inproc_shutdown

2: Test command: C:\Users\Bruno\nanomsg\build\Debug\inproc_shutdown.exe
2: Test timeout computed to be: 9.99988e+006
2:
2: This application has requested the Runtime to terminate it in an unusual way.
2: Please contact the application's support team for more information.
2: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 2/29 Test  #2: inproc_shutdown ..................***Failed    0.51 sec
test 3
      Start  3: ipc

3: Test command: C:\Users\Bruno\nanomsg\build\Debug\ipc.exe
3: Test timeout computed to be: 9.99988e+006
 3/29 Test  #3: ipc ..............................   Passed    0.01 sec
test 4
      Start  4: ipc_shutdown

4: Test command: C:\Users\Bruno\nanomsg\build\Debug\ipc_shutdown.exe
4: Test timeout computed to be: 9.99988e+006
 4/29 Test  #4: ipc_shutdown .....................   Passed    0.00 sec
test 5
      Start  5: tcp

5: Test command: C:\Users\Bruno\nanomsg\build\Debug\tcp.exe
5: Test timeout computed to be: 9.99988e+006
5:
5: This application has requested the Runtime to terminate it in an unusual way.
5: Please contact the application's support team for more information.
5: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 5/29 Test  #5: tcp ..............................***Failed    0.33 sec
test 6
      Start  6: tcp_shutdown

6: Test command: C:\Users\Bruno\nanomsg\build\Debug\tcp_shutdown.exe
6: Test timeout computed to be: 9.99988e+006
6:
6: This application has requested the Runtime to terminate it in an unusual way.
6: Please contact the application's support team for more information.
6: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 6/29 Test  #6: tcp_shutdown .....................***Failed    0.36 sec
test 7
      Start  7: pair

7: Test command: C:\Users\Bruno\nanomsg\build\Debug\pair.exe
7: Test timeout computed to be: 9.99988e+006
7:
7: This application has requested the Runtime to terminate it in an unusual way.
7: Please contact the application's support team for more information.
7: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 7/29 Test  #7: pair .............................***Failed    0.21 sec
test 8
      Start  8: pubsub

8: Test command: C:\Users\Bruno\nanomsg\build\Debug\pubsub.exe
8: Test timeout computed to be: 9.99988e+006
8:
8: This application has requested the Runtime to terminate it in an unusual way.
8: Please contact the application's support team for more information.
8: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 8/29 Test  #8: pubsub ...........................***Failed    0.38 sec
test 9
      Start  9: reqrep

9: Test command: C:\Users\Bruno\nanomsg\build\Debug\reqrep.exe
9: Test timeout computed to be: 9.99988e+006
9:
9: This application has requested the Runtime to terminate it in an unusual way.
9: Please contact the application's support team for more information.
9: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
 9/29 Test  #9: reqrep ...........................***Failed    0.20 sec
test 10
      Start 10: pipeline

10: Test command: C:\Users\Bruno\nanomsg\build\Debug\pipeline.exe
10: Test timeout computed to be: 9.99988e+006
10:
10: This application has requested the Runtime to terminate it in an unusual way.
10: Please contact the application's support team for more information.
10: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
10/29 Test #10: pipeline .........................***Failed    0.17 sec
test 11
      Start 11: survey

11: Test command: C:\Users\Bruno\nanomsg\build\Debug\survey.exe
11: Test timeout computed to be: 9.99988e+006
11:
11: This application has requested the Runtime to terminate it in an unusual way.
11: Please contact the application's support team for more information.
11: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
11/29 Test #11: survey ...........................***Failed    0.16 sec
test 12
      Start 12: bus

12: Test command: C:\Users\Bruno\nanomsg\build\Debug\bus.exe
12: Test timeout computed to be: 9.99988e+006
12:
12: This application has requested the Runtime to terminate it in an unusual way.
12: Please contact the application's support team for more information.
12: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
12/29 Test #12: bus ..............................***Failed    0.18 sec
test 13
      Start 13: block

13: Test command: C:\Users\Bruno\nanomsg\build\Debug\block.exe
13: Test timeout computed to be: 9.99988e+006
13:
13: This application has requested the Runtime to terminate it in an unusual way.
13: Please contact the application's support team for more information.
13: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
13/29 Test #13: block ............................***Failed    0.17 sec
test 14
      Start 14: term

14: Test command: C:\Users\Bruno\nanomsg\build\Debug\term.exe
14: Test timeout computed to be: 9.99988e+006
14:
14: This application has requested the Runtime to terminate it in an unusual way.
14: Please contact the application's support team for more information.
14: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
14/29 Test #14: term .............................***Failed    0.17 sec
test 15
      Start 15: timeo

15: Test command: C:\Users\Bruno\nanomsg\build\Debug\timeo.exe
15: Test timeout computed to be: 9.99988e+006
15:
15: This application has requested the Runtime to terminate it in an unusual way.
15: Please contact the application's support team for more information.
15: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
15/29 Test #15: timeo ............................***Failed    0.17 sec
test 16
      Start 16: iovec

16: Test command: C:\Users\Bruno\nanomsg\build\Debug\iovec.exe
16: Test timeout computed to be: 9.99988e+006
16:
16: This application has requested the Runtime to terminate it in an unusual way.
16: Please contact the application's support team for more information.
16: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
16/29 Test #16: iovec ............................***Failed    0.16 sec
test 17
      Start 17: msg

17: Test command: C:\Users\Bruno\nanomsg\build\Debug\msg.exe
17: Test timeout computed to be: 9.99988e+006
17/29 Test #17: msg ..............................   Passed    0.03 sec
test 18
      Start 18: prio

18: Test command: C:\Users\Bruno\nanomsg\build\Debug\prio.exe
18: Test timeout computed to be: 9.99988e+006
18:
18: This application has requested the Runtime to terminate it in an unusual way.
18: Please contact the application's support team for more information.
18: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
18/29 Test #18: prio .............................***Failed    0.14 sec
test 19
      Start 19: poll

19: Test command: C:\Users\Bruno\nanomsg\build\Debug\poll.exe
19: Test timeout computed to be: 9.99988e+006
19:
19: This application has requested the Runtime to terminate it in an unusual way.
19: Please contact the application's support team for more information.
19: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
19/29 Test #19: poll .............................***Failed    0.17 sec
test 20
      Start 20: device

20: Test command: C:\Users\Bruno\nanomsg\build\Debug\device.exe
20: Test timeout computed to be: 9.99988e+006
20:
20: This application has requested the Runtime to terminate it in an unusual way.
20: Please contact the application's support team for more information.
20: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
20/29 Test #20: device ...........................***Failed    0.15 sec
test 21
      Start 21: emfile

21: Test command: C:\Users\Bruno\nanomsg\build\Debug\emfile.exe
21: Test timeout computed to be: 9.99988e+006
21:
21: This application has requested the Runtime to terminate it in an unusual way.
21: Please contact the application's support team for more information.
21: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
21/29 Test #21: emfile ...........................***Failed    0.16 sec
test 22
      Start 22: domain

22: Test command: C:\Users\Bruno\nanomsg\build\Debug\domain.exe
22: Test timeout computed to be: 9.99988e+006
22:
22: This application has requested the Runtime to terminate it in an unusual way.
22: Please contact the application's support team for more information.
22: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
22/29 Test #22: domain ...........................***Failed    0.19 sec
test 23
      Start 23: trie

23: Test command: C:\Users\Bruno\nanomsg\build\Debug\trie.exe
23: Test timeout computed to be: 9.99988e+006
23/29 Test #23: trie .............................   Passed    0.00 sec
test 24
      Start 24: list

24: Test command: C:\Users\Bruno\nanomsg\build\Debug\list.exe
24: Test timeout computed to be: 9.99988e+006
24/29 Test #24: list .............................   Passed    0.00 sec
test 25
      Start 25: hash

25: Test command: C:\Users\Bruno\nanomsg\build\Debug\hash.exe
25: Test timeout computed to be: 9.99988e+006
25/29 Test #25: hash .............................   Passed    0.01 sec
test 26
      Start 26: symbol

26: Test command: C:\Users\Bruno\nanomsg\build\Debug\symbol.exe
26: Test timeout computed to be: 9.99988e+006
26/29 Test #26: symbol ...........................   Passed    0.01 sec
test 27
      Start 27: separation

27: Test command: C:\Users\Bruno\nanomsg\build\Debug\separation.exe
27: Test timeout computed to be: 9.99988e+006
27:
27: This application has requested the Runtime to terminate it in an unusual way.
27: Please contact the application's support team for more information.
27: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
27/29 Test #27: separation .......................***Failed    2.32 sec
test 28
      Start 28: zerocopy

28: Test command: C:\Users\Bruno\nanomsg\build\Debug\zerocopy.exe
28: Test timeout computed to be: 9.99988e+006
28:
28: This application has requested the Runtime to terminate it in an unusual way.
28: Please contact the application's support team for more information.
28: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
28/29 Test #28: zerocopy .........................***Failed    2.38 sec
test 29
      Start 29: shutdown

29: Test command: C:\Users\Bruno\nanomsg\build\Debug\shutdown.exe
29: Test timeout computed to be: 9.99988e+006
29:
29: This application has requested the Runtime to terminate it in an unusual way.
29: Please contact the application's support team for more information.
29: Address in use [156384717] (c:\users\bruno\nanomsg\src\utils\efd_win.inc:171)
29/29 Test #29: shutdown .........................***Failed    2.75 sec

24% tests passed, 22 tests failed out of 29

Total Test time (real) =  14.22 sec

The following tests FAILED:
          1 - inproc (Failed)
          2 - inproc_shutdown (Failed)
          5 - tcp (Failed)
          6 - tcp_shutdown (Failed)
          7 - pair (Failed)
          8 - pubsub (Failed)
          9 - reqrep (Failed)
         10 - pipeline (Failed)
         11 - survey (Failed)
         12 - bus (Failed)
         13 - block (Failed)
         14 - term (Failed)
         15 - timeo (Failed)
         16 - iovec (Failed)
         18 - prio (Failed)
         19 - poll (Failed)
         20 - device (Failed)
         21 - emfile (Failed)
         22 - domain (Failed)
         27 - separation (Failed)
         28 - zerocopy (Failed)
         29 - shutdown (Failed)
Errors while running CTest
C:\Users\Bruno\nanomsg\build [master]>

tailhook added a commit that referenced this issue Nov 25, 2013
Assuming that there may be a lag between nn_efd_signal and the data
available in nn_efd_unsignal, we set NN_SOCK_FLAG_IN/OUT if we have a
sucessful return from nn_efd_wait. Setting this flag is safe at any
time. And I expect that it should not create a bottleneck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants