Skip to content

chore(core): Update netty lib, remove pgjdbc-ng and PostgresPubSubImpl (#37592) - #37593

Merged
wezell merged 3 commits into
mainfrom
issue-37592-remove-pgjdbc-ng
Sep 17, 2026
Merged

wezell merged 3 commits into
mainfrom
issue-37592-remove-pgjdbc-ng

Conversation

@wezell

@wezell wezell commented Sep 17, 2026

Copy link
Copy Markdown
Member

Proposed Changes

  • Delete PostgresPubSubImpl and PgNgDataSourceUrl — dead code superseded by JDBCPubSubImpl (vanilla postgres driver, PubSubListener with vanilla postgres #26019). DotPubSubProviderLocator has defaulted to JDBCPubSubImpl since, and nothing in the repo sets DOT_PUBSUB_PROVIDER_OVERRIDE to PostgresPubSubImpl.
  • Delete their tests and deregister PostgresPubSubImplTest from MainSuite2a / MainSuite2b (a stale entry there would compile but fail the suite).
  • Drop the com.impossibl.pgjdbc-ng:pgjdbc-ng dependency from dotCMS/pom.xml and its version from bom/application/pom.xml.
  • Replace the codebase's only Netty import — io.netty.util.NetUtil.createByteArrayFromIpAddressString() in HttpRequestDataUtil#getIpAddress — with Guava InetAddresses.forString(). Guava is already a direct compile dependency. throws UnknownHostException is preserved because 6 call sites catch it.
  • Make DOT_PUBSUB_PROVIDER_OVERRIDE fail soft: an override that cannot be loaded or constructed now logs a warning and falls back to JDBCPubSubImpl instead of throwing DotRuntimeException at startup.
  • Replace the six piecemeal Netty pins with an io.netty:netty-bom import, and bump 4.1.118.Final → 4.1.138.Final (latest 4.1.x).

Checklist

  • Tests
  • Translations
  • Security Implications Contemplated (add notes if applicable)

Additional Info

Closes #37592. Follow-up to the pgjdbc-ng discussion on #37588.

Why: pgjdbc-ng was the only remaining compile-scope, non-Azure/non-AWS source of Netty, transitively bringing 4.1.63 while langchain4j-azure-open-ai brought 4.1.118. That conflict is what the six Netty BOM pins existed to paper over.

Removing PostgresPubSubImpl is no longer a breaking change. Deployments that had pointed DOT_PUBSUB_PROVIDER_OVERRIDE at it now degrade to JDBCPubSubImpl with a warning instead of failing to start. The fallback covers:

Failure Handled
class missing / no longer on the classpath
no no-arg constructor
constructor throws
class does not implement DotPubSubProvider
the fallback target is itself unusable rethrows — nothing left to fall back to

Also replaced the deprecated Class.newInstance() with getDeclaredConstructor().newInstance(), and documented the behaviour in dotmarketing-config.properties.

Netty version bump

The six individual pins only covered netty-common/-buffer/-transport/-resolver/-codec/-handler, so the rest of the tree still resolved to whatever each consumer asked for:

Module Before After
netty-commonnetty-handler 4.1.118 4.1.138
netty-resolver-dns (reactor-netty) 4.1.112 4.1.138
netty-codec-http2 (azure) 4.1.132 4.1.138
netty-transport-classes-epoll (awssdk) 4.1.130 4.1.138
netty-tcnative-boringssl-static 2.0.70 2.0.84

Importing netty-bom manages all 60 Netty artifacts at one version, which removes that skew — mixed Netty modules on a single classpath fail at runtime with NoSuchMethodError. Side effect: tcnative follows the BOM to 2.0.84.Final.

CVEs addressed

The bump resolves all six Netty findings from the security scan. Every one is fixed in a version below where we now land (all Netty artifacts are 4.1.138.Final):

CVE Artifact Scan severity NVD severity Fixed in Covered by 4.1.138
CVE-2026-42579 netty-codec-dns Critical Critical 4.1.133
CVE-2026-47691 netty-resolver-dns Critical Critical 4.1.135
CVE-2026-45674 netty-resolver-dns Critical High 4.1.135
CVE-2026-42584 netty-codec-http Critical High 4.1.133
CVE-2026-42581 netty-codec-http Critical Medium 4.1.133
CVE-2026-50010 netty-handler High High 4.1.135

Fixed versions checked against the NVD API (services.nvd.nist.gov/rest/json/cves/2.0). Two entries disagree on severity with the scan output; recorded rather than reconciled.

Worth stressing: before this bump the tree was not merely 4.1.118. The artifacts the six hand-written pins did not cover resolved to 4.1.112 (netty-resolver-dns), 4.1.130 (netty-transport-classes-epoll) and 4.1.132 (netty-codec-http2) — all below the fix thresholds. Importing netty-bom is what makes the remediation complete: bumping the six pins alone would have left netty-resolver-dns at 4.1.112, still exposed to CVE-2026-47691 and CVE-2026-45674.

CI status — all green

Every check passes, including MainSuite 1a/1b/2a/2b/3a, all Postman splits, JVM unit tests, CLI/E2E/Karate, the AI review and the rollback-safety checks.

The first run reported failures in MainSuite 1a/1b/2a/2b/3a, Postman Default Split and Postman Category Content. Those were flaky, not from this change: unrelated open PRs #37591 and #37589 were failing the identical suites on the same runners at the same time (#37589 failed MainSuite 2a too), and simply re-running the failed jobs cleared every one of them. Observed causes were environmental — StoryBlockMapTest NPEs on a null HttpSession in the Velocity toolbox, and Task240306MigrateLegacyLanguageVariablesTest / ExperimentAPIImpIntegrationTest timing out at ~65s. The logs also show dotpubsub.JDBCPubSubImpl - Starting to listen for Postgres notifications running normally under this PR.

Verification

  • dependency:tree → every io.netty artifact resolves to 4.1.138.Final (16 modules), tcnative to 2.0.84.Final; pgjdbc-ng count 0
  • test -pl :dotcms-core -Dtest=DotPubSubProviderLocatorTest,HttpRequestDataUtilTest,CacheTransportTopicTestTests run: 17, Failures: 0, Errors: 0
  • test-compile -pl :dotcms-core → BUILD SUCCESS
  • test-compile -pl :dotcms-integration → BUILD SUCCESS, 0 errors, MainSuite2a/MainSuite2b compiled
  • Zero residual references to com.impossibl.*, PostgresPubSubImpl, PgNgDataSourceUrl, or io.netty.util

⚠️ The version bump is the least-proven part of this PR. Compilation and unit tests do not exercise the Azure/Vertex/AWS SDK HTTP paths that actually use Netty at runtime, nor BoringSSL native loading under the new tcnative. A run against a real Azure OpenAI (or SQS) integration is worth doing before merge. It stays in this PR as its own commit (b6a18e74b1) so it can be reverted independently if it needs backing out.

Netty does not fully disappear — it stays on the classpath via azure-core-http-netty (langchain4j) and netty-nio-client (AWS SDK SQS).

Behavioral notes

  • getIpAddress previously returned loopback (127.0.0.1) when the remote address was unparseable; that fallback is unchanged. Guava's parser accepts IPv4, IPv6 and scoped IPv6 (fe80::1%eth0), verified directly against guava-32.0.1-jre.
  • POSTGRES_PUBSUB_JDBC_URL and the jdbc:pgsql:// URL scheme become unused after this change.

Screenshots

N/A — backend/dependency change.

This PR fixes: #37592

PostgresPubSubImpl was superseded by JDBCPubSubImpl (vanilla postgres
driver, #26019) and DotPubSubProviderLocator has defaulted to it since.
Nothing in the repo sets DOT_PUBSUB_PROVIDER_OVERRIDE to
PostgresPubSubImpl, so the pgjdbc-ng code path was unreachable.

pgjdbc-ng was the only remaining compile-scope, non-Azure/non-AWS source
of Netty on the classpath, transitively bringing Netty 4.1.63 while
langchain4j-azure-open-ai brought 4.1.118.

Changes:
- Delete PostgresPubSubImpl, PgNgDataSourceUrl and their tests
- Deregister PostgresPubSubImplTest from MainSuite2a/MainSuite2b
- Drop the pgjdbc-ng dependency from dotCMS/pom.xml and bom/application
- Replace the codebase's only Netty import (io.netty.util.NetUtil in
  HttpRequestDataUtil#getIpAddress) with Guava InetAddresses.forString;
  Guava is already a direct compile dependency. The `throws
  UnknownHostException` signature is preserved because callers catch it.
- Keep the six Netty BOM pins; Azure/reactor-netty still ship 4.1.112
  vs 4.1.118 skew, and AWS still pulls 4.1.130. Update the stale comment.

Netty remains on the classpath via azure-core-http-netty and the AWS SDK
sqs netty-nio-client; only the 4.1.63 line disappears.
@github-actions github-actions Bot added the Area : Backend PR changes Java/Maven backend code label Sep 17, 2026
@claude

claude Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Claude finished @wezell's task in 1m 34s —— View job


Code Review

Reviewed the full diff against origin/main. This is a clean dead-code removal + dependency consolidation. I traced the two behavioral changes carefully:

DotPubSubProviderLocator.resolveProvider — fallback logic is correct. Try.of catches Throwable (vavr), so it covers NoClassDefFoundError/ClassNotFoundException (class off classpath), NoSuchMethodException (no no-arg ctor), the wrapped constructor exception, and ClassCastException (not a DotPubSubProvider). The defaultClazz.equals(pubsubClazz) guard correctly rethrows when the default is itself the unusable target — no infinite/no-op fallback. Test matrix covers all five paths plus the rethrow.

HttpRequestDataUtil.getIpAddressInetAddresses.forString() is a pure parse (no DNS), matching the old NetUtil behavior; both return an unresolved-host InetAddress. The empty/null/unparseable → loopback fallback is preserved, and throws UnknownHostException is retained for the 6 catching call sites. IllegalArgumentException is the correct Guava exception to catch here.

Verified:

  • Zero residual references to PostgresPubSubImpl, PgNgDataSourceUrl, com.impossibl.*, io.netty.util, POSTGRES_PUBSUB_JDBC_URL, jdbc:pgsql anywhere in the repo.
  • Both the import and the @SuiteClasses entry removed in MainSuite2b; MainSuite2a only had a stale (unused) import, so import-only removal there is correct.
  • netty-bom import replaces the six per-artifact pins with ${netty.version} = 4.1.138.Final, consistent with commit b6a18e74. BOM import is the right mechanism to force a single Netty version across the transitive trees (azure/aws/reactor).
  • Dependency declaration in dotCMS/pom.xml and version in bom/application/pom.xml both removed — follows the repo's version-management rule.

New Issues

No issues found.


  • Gather PR diff and context
  • Review DotPubSubProviderLocator fallback logic
  • Review HttpRequestDataUtil Netty→Guava swap
  • Review pom/dependency changes
  • Review test changes
  • Post review

Note: the ❌ Linked Issue Needs Team Label check is unrelated to code — issue #37592 just needs a Team : * label applied.
· issue-37592-remove-pgjdbc-ng

…ble (#37592)

DOT_PUBSUB_PROVIDER_OVERRIDE previously threw DotRuntimeException when the
named class could not be loaded or constructed, so a stale override
(e.g. pointing at a class from a dependency that is no longer shipped)
prevented the node from starting.

Now the locator logs a warning and falls back to JDBCPubSubImpl. The
fallback covers a missing class, no no-arg constructor, a constructor
that throws, and a class that does not implement DotPubSubProvider. If
the fallback target is itself unusable the exception is rethrown, since
there is nothing left to fall back to.

Also replaces the deprecated Class.newInstance() with
getDeclaredConstructor().newInstance(), and documents the fallback in
dotmarketing-config.properties.

Adds DotPubSubProviderLocatorTest (6 cases) covering each fallback path.
The six individual Netty pins only covered netty-common, netty-buffer,
netty-transport, netty-resolver, netty-codec and netty-handler, so the
rest of the tree still resolved to whatever each consumer asked for:
reactor-netty brought netty-resolver-dns 4.1.112, azure-core-http-netty
brought netty-codec-http2 4.1.132 and the awssdk netty-nio-client
brought netty-transport-classes-epoll 4.1.130. Mixed Netty modules on
one classpath fail at runtime with NoSuchMethodError.

Replaces the six pins with an import of io.netty:netty-bom, which manages
all 60 Netty artifacts - including the native transports, resolver-dns
and tcnative - at a single version. Bumps 4.1.118.Final to the latest
4.1.x, 4.1.138.Final.

Side effect: netty-tcnative-boringssl-static moves 2.0.70.Final ->
2.0.84.Final, the version netty-bom 4.1.138 pairs with.

Verified via dependency:tree that every io.netty artifact now resolves to
4.1.138.Final and tcnative to 2.0.84.Final; dotcms-core compiles and its
unit tests pass.
@wezell wezell changed the title chore(core): remove pgjdbc-ng and PostgresPubSubImpl (#37592) chore(core): Update netty lib, remove pgjdbc-ng and PostgresPubSubImpl (#37592) Sep 17, 2026
@wezell
wezell requested a review from nollymar September 17, 2026 12:46
@wezell wezell added the PR : dotbot review Trigger dotbot AI code review on this PR label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

dotbot code review:

  • Reviewer: meta/muse-spark-1.3 (medium)
  • Overall: patch is correct
  • New findings this run: 0
  • Prior unresolved dotbot findings still relevant: 0
  • Active findings total: 0

Removal of pgjdbc-ng/PostgresPubSubImpl is complete with no residual references, Netty BOM alignment covers all modules, Guava IP parsing preserves loopback fallback with no DNS, and soft-fallback to JDBCPubSubImpl is intentional, logged and tested.

Tip: comment with "/dotbot address comments" to attempt automated fixes for unresolved review threads.

reviewed by dotbot · meta/muse-spark-1.3 · medium

@github-actions

Copy link
Copy Markdown
Contributor

dotbot code review:

  • Reviewer: ~z-ai/glm-latest (medium)
  • Overall: patch is correct
  • New findings this run: 0
  • Prior unresolved dotbot findings still relevant: 0
  • Active findings total: 0

The removal is complete: no residual references to pgjdbc-ng, PostgresPubSubImpl, PgNgDataSourceUrl, or NetUtil remain in build files or source. The new resolveProvider fallback logic is correct (it rethrows when the default provider itself fails, and tests cover all paths), the Guava InetAddresses swap preserves IP-literal parsing and the loopback fallback, and the Netty BOM import is a valid consolidation. Test suites were updated consistently.

Tip: comment with "/dotbot address comments" to attempt automated fixes for unresolved review threads.

reviewed by dotbot · ~z-ai/glm-latest · medium

@dotCMS-Machine-User dotCMS-Machine-User left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ dotbot review: all reviewer models (meta/muse-spark-1.3, ~z-ai/glm-latest) agree — patch is correct.

approved automatically by dotbot

@wezell
wezell added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit c5a3c54 Sep 17, 2026
97 of 116 checks passed
@wezell
wezell deleted the issue-37592-remove-pgjdbc-ng branch September 17, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code PR : dotbot review Trigger dotbot AI code review on this PR

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Remove pgjdbc-ng and PostgresPubSubImpl (superseded by JDBCPubSubImpl)

3 participants