Postgresql Database Job Failure

I am getting the following error while setting up postgres to run my tests. This was working fine till couple of days back and suddenly stopped working.

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2021-06-29 11:10:13.600 UTC [92] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-06-29 11:10:13.642 UTC [93] LOG:  database system was shut down at 2021-06-29 11:10:13 UTC
2021-06-29 11:10:13.647 UTC [92] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2021-06-29 11:10:14.056 UTC [92] LOG:  received fast shutdown request
waiting for server to shut down...2021-06-29 11:10:14.057 UTC [92] LOG:  aborting any active transactions
.2021-06-29 11:10:14.058 UTC [92] LOG:  background worker "logical replication launcher" (PID 99) exited with exit code 1
2021-06-29 11:10:14.058 UTC [94] LOG:  shutting down
2021-06-29 11:10:14.064 UTC [92] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2021-06-29 11:10:14.167 UTC [7] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-06-29 11:10:14.167 UTC [7] LOG:  listening on IPv6 address "::", port 5432
2021-06-29 11:10:14.167 UTC [7] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-06-29 11:10:14.178 UTC [120] LOG:  database system was shut down at 2021-06-29 11:10:14 UTC
2021-06-29 11:10:14.182 UTC [7] LOG:  database system is ready to accept connections
2021-06-29 11:11:15.398 UTC [468] LOG:  incomplete startup packet
2021-06-29 11:12:53.378 UTC [685] LOG:  could not receive data from client: Connection reset by peer
2021-06-29 11:12:53.378 UTC [685] LOG:  unexpected EOF on client connection with an open transaction

My config.yml is the following

# Elixir CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-elixir/ for more details
version: 2
jobs:
  build:
    docker:
      # specify the version here
      - image: circleci/elixir:1.10
        environment:
          MIX_ENV: test
          DB_USER: postgres
          DB_PASSWORD: postgres

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      - image: circleci/postgres:11.11
        environment:
          MIX_ENV: test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: app_test

    working_directory: ~/app
    steps:
      - checkout

    # specify any bash command here prefixed with `run: `
      - run: mix local.hex --force
      - run: mix local.rebar --force

      - restore_cache:  # restores saved mix cache
      # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
          keys:  # list of cache keys, in decreasing specificity
            - v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
            - v1-mix-cache-{{ .Branch }}
            - v1-mix-cache
      - restore_cache:  # restores saved build cache
          keys:
            - v1-build-cache-{{ .Branch }}
            - v1-build-cache
      - run: mix do deps.get, compile  # get updated dependencies & compile them
      - save_cache:  # generate and store mix cache
          key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
          paths: "deps"
      - save_cache: # don't forget to save a *build* cache, too
          key: v1-build-cache-{{ .Branch }}
          paths: "_build"

      - run:  # special utility that stalls main process until DB is ready
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 2m



      - run: mix deps.get
      - run: mix test --cover 

      - store_test_results:  # upload junit test results for display in Test Summary
          # Read more: https://circleci.com/docs/2.0/collect-test-data/
          path: _build/test/lib/app # Replace with the name of your :app

Can someone please tell me what am I doing wrong?

Hi buddy, did you find the answer to this question? or who fumbles how to make postgres not terminate after its creation, please give an answer

Yes, I did. Thank you.

What was the fix?

Can you please share the solution.

I do not recall the solution. Looking back I should have added the solution here. I checked this config with the current config and the only difference is POSTGRES_DB value. Not sure what if that solved it though.