'Readiness probe failes because mongosh --eval freezes

I installed the latest bitnami/mongodb chart for a standalone architecture. The Readiness and Liveness-probes are failing because the statement

mongosh --eval "db.adminCommand('ping')"

does not terminate and freezes the shell. Full output is this:

1002180000@mongodb-6fb5b57d86-c9rh9:/$ mongosh --eval "db.adminCommand('ping')"
Current Mongosh Log ID: 6274eabd30405cdc76830f1a
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.3.1
Using MongoDB:          5.0.8
Using Mongosh:          1.3.1

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting:
   2022-05-06T09:29:15.814+00:00: You are running on a NUMA machine. We suggest launching mongod like this to avoid performance problems: numactl --interleave=all mongod [other options]
   2022-05-06T09:29:15.814+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
------

{ ok: 1 }

If I use local mongosh 1.3.1 with port-forwarding to my k8s-cluster, everything works fine and the shell returns to the command prompt.

However, 'mongosh' returns to the prompt if I append

mongosh --eval "db.adminCommand('ping'); exit();"

But for the probes I'd like to have the result of the ping command as return code.



Solution 1:[1]

I think we are experiencing the same issue - I've opened up an issue, at github: https://github.com/bitnami/charts/issues/10264

Feel free to comment or add things that I might have missed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mizaru