Skip to content

Conversation

@keith-turner
Copy link
Contributor

ScheduledThreadPoolExecutor.execute() will silently eat uncaught exceptions. This change makes calls to that method fail in order to prevents its use in Accumulo.

This impl code in java returns a future that is dropped on the floor. That future object will catch any uncaught exceptions. The javadoc for the method states Instead, the {@code Throwable} thrown by such a task can be obtained via {@link Future#get}. however that future is inaccessible so not sure how it expects that do be done.

ScheduledThreadPoolExecutor.execute() will silently eat uncaught
exceptions.  This change makes calls to that method fail in order
to prevents its use in Accumulo.
@keith-turner
Copy link
Contributor Author

Created this method as a draft because I need to determine if this execute method is actually called in the 2.1 code. I ran mvn verify -Psunny and that passed. Need to exclude calls to ThreadPoolExecutor.execute when searching because that is ok, trying to figure out how to do that.

If I can not determine if this is called in the 2.1 code, then may change this to warn in 2.1 and then fail in 4.0.

@keith-turner keith-turner added this to the 2.1.5 milestone Jan 20, 2026
@keith-turner
Copy link
Contributor Author

This was found while looking into apache/accumulo-classloaders#50

@keith-turner keith-turner changed the title Errors on ScheduledThreadPoolExecutor.execute() call Workaround flaw in ScheduledThreadPoolExecutor.execute() Jan 21, 2026
@keith-turner
Copy link
Contributor Author

In 714062e worked around the flaw in the Java code instead of trying to avoid it. Also added a test to ensure the execute(Runnable) methods on threadpools do push uncaught exceptions to the handler. This new test would fail w/o the workaround changes. Taking this out of draf w/ the change in behavior. Did find some code in ConditionalWriter that is calling execute() on a scheduled executor, but not sure if its all.

@keith-turner keith-turner marked this pull request as ready for review January 21, 2026 03:49
Copy link
Contributor

@dlmarion dlmarion left a comment

Choose a reason for hiding this comment

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

LGTM

@keith-turner keith-turner merged commit aeddc58 into apache:2.1 Jan 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants