Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable when attempting to start two sharded clusters on the same ports #314

Open
ShaneHarvey opened this issue Sep 30, 2024 · 0 comments

Comments

@ShaneHarvey
Copy link
Collaborator

We’re seeing test runs where mongo-orchestration sends this back to the client in an HTTP 500 response:

Traceback (most recent call last):
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/apps/__init__.py", line 66, in wrap
    return f(*arg, **kwd)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/apps/sharded_clusters.py", line 147, in sh_create_by_id
    result = _sh_create(data)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/apps/sharded_clusters.py", line 44, in _sh_create
    cluster_id = ShardedClusters().create(params)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 533, in create
    cluster = ShardedCluster(params)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 103, in __init__
    f.result()
  File "/opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/python3-v4.hzp/lib/python3.10/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/python3-v4.hzp/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/python3-v4.hzp/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 96, in add_shard
    info = self.member_add(cfg.get('id', None), shard_params)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 400, in member_add
    result = self._add(cfgs, member_id)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 377, in _add
    return self.router_command("addShard", (shard_uri, {"name": name}), is_eval=False)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 366, in router_command
    result = getattr(self.connection().admin, mode)(command, name, **d)
  File "/data/mci/09d9293805bba164c02aa32f53e57a72/src/github.com/10gen/mongosync/venv/lib/python3.10/site-packages/mongo_orchestration/sharded_clusters.py", line 334, in connection
    return self.create_connection(self.router['hostname'])
TypeError: 'NoneType' object is not subscriptable

This happens when attempting to start two sharded clusters on the same ports, or more exactly, when starting a mongos on port X but something else is already running on port X, most likely another mongo server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant