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

test: Neo4j docker containers are misconfigured with respect to the advertised addresses #235

Open
exaby73 opened this issue Oct 16, 2024 · 0 comments · May be fixed by #243
Open

test: Neo4j docker containers are misconfigured with respect to the advertised addresses #235

exaby73 opened this issue Oct 16, 2024 · 0 comments · May be fixed by #243
Labels
bug Something isn't working

Comments

@exaby73
Copy link
Collaborator

exaby73 commented Oct 16, 2024

When inspecting the routing table in Neo4jConnectionPool::routingTable(), we get the following result on the call to $bolt->route():

[
  {
    "addresses": [
      "localhost:7687"
    ],
    "role": "WRITE"
  },
  {
    "addresses": [
      "localhost:7687"
    ],
    "role": "READ"
  },
  {
    "addresses": [
      "localhost:7687"
    ],
    "role": "ROUTE"
  }
]

Since we are running the Neo4j server in a docker container, localhost should not be accessible. But due to a check in Neo4jConnectionPool::getNextServer(), where we get the list of addresses, deduplicate it and return null if the count is one, we use the default URI to connect which shouldn't be the case. Below is a snippet of the code in question:

private function getNextServer(RoutingTable $table, AccessMode $mode): ?Uri
{
    $servers = array_unique($table->getWithRole()); // Results in `["localhost:7687"]`
    if (count($servers) === 1) {
        return null;
    }
    // ...
}

This is unexpected behavior and should be resolved once we have the local containers advertise the correct addresses

@exaby73 exaby73 added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant