spotify / XCMetrics

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
https://xcmetrics.io
Other
1.1k stars 77 forks source link

Error connecting to postgres when running docker compose local #59

Closed dcacenabes closed 2 years ago

dcacenabes commented 2 years ago

Steps to reproduce

Clone the repo and run ❯ docker-compose -f docker-compose-local.yml up I get the error: xcmetrics_1 | Fatal error: Error raised at top level: NIOPostgres error: connection closed: file Swift/ErrorType.swift, line 200

Full output:

Creating network "xcmetrics_default" with the default driver
Creating xcmetrics_redis_1      ... done
Creating xcmetrics_postgresql_1 ... done
Creating xcmetrics_xcmetrics_1  ... done
Attaching to xcmetrics_redis_1, xcmetrics_postgresql_1, xcmetrics_xcmetrics_1
postgresql_1  |
postgresql_1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgresql_1  |
redis_1       | 1:C 04 Oct 2021 12:19:40.636 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1       | 1:C 04 Oct 2021 12:19:40.636 # Redis version=6.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1       | 1:C 04 Oct 2021 12:19:40.636 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1       | 1:M 04 Oct 2021 12:19:40.637 * monotonic clock: POSIX clock_gettime
postgresql_1  | 2021-10-04 12:19:40.704 UTC [1] LOG:  starting PostgreSQL 14.0 (Debian 14.0-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
redis_1       | 1:M 04 Oct 2021 12:19:40.639 * Running mode=standalone, port=6379.
redis_1       | 1:M 04 Oct 2021 12:19:40.639 # Server initialized
postgresql_1  | 2021-10-04 12:19:40.705 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgresql_1  | 2021-10-04 12:19:40.705 UTC [1] LOG:  listening on IPv6 address "::", port 5432
redis_1       | 1:M 04 Oct 2021 12:19:40.640 * Ready to accept connections
postgresql_1  | 2021-10-04 12:19:40.708 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgresql_1  | 2021-10-04 12:19:40.716 UTC [27] LOG:  database system was interrupted; last known up at 2021-10-01 11:48:39 UTC
postgresql_1  | 2021-10-04 12:19:40.926 UTC [27] LOG:  database system was not properly shut down; automatic recovery in progress
postgresql_1  | 2021-10-04 12:19:40.929 UTC [27] LOG:  redo starts at 0/16FB6C8
postgresql_1  | 2021-10-04 12:19:40.929 UTC [27] LOG:  invalid record length at 0/16FB700: wanted 24, got 0
postgresql_1  | 2021-10-04 12:19:40.929 UTC [27] LOG:  redo done at 0/16FB6C8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
postgresql_1  | 2021-10-04 12:19:40.943 UTC [1] LOG:  database system is ready to accept connections
xcmetrics_1   | [ NOTICE ] Connecting to xcmetrics-dev in postgresql as xcmetrics-dev password length 13
xcmetrics_1   | [ INFO ] Using redis host redis and port 6379
xcmetrics_1   | [ ERROR ] Uncaught error: NIOPostgres error: protocol error: Unkonwn authentication request type: 10
xcmetrics_1   | [ ERROR ] NIOPostgres error: connection closed
xcmetrics_1   | [ ERROR ] error while closing connection [error: alreadyClosed, rdstk_conn_id: F4F8AE96-8132-4009-8886-0A89A913ACEA, rdstk_conpool_id: B248BA6F-A666-404D-98FF-98AF53133DDF]
xcmetrics_1   | [ ERROR ] error while closing connection [error: alreadyClosed, rdstk_conn_id: 7E83E938-0D19-4DAE-A65B-F0FFEB602468, rdstk_conpool_id: B248BA6F-A666-404D-98FF-98AF53133DDF]
xcmetrics_1   | Fatal error: Error raised at top level: NIOPostgres error: connection closed: file Swift/ErrorType.swift, line 200
xcmetrics_1   | Current stack trace:
xcmetrics_1   | 0    libswiftCore.so                    0x00007f48c27cc990 swift_reportError + 50
xcmetrics_1   | 1    libswiftCore.so                    0x00007f48c2840260 _swift_stdlib_reportFatalErrorInFile + 115
xcmetrics_1   | 2    libswiftCore.so                    0x00007f48c2525925 <unavailable> + 1399077
xcmetrics_1   | 3    libswiftCore.so                    0x00007f48c2525567 <unavailable> + 1398119
xcmetrics_1   | 4    libswiftCore.so                    0x00007f48c2525b02 <unavailable> + 1399554
xcmetrics_1   | 5    libswiftCore.so                    0x00007f48c2523fa0 _assertionFailure(_:_:file:line:flags:) + 517
xcmetrics_1   | 6    libswiftCore.so                    0x00007f48c258d6b6 <unavailable> + 1824438
xcmetrics_1   | 7    XCMetricsBackend                   0x000055a23458d3b1 <unavailable> + 15336369
xcmetrics_1   | 8    libc.so.6                          0x00007f48bfae9b10 __libc_start_main + 231
xcmetrics_1   | 9    XCMetricsBackend                   0x000055a2338cb6ea <unavailable> + 1959658
xcmetrics_1   | 0x7f48c19e997f
xcmetrics_1   | 0x7f48c25241b2
xcmetrics_1   | 0x7f48c258d6b5
xcmetrics_1   | 0x55a23458d3b0, main at /build/<compiler-generated>:0
xcmetrics_1   | 0x7f48bfae9bf6
xcmetrics_1   | 0x55a2338cb6e9
xcmetrics_1   | 0xffffffffffffffff
xcmetrics_xcmetrics_1 exited with code 132

Seems a problem with the latest Postgres docker image

Workaround

In order to be able to run XCMetrics locally with docker compose locally, I edited docker-compose-local.yml by replacing: image: postgres with image: postgres:13.4

TheYkk commented 2 years ago

fixed by #60