Subject: [pgjdbc/pgjdbc] PR #3728: fix: ensure extended protocol messages end with Sync message

From: "vlsi (@vlsi)" <[email-masked]>
Date: Thu, 17 Jul 2025 13:28:35 +0000

Fixes https://github.com/pgjdbc/pgjdbc/issues/3107

TODO:
- [ ] Add test to reproduce the failure

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Sat, 19 Jul 2025 16:15:52 +0000

@papegaaij, do you think you could try this change with pgpool2?
Frankly, I do not see a clear way of testing the change without pgpool2, and it looks like adding pgpool2 to the tests would take some time.

---

From: "papegaaij (@papegaaij)" <[email-masked]>
Date: Sun, 20 Jul 2025 05:21:23 +0000

Thanks for the work on this issue! I'm currently on vacation, but I'll ask a colleague to test this. Keep in mind though that we were only able to reproduce the original issue consistently in production. On our testing environment we will need to run with the patched version for several weeks before we can say with any certainty the problem is fixed.

---

From: "haster (@haster)" <[email-masked]>
Date: Wed, 23 Jul 2025 07:32:29 +0000

I've built pgjdbc based on this pull request and deployed it to our test environment. As @papegaaij said, due to the low amount of traffic on that environment we would need to run with this for a couple of weeks to be able to say the problem is fixed with any certainty, but testing is underway :muscle:

---

From: "haster (@haster)" <[email-masked]>
Date: Mon, 04 Aug 2025 11:25:34 +0000

Hey, due to an error on my end we unfortunately ran with the incorrect driver for our first week of testing, but the 'good' news is that I quickly noticed that while checking the logs. After fixing that last tuesday we now run with the correct (patched) driver and I haven't seen this error reoccur so far.

We still need to wait longer to be more sure, since it is a testing environment with nowhere near production-like usage patterns, but things are looking good on our end.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Mon, 04 Aug 2025 11:29:51 +0000

@haster , thanks so much for testing this, and it is really painful for me to test in prod what could be tested in CI. One of the options that might be useful is to configure pgpool2 and make tests work through pgool2 -> test database.

Frankly speaking, I have previously tried adding pgpool2 to our [docker-compose.yml](https://github.com/pgjdbc/pgjdbc/blob/9370b33fcce0f5605ccad500e7de9f4bf939e085/docker/postgres-server/docker-compose.yml), however, it was harder than I thought it would be. Do you think you could help with adding pgpool2 to `docker-compose.yml`? I expect it might be fine to use it for a subset of the tests only, however, it would be nice to add those types of tests as well.

---

From: "haster (@haster)" <[email-masked]>
Date: Mon, 11 Aug 2025 11:36:58 +0000

Hey @vlsi , we now have two weeks of testing this PR on our testing environment. So far we haven't seen the error again. As far as we are concerned this PR solves the issue :+1: Thanks for your hard work.

---

From: "haster (@haster)" <[email-masked]>
Date: Mon, 11 Aug 2025 11:44:52 +0000

As to your question about pgpool in the docker compose, we build our own postgres and pgpool so I'm not sure how our experience translates to your situation.

Our docker-compose.yml looks something like the following:

```yaml
services:
  db:
    container_name: "db"
    image: ...
    env_file: db.env
    
    networks:
      network:
        ipv4_address: << db_ip >>
    read_only: True
    tmpfs:
      - /run:rw,noexec,nosuid,size=64k
    volumes:
      - /data/db:/var/lib/postgresql/data
      - /var/log/db:/var/log/postgresql

  tkh-pgpool:
    container_name: "pgpool"
    image: ...
    depends_on:
      - db
    env_file: db.env

    networks:
      network:
        ipv4_address: << pgpool_ip  >>
    read_only: True
    tmpfs:
      - /run/postgresql:rw,noexec,nosuid,size=64k,uid=208,gid=208
      - /tmp:rw,noexec,nosuid,size=64k
    volumes:
      - /data/pgpool:/etc/pgpool2:ro
```

The db.env file holds nothing special, postgres user credentials and such.

---

From: "haster (@haster)" <[email-masked]>
Date: Thu, 21 Aug 2025 14:26:08 +0000

I just checked again and haven't found any errors since the last time I checked, so it seem to really be gone. :+1: 

We'll be using the patched version in production soon. Hopefully the next official version of the driver will include this patch so we can switch back again :)

---

From: "bathinamahesh (@bathinamahesh)" <[email-masked]>
Date: Wed, 03 Dec 2025 06:27:58 +0000

Hey @vlsi @haster , thanks again for all the work on this fix. Since we're integrating pgpool2 into our product, this patch is important for us. Do you happen to know when this might be merged or included in an official pgjdbc release? We really appreciate your efforts.

---

From: "papegaaij (@papegaaij)" <[email-masked]>
Date: Thu, 19 Feb 2026 09:22:23 +0000

@vlsi can you give an update on this branch? We've been running a custom patched version of pgjdbc with this change for months now, with no issues.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Thu, 19 Feb 2026 10:00:01 +0000

Apparently I missed merging the branch, and I missed adding a test (add pgpool2 and run the tests through pgpool2 somehow).

@davecramer , WDYT of merging this without adding a test?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 19 Feb 2026 11:25:46 +0000

@vlsi fine by me

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 24 Feb 2026 11:58:04 +0000

@vlsi I guess we should merge this. I'm a little concerned about what it might break though. 
Should we release this under a major revision change ?

---

From: "sazonov (@sazonov)" <[email-masked]>
Date: Tue, 10 Mar 2026 07:16:13 +0000

Hello. Are there any updates on this? :)