Skip to content

Bump commons-pool2 to 2.13.1 - #605

Open
tonygermano wants to merge 2 commits into
OpenIntegrationEngine:mainfrom
tonygermano:build/commons-pool2-2.13
Open

tonygermano wants to merge 2 commits into
OpenIntegrationEngine:mainfrom
tonygermano:build/commons-pool2-2.13

Conversation

@tonygermano

@tonygermano tonygermano commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

This is the commons-pool2 bump that was split out of #545. On 2.13, a File Writer that doesn't keep connections open would open an extra connection after every message, so the bump comes with a File connector fix.

The regression

Since 2.13.0, GenericObjectPool.invalidateObject always tries to add a replacement object to the pool (POOL-424). In 2.3 it created one only when a thread was waiting to borrow.

FileDispatcher calls FileConnector.destroyConnection, and through it invalidateObject, after every message when "Keep connection open" is off. The UI default is on. On 2.13 that would open another FTP, SFTP, SMB, WebDAV or S3 connection that nothing uses, until the evictor closes it about a second later.

If opening that connection failed, for example while the server is down, invalidateObject threw before FileConnector dropped the destroyed connection from its set of open connections, so a later halt would call disconnect() on it again. FileDispatcher ignores the exception.

The fix

  • When a File Writer doesn't keep connections open, its pool has maxIdle 0, and destroyConnection calls returnObject instead of invalidateObject. With no idle capacity, returnObject destroys the connection and creates a replacement only for a thread waiting to borrow, which is what invalidateObject did in 2.3.
  • maxIdle 0 with invalidateObject alone isn't enough: since 2.13.0, addObject respects maxIdle (POOL-425), so a waiting thread would never get a connection.
  • Connections aren't validated on return in this mode, since they are destroyed anyway. Without this, "Validate connection" would cost an extra FTP NOOP or SFTP cd per message. Validation on borrow is unchanged.
  • File Readers, and File Writers that keep connections open, still use invalidateObject. Giving reader pools maxIdle 0 would make them reconnect on every release within a poll.
  • destroyConnection drops the connection from the open set in a finally block, so a failure in the pool can't leave it behind.
  • The eviction settings use the Duration setters, since 2.13.1 deprecates the ...Millis ones.

Writers that use the FILE scheme, including network shares mounted into the local filesystem, aren't affected either way: a FileConnection holds no network connection.

Tests

The first commit adds FileConnectorConnectionPoolTest, which passes on 2.3:

  • destroying a connection doesn't open another one
  • a connection whose destroy fails while creating a replacement is still dropped from the open connections
  • getConnection replaces a connection that is no longer connected, and tracks only the replacement as open

The first two fail on 2.13.1 without the fix, so they guard the upgrade.

Other changes in 2.4 to 2.13.1

From the changelogs of every release between 2.3 and 2.13.1, nothing else changes how we use pool2 in FileConnector or KeyEncryptor. No APIs we use were removed, there are no new runtime dependencies, and the minimum Java version is 8.

Verification metadata

The metadata drops commons-pool2 2.3 and its parent POM, commons-parent 34, which nothing else uses, and adds 2.13.1. Its parent, commons-parent 93, is already listed. The commons-pool2 2.13.0 entry stays: the dependency-check Gradle plugin uses it through commons-dbcp2.

Claude checked:

  • ./gradlew clean build passes (941 tests)
  • the new tests pass on 2.3, and the first two fail on 2.13.1 without the fix
  • the replacement test fails if getConnection's fallback for a disconnected connection is removed
  • the 2.13.1 jar and POM hashes match Maven Central
  • a Docker run with an SFTP File Writer ("Keep connection open" off, "Validate connection" on) logged 10 SFTP logins for 10 messages; the same run with 2.13.1 and without the FileConnector change logged 20

Release notes

The bundled Apache Commons Pool library (commons-pool2) is updated from 2.3 to 2.13.1.

File Writer connection handling is unchanged. Plugins that use commons-pool2 should check the commons-pool2 changes: for example, GenericObjectPool.invalidateObject now always tries to create a replacement object (POOL-424), and several ...Millis configuration methods are deprecated in favor of Duration versions.


🤖 Drafted with Claude Code

Cover how FileConnector uses its connection pool when a File Writer
does not keep connections open:

- destroying a connection does not open another one
- a connection whose destroy fails while creating a replacement is
  still dropped from the connector's open connections, so disconnect()
  does not reach it again
- a pooled connection that is no longer connected is destroyed and
  replaced by getConnection, and only the replacement is tracked as
  open

