pipeline fail after implementing hikari connection pooling
Asked by Asmaa Ammar:

We've recently implemented hikari connection pooling to manage database connections, the tests are passing locally but in the pipeline, it is failing with error message:   
unexpected EOF on client connection with an open transaction

PostgreSQL init process complete; ready for start up.  
49  
50
2023-10-18 04:22:03.143 UTC [1] LOG: starting PostgreSQL 16.0 (Debian 16.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit  
51
2023-10-18 04:22:03.143 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432  
52
2023-10-18 04:22:03.143 UTC [1] LOG: listening on IPv6 address "::", port 5432  
53
2023-10-18 04:22:03.144 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
54
2023-10-18 04:22:03.147 UTC [62] LOG: database system was shut down at 2023-10-18 04:22:03 UTC  
55
2023-10-18 04:22:03.152 UTC [1] LOG: database system is ready to accept connections  
56
2023-10-18 04:27:03.246 UTC [60] LOG: checkpoint starting: time  
57
2023-10-18 04:27:07.625 UTC [60] LOG: checkpoint complete: wrote 44 buffers (0.3%); 0 WAL file(s) added, 0 removed, 0 recycled; write=4.115 s, sync=0.123 s, total=4.380 s; sync files=11, longest=0.123 s, average=0.012 s; distance=260 kB, estimate=260 kB; lsn=0/152BEA0, redo lsn=0/152BE68  
58
2023-10-18 04:28:55.452 UTC [85] ERROR: relation "public.databasechangeloglock" does not exist at character 22  
59
2023-10-18 04:28:55.452 UTC [85] STATEMENT: SELECT COUNT(*) FROM public.databasechangeloglock  
60
2023-10-18 04:28:55.452 UTC [86] ERROR: relation "public.databasechangeloglock" does not exist at character 22  
61
2023-10-18 04:28:55.452 UTC [86] STATEMENT: SELECT COUNT(*) FROM public.databasechangeloglock  
62
2023-10-18 04:28:55.452 UTC [83] ERROR: relation "public.databasechangeloglock" does not exist at character 22  
63
2023-10-18 04:28:55.452 UTC [83] STATEMENT: SELECT COUNT(*) FROM public.databasechangeloglock  
64
2023-10-18 04:28:55.452 UTC [84] ERROR: relation "public.databasechangeloglock" does not exist at character 22  
65
2023-10-18 04:28:55.452 UTC [84] STATEMENT: SELECT COUNT(*) FROM public.databasechangeloglock  
66
2023-10-18 04:28:55.860 UTC [60] LOG: checkpoint starting: immediate force wait  
67
2023-10-18 04:28:55.880 UTC [60] LOG: checkpoint complete: wrote 932 buffers (5.7%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.017 s, sync=0.003 s, total=0.021 s; sync files=302, longest=0.001 s, average=0.001 s; distance=17101 kB, estimate=17101 kB; lsn=0/25DF500, redo lsn=0/25DF4C0  
68
2023-10-18 04:28:55.982 UTC [85] LOG: unexpected EOF on client connection with an open transaction


Answers:
author: Asmaa Ammar
body: Dear Theodora,

Thank you so much for your response and explanation. It turned out to be memory allocation issue in the pipeline. Reducing docker memory to 512MB solved my issue.


author: Theodora Boudale
body: Hi Asmaa,

Just to give you some context, Pipelines builds that run on Atlassian infrastructure use Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. If you use a service for a step, then a second Docker container will start for the service which will share a network adapter with your build container. The repo is cloned in the build container, and then the commands of the step's script are executed. When the step finishes the Docker containers get destroyed.

The first error in the log you shared is the following:

```
2023-10-18 04:28:55.452 UTC [85] ERROR: relation "public.databasechangeloglock" does not exist at character 22
59
2023-10-18 04:28:55.452 UTC [85] STATEMENT: SELECT COUNT(*) FROM public.databasechangeloglock
```

The error indicates that the table **public.databasechangeloglock** doesn't exist in the database. Pipelines doesn't create any tables, you will need to populate the pipelines database with your tables and schema.

I would suggest checking your code to see if the table **public.databasechangeloglock** is created before the SELECT statement with this table runs.

You can also try debugging this build locally with Docker. You can use the following guide (please ensure that you use the same Docker image you have in your yml file for the build container and any service containers):

* <https://confluence.atlassian.com/bbkb/debug-pipelines-locally-with-docker-1167698072.html>

There is a section on this guide titled "Testing with build services" that you can use if your step has services.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud