pelias / docker

Run the Pelias geocoder in docker containers, including example projects.
MIT License
315 stars 218 forks source link

"WARNING: Connection pool is full, discarding connection: 127.0.0.1" on pelias compose up #262

Closed cbayerlein closed 3 years ago

cbayerlein commented 3 years ago

Hi!

As stated in the title, I get "WARNING: Connection pool is full, discarding connection: 127.0.0.1" on pelias compose up when I try the Portland example.

Before that, everything seems to run fine.

Full output:

cb@routeable:/opt/pelias/docker/projects/portland-metro$ pelias compose up Creating network "pelias_default" with driver "bridge" Creating pelias_placeholder ... done Creating pelias_libpostal ... done Creating pelias_pip-service ... done Creating pelias_transit ... done Creating pelias_elasticsearch ... done Creating pelias_openaddresses ... Creating pelias_openaddresses ... done Creating pelias_csv_importer ... done Creating pelias_whosonfirst ... Creating pelias_api ... done Creating pelias_whosonfirst ... done Creating pelias_schema ... Creating pelias_schema ... done Creating pelias_interpolation ... Creating pelias_polylines ... done WARNING: Connection pool is full, discarding connection: 127.0.0.1 WARNING: Connection pool is full, discarding connection: 127.0.0.1 Creating pelias_fuzzy_tester ... done

I realise that it's only a warning and pelias seems to run nevertheless. However, it's irritating and confusing and I first thought it's an error.

missinglink commented 3 years ago

Hi @cbayerlein AFAIK this is the first time this particular error message has been reported.

So I suspect that it's something particular about your environment which is causing the error.

Please provide more information about your environment.

Is it possible that there are other elasticsearch servers running on your machine or in your local network?

cbayerlein commented 3 years ago

Hi! Thank you for your feedback. I'm happy to provide more info, but can you specify what you need to know about the environment? There are no other instances of elasticsearch installed locally (i. e. not on the machine itself nor on the local network). I'm running an Ubuntu 20.04 VPS on Azure. I believe the warning comes from an problem with connection pooling with docker compose. I've read that only 10 parallel connections are allowed.

missinglink commented 3 years ago

I'm not familiar with that limit, does setting the corresponding env var export COMPOSE_PARALLEL_LIMIT=20 resolve the issue?

missinglink commented 3 years ago

possibly related? https://github.com/docker/compose/issues/6638#issuecomment-786616817

missinglink commented 3 years ago

but can you specify what you need to know about the environment

This is listed in the issue template when you start a new bug report, unfortunately most people seem to skip over it 🤷

**Environment (please complete the following information):**
<!--
 - OS: [e.g. Linux/Mac/Windows]
 - Docker versions: [e.g. `docker --version`, `docker-compose --version`]
-->
cbayerlein commented 3 years ago

Docker version 20.10.2, build 20.10.2-0ubuntu1~20.04.2 docker-compose version 1.25.0, build unknown

cbayerlein commented 3 years ago

possibly related? docker/compose#6638 (comment)

Yes, I see a relation here, too. However, I tried to raise the environment variable with export COMPOSE_PARALLEL_LIMIT=100 which unfortunatly didn't help...

missinglink commented 3 years ago

docker-compose@v1.25.0 was released 2019-11-18, can you please try updating it before we dig deeper?

https://github.com/pelias/docker#prerequisites

cbayerlein commented 3 years ago

ok, thank you for the hint. I updated to 1.29.2 and now I don't get these warnings anymore. However, the behviour is a bit different now, e. g. pelias compose up doesn't run as background deamon but keeps logging on stdout. Plus, when I forget to set DOCKER_HOST, I get confusing exceptions. That being said, when I tried Pelias for the first time, I had a hard time figuring out how to set up Docker correctly and what the error message about the missing DOCKER_HOST environment variable means. It turned out that I had to configue Docker to listen to TCP. It seems that the default is that Docker listens on a Unix socket only. Unfortunatly this doesn't work with Pelias. Maybe a mention of this in the installation guide could help. I'd also like suggest to mention specific minimum versions for Docker and Docker Compose - as 'a modern version' is not very concrete, especially as 1.25.0 is shipped with the latest Ubuntu LTS, so you would expect it to be 'modern'.

missinglink commented 3 years ago

Thanks for the feedback @cbayerlein.

This is the first time we've had an issue regarding DOCKER_HOST so I suspect there's something non-standard about your Docker installation which is causing the issues you're seeing.

I've never had to set the DOCKER_HOST env var myself and it's not clear why you do either, maybe it's something to do with how AZURE works or how you installed Docker on Ubuntu.

Either way it's outside of the scope of Pelias and difficult to diagnose without SSH access, we've made attempts in the past to provide additional information in the Prerequisites section of the README, such as info about setting the user permissions correctly (which is a common pitfall on Ubuntu).

As we're a small team of volunteers we're not able to test all the versions of docker-compose and keep that list up-to-date, as the software is provided free we're just advising to use the 'latest', this seems to solve a lot of bugs.

Glad you got it working, I'm going to close this issue.

cbayerlein commented 3 years ago

Thanks! Just in case other users stumble upon the same issue with DOCKER_HOST, I used this solution:

https://serverfault.com/questions/843296/how-do-i-expose-the-docker-api-over-tcp

(for security reasons I'd advice to replace 0.0.0.0 with 127.0.0.1 in the systemd docker service configuration)

Then run export DOCKER_HOST=http://127.0.0.1:2375 before invoking pelias commands.

missinglink commented 3 years ago

As an aside, I ran Ubuntu as my desktop environment for 8 years, in the end I changed out of frustration with apt providing very old versions of software, for example sqlite3 was like 5 years old.

It's not a fault of apt perse but because Ubuntu have fairly conservative policies regarding which versions they provide in the default "sources". From a security point-of-view it makes sense but causes issues in development or when using software that's in active development or using modern technologies.

tl;dr don't assume Ubuntu packages are current, they usually aren't 🤷‍♂️