Unable to startup DB instance: Port <port> (path: None) was not open

Hi there,

I have really weird issue when using AWS Neptune. Whenever it tries to start on port 4510, it ends failing with this kind of error:

Unable to startup DB instance: Port 55535 (path: None) was not open Traceback (most recent call last):
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/rds/db_utils.py.enc", line 63, in A
2024-06-09 11:50:10     try:B and B(status='creating');G=F.start_db_instance(*E,**C);B and B(status=_D);LOG.debug('DB started successfully.');return G
2024-06-09 11:50:10                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/neptune_api.py.enc", line 12, in start_db_instance
2024-06-09 11:50:10     def start_db_instance(C,req_data,account_id,region_name):A=req_data;B=C._get_server_impl();B.install(A.get('EngineVersion'));D=B.start(A);E=get_db_port_cache_key(A,account_id,region_name);DB_STATE_CACHE[E]=D
2024-06-09 11:50:10                                                                                                                                    ^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/tinkerpop.py.enc", line 24, in start
2024-06-09 11:50:10     def start(C,req_data):A=req_data;B=get_gremlin_version_for_neptune_db_version(A.get('EngineVersion'));D=tinkerpop_package.get_installer(B).get_executable_path();E=A['Port'];F=C.start_server(E,D,B);return F
2024-06-09 11:50:10                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/tinkerpop.py.enc", line 28, in start_server
2024-06-09 11:50:10     A=A.replace('<ssl_conf>',J);save_file(E,A);save_file(H,TINKERGRAPH_PROPS);save_file(I,GROOVY_GRAPH_INIT);M={'GREMLIN_YAML':E,'PID_DIR':B,'CLASSPATH':os.path.join(tinkerpop_package.get_installed_dir(version=G),TINKERPOP_ID_MANAGER_FILE_NAME)};LOG.info('Starting Neptune DB instance on port %s'%C);N=[startup_script,E];O={}if NEPTUNE_GREMLIN_DEBUG else{'outfile':os.devnull};K=run(cmd=N,shell=False,asynchronous=True,env_vars=M,cwd=B,**O);TMP_PROCESSES.append(K);wait_for_port_open(D,retries=13,sleep_time=2);P=timestamp();Q=F.start_proxy(C,D,G);R=DB_STATE_CACHE[C]=ServerInstance(server=K,start_time=P,proxy=Q);return R
2024-06-09 11:50:10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 125, in wait_for_port_open
2024-06-09 11:50:10     return wait_for_port_status(
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 165, in wait_for_port_status
2024-06-09 11:50:10     return retry(check, sleep=sleep_time, retries=retries)
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/sync.py", line 63, in retry
2024-06-09 11:50:10     raise raise_error
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/sync.py", line 59, in retry
2024-06-09 11:50:10     return function(**kwargs)
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 160, in check
2024-06-09 11:50:10     raise Exception(
2024-06-09 11:50:10 Exception: Port 55535 (path: None) was not open
2024-06-09 11:50:10   
2024-06-09 11:50:10 2024-06-09T08:50:10.899  WARN --- [functhread33] l.services.rds.db_utils    : Unable to startup DB instance: Port 43029 (path: None) was not open Traceback (most recent call last):
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/rds/db_utils.py.enc", line 63, in A
2024-06-09 11:50:10     try:B and B(status='creating');G=F.start_db_instance(*E,**C);B and B(status=_D);LOG.debug('DB started successfully.');return G
2024-06-09 11:50:10                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/neptune_api.py.enc", line 12, in start_db_instance
2024-06-09 11:50:10     def start_db_instance(C,req_data,account_id,region_name):A=req_data;B=C._get_server_impl();B.install(A.get('EngineVersion'));D=B.start(A);E=get_db_port_cache_key(A,account_id,region_name);DB_STATE_CACHE[E]=D
2024-06-09 11:50:10                                                                                                                                    ^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/tinkerpop.py.enc", line 24, in start
2024-06-09 11:50:10     def start(C,req_data):A=req_data;B=get_gremlin_version_for_neptune_db_version(A.get('EngineVersion'));D=tinkerpop_package.get_installer(B).get_executable_path();E=A['Port'];F=C.start_server(E,D,B);return F
2024-06-09 11:50:10                                                                                                                                                                                    ^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/neptune/tinkerpop.py.enc", line 28, in start_server
2024-06-09 11:50:10     A=A.replace('<ssl_conf>',J);save_file(E,A);save_file(H,TINKERGRAPH_PROPS);save_file(I,GROOVY_GRAPH_INIT);M={'GREMLIN_YAML':E,'PID_DIR':B,'CLASSPATH':os.path.join(tinkerpop_package.get_installed_dir(version=G),TINKERPOP_ID_MANAGER_FILE_NAME)};LOG.info('Starting Neptune DB instance on port %s'%C);N=[startup_script,E];O={}if NEPTUNE_GREMLIN_DEBUG else{'outfile':os.devnull};K=run(cmd=N,shell=False,asynchronous=True,env_vars=M,cwd=B,**O);TMP_PROCESSES.append(K);wait_for_port_open(D,retries=13,sleep_time=2);P=timestamp();Q=F.start_proxy(C,D,G);R=DB_STATE_CACHE[C]=ServerInstance(server=K,start_time=P,proxy=Q);return R
2024-06-09 11:50:10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 125, in wait_for_port_open
2024-06-09 11:50:10     return wait_for_port_status(
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 165, in wait_for_port_status
2024-06-09 11:50:10     return retry(check, sleep=sleep_time, retries=retries)
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/sync.py", line 63, in retry
2024-06-09 11:50:10     raise raise_error
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/sync.py", line 59, in retry
2024-06-09 11:50:10     return function(**kwargs)
2024-06-09 11:50:10            ^^^^^^^^^^^^^^^^^^
2024-06-09 11:50:10   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/net.py", line 160, in check
2024-06-09 11:50:10     raise Exception(
2024-06-09 11:50:10 Exception: Port 43029 (path: None) was not open

The port is always different when the error occurs. The issue is not present on MacBook laptops, tested with both Intel and Apple CPUs. The issue is happening on a Windows Machine that use Docker Engine with WSL2.

I don’t know if the next info is useful but: the Neptune cluster gets created with boto3 in a Flask application.

I genuinely do not know how to debug this further, if you need some more info from my side, let me know and I’ll gladly provide it.

Thank you in advance.

Hi @plydark,

Please share the steps for starting LocalStack and for starting AWS Neptune on LocalStack.

I followed the steps in our documentation Neptune | Docs (localstack.cloud) and had no issue starting the Neptune cluster.