ainblockchain / ain-blockchain

Official Javascript implementation of AI Network Blockchain.
https://www.ainetwork.ai/
MIT License
67 stars 27 forks source link

[BUG] P2p unit tests fails with port number conflicts on Monterey #935

Closed platfowner closed 2 years ago

platfowner commented 2 years ago

On Monterey, p2p unit tests fails with port number conflicts :

yarn run test_unit_p2p

...

  P2p
    1) "before all" hook in "P2p"

  0 passing (617ms)
  1 failing

  1) P2p
       "before all" hook in "P2p":
     Uncaught Error: listen EADDRINUSE: address already in use :::5000
      at Server.setupListenHandle [as _listen2] (net.js:1331:16)
      at listenInCluster (net.js:1379:12)
      at Server.listen (net.js:1465:7)
      at new WebSocketServer (node_modules/ws/lib/websocket-server.js:75:20)
      at P2pServer.listen (p2p/server.js:66:21)
      at Context.<anonymous> (test/unit/p2p.test.js:34:21)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

/Users/seo/git/comcomai/blockchain/ain-blockchain/node_modules/mocha/lib/runner.js:962
    throw err;
    ^

Error: done() called multiple times in hook <P2p "before all" hook in "P2p"> of file /Users/seo/git/comcomai/blockchain/ain-blockchain/test/unit/p2p.test.js
    at createMultipleDoneError (/Users/seo/git/comcomai/blockchain/ain-blockchain/node_modules/mocha/lib/errors.js:366:13)
    at multiple (/Users/seo/git/comcomai/blockchain/ain-blockchain/node_modules/mocha/lib/runnable.js:288:24)
    at done (/Users/seo/git/comcomai/blockchain/ain-blockchain/node_modules/mocha/lib/runnable.js:299:14)
    at /Users/seo/git/comcomai/blockchain/ain-blockchain/node_modules/mocha/lib/runnable.js:369:11
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  code: 'ERR_MOCHA_MULTIPLE_DONE',
  valueType: 'undefined',
  value: undefined
}
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
platfowner commented 2 years ago

It looks like Control Center is using port 5000:

bash port_list_macos.sh 
Password:
launchd       1            root    6u  IPv6 0xfea8b9ba5cf831f5      0t0    TCP *:22 (LISTEN)
launchd       1            root    8u  IPv4 0xfea8b9bf29a7896d      0t0    TCP *:22 (LISTEN)
launchd       1            root   10u  IPv6 0xfea8b9ba5cf831f5      0t0    TCP *:22 (LISTEN)
launchd       1            root   11u  IPv4 0xfea8b9bf29a7896d      0t0    TCP *:22 (LISTEN)
remoted      75            root    4u  IPv6 0xfea8b9ba5cf83fb5      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49153 (LISTEN)
remoted      75            root    5u  IPv6 0xfea8b9ba5cf84695      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49154 (LISTEN)
remoted      75            root    6u  IPv6 0xfea8b9ba5cf84d75      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49155 (LISTEN)
remoted      75            root    7u  IPv6 0xfea8b9ba5cf85455      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49156 (LISTEN)
remoted      75            root    8u  IPv6 0xfea8b9ba5cf85b35      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49157 (LISTEN)
remoted      75            root    9u  IPv6 0xfea8b9ba5cf86215      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49158 (LISTEN)
remoted      75            root   10u  IPv6 0xfea8b9ba5cf868f5      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49159 (LISTEN)
remoted      75            root   11u  IPv6 0xfea8b9ba5cf86fd5      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49160 (LISTEN)
rapportd    458             seo    6u  IPv4 0xfea8b9bf2804c96d      0t0    TCP *:58838 (LISTEN)
rapportd    458             seo    8u  IPv6 0xfea8b9ba5cf7e455      0t0    TCP *:58838 (LISTEN)
ControlCe  1878             seo   19u  IPv4 0xfea8b9bf29a7940d      0t0    TCP *:7000 (LISTEN)
ControlCe  1878             seo   20u  IPv6 0xfea8b9ba5cf88475      0t0    TCP *:7000 (LISTEN)
ControlCe  1878             seo   21u  IPv4 0xfea8b9bf29a75ecd      0t0    TCP *:5000 (LISTEN)
ControlCe  1878             seo   22u  IPv6 0xfea8b9ba5cf81b55      0t0    TCP *:5000 (LISTEN)
delfino    3497             seo    9u  IPv4 0xfea8b9bf29a6896d      0t0    TCP 127.0.0.1:16107 (LISTEN)
node      28795             seo   21u  IPv6 0xfea8b9ba5cf75fb5      0t0    TCP *:57437 (LISTEN)
platfowner commented 2 years ago

After disabling AirPlay Receiver (see https://developer.apple.com/forums/thread/682332 ), it's gone now:

bash port_list_macos.sh 
Password:
launchd      1            root    7u  IPv6 0xf16dce4d417f2bcd      0t0    TCP *:22 (LISTEN)
launchd      1            root    8u  IPv4 0xf16dce43aa061345      0t0    TCP *:22 (LISTEN)
launchd      1            root   10u  IPv6 0xf16dce4d417f2bcd      0t0    TCP *:22 (LISTEN)
launchd      1            root   11u  IPv4 0xf16dce43aa061345      0t0    TCP *:22 (LISTEN)
remoted     79            root    4u  IPv6 0xf16dce4d417f398d      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49153 (LISTEN)
remoted     79            root    5u  IPv6 0xf16dce4d417f406d      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49154 (LISTEN)
remoted     79            root    6u  IPv6 0xf16dce4d417f474d      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49155 (LISTEN)
remoted     79            root    7u  IPv6 0xf16dce4d417f4e2d      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49156 (LISTEN)
remoted     79            root    8u  IPv6 0xf16dce4d417f550d      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49157 (LISTEN)
remoted     79            root    9u  IPv6 0xf16dce4d417f5bed      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49158 (LISTEN)
remoted     79            root   10u  IPv6 0xf16dce4d417f62cd      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49159 (LISTEN)
remoted     79            root   11u  IPv6 0xf16dce4d417f69ad      0t0    TCP [fe80:4::aede:48ff:fe00:1122]:49160 (LISTEN)
rapportd   381             seo    3u  IPv4 0xf16dce43aa061de5      0t0    TCP *:49167 (LISTEN)
rapportd   381             seo    4u  IPv6 0xf16dce4d417f852d      0t0    TCP *:49167 (LISTEN)
delfino   2366             seo    9u  IPv4 0xf16dce43aa0588a5      0t0    TCP 127.0.0.1:16107 (LISTEN)
node      2425             seo   21u  IPv6 0xf16dce4d417ec2ad      0t0    TCP *:49188 (LISTEN)
platfowner commented 2 years ago

Fixed, thanks!