martin: Cant retrieve connection from the pool: Timed out in bb8

Hi all. Just started on this mapping tools quest 😃 I’m not being able to solve what seems to be a simple issue with martin.

I have my postgres bd running (OSM is the bd name), it is already fed with data coming from osm2pgsql with flex output. No issues there. It has a points, lines, polygons table with geometries. Now i want to serve my vector tiles with martin 😃

I’m on windows 10, my postegres is running on a local server on ubuntu. Running on terminal: PS C:\Users\[user]\Desktop\martin> .\martin.exe -c .\config.yaml

On yaml file I have:

connection_string: "postgres://postgres:[pass]@[local_ip_for_ubuntu]:5432/OSM"
default_srid: 4326
listen_addresses: "0.0.0.0:4000"

I’ve tried without the config file, using connection string on the terminal. Same output:

[2022-11-29T16:13:46Z INFO  martin] Starting Martin v0.6.1
[2022-11-29T16:13:46Z INFO  martin] Using .\config.yaml
[2022-11-29T16:13:46Z INFO  martin::pg::db] Connecting to database
[2022-11-29T16:14:16Z ERROR martin] Can't retrieve connection from the pool: Timed out in bb8

I can connect just fine with pgadmin to the bd, and I ran the osm2pgsql process on this windows machine with output going to this same bd. I can“t seem to make this work. What am I missing? Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 55 (33 by maintainers)

Commits related to this issue

Most upvoted comments

I think I finally was able to reliably reproduce it. The issue (suprise!) is related to SSL – I need to disable hostname verification during SSL handshake. Secondary issue was upstream – https://github.com/djc/bb8/issues/151 – that’s why no errors were being reported, instead giving a silly ā€œtimeoutā€.

I will fix this in the next few days, and republish, possibly backporting it to 0.6.0 too.

I just merged the fix to main, could someone with this issue try it? Note that you would need to either use the maplibre/martin:main docker image or use cargo run --features ssl --release -- postgres://... to build it locally. Thanks!

CC: @IceMan1910 @CarlosZiegler @carlosrziegler @ItsCoolOnMars @dwweb0309

@dwweb0309 ah, you forgot to share the file with the docker container itself, and doing the same thing as tileserve-gl wouldn’t help here.

try this:

docker run --rm -it --net=host -v $PWD:/martin-config -p 3009:3000 \
   -e DATABASE_URL=postgres://postgres:password@localhost/propedia \
   maplibre/martin:main -c /martin-config/config.yaml

from the dir that contains your config file (or specify the full path in -v param. This way you share the file with the docker container, and it can read it.

my plan to fix this:

  • disable hostname verification during SSL handshake (it will be less secure!), and backport it to 0.6.0
  • try to work around the current limitation of the upstream not supporting all psql ssl modes
  • migrate bb8 to deadpool, as it seems to be more actively maintained
  • migrate to rustls to simplify the build and deployment (remove openssl dependency!)

I have the same error right now if try to connect to an external DB ( Google Cloud ). PGAdmin works fine with the same string connection. image