Skip to content

seat reservation expired when using proxy with more than 3 instances randomly #30

@naive17

Description

@naive17

Hi.
I'm opening this issue because when i use pm2 and use more than 2/3 instances the server throws

Error: seat reservation expired.
0|colyseus-app  |     at WebSocketServer.onConnection (/Users/user/Documents/GitHub/dverso/multiplayer_server/node_modules/@colyseus/ws-transport/build/WebSocketTransport.js:105:23)
0|colyseus-app  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)

It happens casually, not everytime, but the more instances i set the more frequently it pops.

here my pm2 config

/* PM2 config file */
const os = require('os');

module.exports = {
    apps : [
      /**
       * Colyseus processes
       */
      {
        name      : 'colyseus-app',
        script    : './dist/multiplayer_server/index.js',
        instances : 8,
        exec_mode : 'fork',
        port      : 3567,
        env: {
          NODE_ENV: 'development',
        },
      },
      /**
       * Proxy process
       */
      {
        name: 'proxy',
        script: './node_modules/@colyseus/proxy/bin/proxy',
        instances: 1, // os.cpus().length,
        exec_mode: 'fork',
        env: {
          PORT : 2567,
          // Required options:
          REDIS_URL: 'redis://127.0.0.1:6379/0',
  
          // // SSL (optional)
          // SSL_KEY: "/Users/endel/.localhost-ssl/localhost.key",
          // SSL_CERT: "/Users/endel/.localhost-ssl/localhost.crt",
        }
      }],
  
  };

this is my server setup code

const gameServer = new Server({
  presence: new RedisPresence({
    db : 0,
    host : "127.0.0.1",
    port : 6379,
  }),
  driver : new MongooseDriver(),
  transport: new WebSocketTransport({
  })
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions