ssbc / ssb-server

The gossip and replication server for Secure Scuttlebutt - a distributed social network
1.68k stars 164 forks source link

Can't run ssb-server on OpenBSD if one interface has IPv6 #742

Open rapenne-s opened 3 years ago

rapenne-s commented 3 years ago

Hi!

I've run into an issue when running oasis on OpenBSD 6.8 amd64 and arm64, which I've been able to pinpoint down to ssb-server.

If one network interface has an IPv6 assigned, ssb-server will error on start.

I'm not really sure if the issue comes from ssb-server or a dependency. I am not familiar with the JS ecosystem and the errors doesn't make it easy to know where the error is.

Maybe it's from node_modules/ws/lib/WebSocketServer.js but the ws plugin installed in node_modules by npm install downloaded version 1.1.5 of ws which is 3 years old. On the other hand I've run npm test in ssbc/ssb-ws and the test passes fine. I'm quite lost here.

kongroo$ node bin.js  start
ssb-server 16.0.1 /home/testuser/.ssb logging.level:notice
my key ID: itpstBRGhNXHafcJBGKVa6fh1+YVz8UzyHFGxtOqqkU=.ed25519
events.js:288
      throw er; // Unhandled 'error' event
      ^

Error: listen EINVAL: invalid argument ::1:8989
    at Server.setupListenHandle [as _listen2] (net.js:1292:21)
    at listenInCluster (net.js:1357:12)
    at doListen (net.js:1496:7)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
    at runNextTicks (internal/process/task_queues.js:66:3)
    at processImmediate (internal/timers.js:429:9)
Emitted 'error' event on WebSocketServer instance at:
    at Server.WebSocketServer._onServerError (/home/testuser/ssb-server/node_modules/ws/lib/WebSocketServer.js:82:50)
    at Server.emit (events.js:311:20)
    at emitErrorNT (net.js:1336:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    at runNextTicks (internal/process/task_queues.js:66:3)
    at processImmediate (internal/timers.js:429:9) {
  code: 'EINVAL',
  errno: 'EINVAL',
  syscall: 'listen',
  address: '::1',
  port: 8989
}
staltz commented 3 years ago

Probably a multiserver issue, not strictly ssb-server

rapenne-s commented 3 years ago

Do you mean this multiserver ?

hackergrrl commented 3 years ago

@rapenne-s Yes, that module.

If you run ssb-server as DEBUG=* node bin.js start do you get any interesting-looking debug messages before Node errors out?

Also: what version of Node are you on?

(I'm low-key wondering if https://github.com/nodejs/node/issues/16712 could be the culprit.)