The tests pass with commons-pool2 2.3. The first two fail with 2.13.1,
where invalidateObject always tries to add a replacement object to the
pool (POOL-424), so they guard the upgrade.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Tony Germano <tony@germano.name>
Since 2.13.0, GenericObjectPool.invalidateObject always tries to add
a replacement object to the pool (POOL-424). In 2.3 it created one
only when a thread was waiting to borrow. A File Writer that does not
keep connections open destroys its connection with invalidateObject
after every message, so on 2.13 it would open another FTP, SFTP, SMB,
WebDAV or S3 connection that nothing uses, until the evictor closes
it. If opening that connection failed, invalidateObject threw before
FileConnector dropped the destroyed connection from its open
connections, so a later disconnect() reached it again.

When a File Writer does not keep connections open, its pool now has
maxIdle 0, and destroyConnection returns the connection instead of
invalidating it. returnObject destroys a connection the pool has no
idle capacity for, and creates a replacement only for a waiting
thread, which is what invalidateObject did in 2.3. maxIdle 0 with
invalidateObject alone would leave waiting threads blocked, because
addObject respects maxIdle since 2.13.0 (POOL-425). Connections are
not validated on return in this mode, since they are destroyed
anyway; validation on borrow is unchanged. File Readers and writers
that keep connections open still use invalidateObject. The open
connection is now dropped in a finally block, so a failure in the
pool can't leave it behind.

Use the Duration setters for the eviction settings, since 2.13.1
deprecates setTimeBetweenEvictionRunsMillis and
setMinEvictableIdleTimeMillis. A zero interval still disables the
evictor.

The verification metadata drops commons-pool2 2.3 and its parent POM,
commons-parent 34, which nothing else uses. The 2.13.1 parent,
commons-parent 93, is already listed.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Tony Germano <tony@germano.name>
@tonygermano
tonygermano requested a review from a team November 26, 2026 13:35
@tonygermano tonygermano added the dependencies Dependency updates label Nov 26, 2026
@tonygermano tonygermano added the java Java / Gradle dependencies label Nov 26, 2026
@tonygermano
tonygermano marked this pull request as draft November 26, 2026 13:58
@tonygermano
tonygermano force-pushed the build/commons-pool2-2.13 branch from bbdf29e to a765d68 Compare November 26, 2026 14:07
@github-actions

Copy link
Copy Markdown

Test Results

  148 files  +1    148 suites  +1   4m 28s ⏱️ +36s
  999 tests +3    999 ✅ +3  0 💤 ±0  0 ❌ ±0 
1 317 runs  +3  1 311 ✅ +3  6 💤 ±0  0 ❌ ±0 

Results for commit a765d68. ± Comparison against base commit da38caf.

@tonygermano
tonygermano marked this pull request as ready for review November 26, 2026 14:24
tonygermano added a commit to tonygermano/engine that referenced this pull request Nov 26, 2026
Nothing runs the plugin: no workflow, task or document invokes
dependencyCheckAggregate. Gradle still resolves its classpath on every
invocation: 93 artifacts (Lucene, H2, Jackson 2.21, Guava 33,
httpclient5, ...) that exist only for it, and that make up the first
fetch in Renovate's artifact step, where the Maven Central 429 failures
occur. Removing it cuts the downloads per run; it does not eliminate the
rate-limit risk.

Remove the plugin, its configuration block, its catalog entry (and the
now-empty [plugins] table) and the report-file ignore patterns.

What is lost: dependency-check was the only scan covering the vendored
jars without Maven coordinates. Renovate's OSV alerts only cover catalog
entries. A replacement scanner is a separate follow-up.

Verification metadata: --write-verification-metadata only merges into
an existing file and never prunes, so the set the build needs was found
by deleting the file and regenerating it with a cold cache and CI's
flags. The committed file is main's file minus the 115 entries nothing
needs: the plugin's classpath and its parent POMs and BOMs. Two
unneeded entries stay to avoid a conflict with the adjacent hunks of the
commons-pool2 bump in OpenIntegrationEngine#605: commons-pool2 2.13.0 and
org.apache.commons:commons-parent:33 (stale since a178dfb). 21
entries the plugin brought in stay because the mybatis 3.5.19 and
HikariCP 7.1.0 parent chains now import them; without them a cold build
fails verification on 🫏runtimeClasspath. The regeneration also
wanted to add 19 transitives of 🫏testFixturesRuntimeClasspath,
which the non-transitive list does not cover; they appear on untouched
main too and a normal build does not resolve them, so they are left for
a separate fix.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Tony Germano <tony@germano.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency updates java Java / Gradle dependencies

1 participant