overleaf / overleaf/toolkit

MongoServerSelectionError: Server selection timed out after 2000 ms

Open
#404 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
1.3k
Forks
310
Avg merge
3d 12h
Merged PRs (30d)
1

Description

commit: 3c5ef041a4d510d74cf8bc4a7ee871d125ab99fe

Timed out in connecting to the MongoDB server:

$ bin/up
Initiating Mongo replica set...
[+] Running 1/1
 ✔ Container mongo  Started                                                                             0.3s 
MongoServerSelectionError: Server selection timed out after 2000 ms
Waiting for Mongo...
MongoServerSelectionError: Server selection timed out after 2000 ms
Waiting for Mongo...
^Cexit status 130

The container is unhealthy:

$ docker ps -a
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS                     PORTS       NAMES
4e6f794868a0   mongo:8.0   "docker-entrypoint.s…"   8 minutes ago   Up 8 minutes (unhealthy)   27017/tcp   mongo

OS information:

$ uname -r
6.8.0-87-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble

Docker version:

$ docker version
Client: Docker Engine - Community
 Version:           28.5.1
 API version:       1.51
 Go version:        go1.24.8
 Git commit:        e180ab8
 Built:             Wed Oct  8 12:17:26 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.5.1
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.8
  Git commit:       f8215cc
  Built:            Wed Oct  8 12:17:26 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.28
  GitCommit:        b98a3aace656320842a23f4a392a33f46af97866
 runc:
  Version:          1.3.0
  GitCommit:        v1.3.0-0-g4ca628d1
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Has anyone encountered this problem? I don't know how to fix this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running bin/up and checking the Mongo container's health and startup output on the reported Ubuntu and Docker versions. Compare the timeout with the mongo container logs and the configuration used by bin/up. Done means the MongoDB container becomes healthy and bin/up completes without repeated server-selection timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb, shell
Domain
database, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.