bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.6k stars 8.98k forks source link

[bitnami/mongodb] Infinite loop in replicaSetConfigurationSettings.sh #27482

Open leif-ateme opened 1 week ago

leif-ateme commented 1 week ago

Name and Version

bitnami/mongodb 15.1.15

What architecture are you using?

amd64

What steps will reproduce the bug?

Hi, when deploying mongodb using replicaSetConfigurationSettings.enabled = true the script replicaSetConfigurationSettings.sh never exits its while loop, and outputs logs forever.

The custom configuration is correctly applied (confirmed using rs.config() in mongosh) so I am not sure why it never finishes.

Looking at the script it seems desiredEqualsactual is always false so we never enter the if condition here so the loop never exits.

Are you using any custom parameters or values?

mongodb:
  architecture: replicaset
  replicaCount: 3
  replicaSetConfigurationSettings:
    enabled: true
    configuration:
      members[0].priority: 1
      members[1].priority: 1
      members[2].priority: 1

What is the expected behavior?

replicaSetConfigurationSettings.sh should finish and stop printing logs.

What do you see instead?

replicaSetConfigurationSettings.sh never exits and prints logs forever.

Additional information

The logs image

jmamouriaux commented 1 week ago

My two cents ;)

I confirm the issue. It seems the "grep"command on "currentRsConf" doesn't return the result expected by the test. Indeed, the $key: $value --> "members[n].priority: m" doesn't match with rs.conf() display

...
  members: [
    {
      _id: 0,
      host: 'dbsize-mongodb-0.dbsize-mongodb-headless.ar-675.svc.cluster.local:27017',
      arbiterOnly: false,
      buildIndexes: true,
      hidden: false,
      priority: 1,
      tags: {},
      secondaryDelaySecs: Long('0'),
      votes: 1
    },
...
juan131 commented 5 days ago

Hi @jmamouriaux

Thanks so much for confirming the issue and sharing your insights!

This code comes from this user contribution, given it was 3 years ago it's very likely that the output of the rs.conf() command has changed in recent MongoDB versions, hence the issue.

Given you identified the issue, would you like to contribute with a PR addressing it @jmamouriaux? Please find in this link the contributing guidelines. Otherwise, we'll create an internal task to address it.