-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java: Add java/javautilconcurrentscheduledthreadpoolexecutor
query for zero thread pool size
#19844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java: Add java/javautilconcurrentscheduledthreadpoolexecutor
query for zero thread pool size
#19844
Conversation
java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
Fixed
Show fixed
Hide fixed
...uery-tests/ScheduledThreadPoolExecutorZeroThread/ScheduledThreadPoolExecutorZeroThread.qlref
Fixed
Show fixed
Hide fixed
e2b0faa
to
c6a4221
Compare
…for zero thread pool size
c6a4221
to
60e726b
Compare
java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
Show resolved
Hide resolved
java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Michael Nebel <michaelnebel@github.com>
@subatoi Could you check the docs of this query too? I merged it without a docs-review, and looks like adding the tag after merging doesn't put it on your todo list. |
@tamasvajk No worries. It looks fine. Just some trivial feedback but:
Might be better as (one-word change):
|
This pull request introduces a new query to identify potential issues with setting the
corePoolSize
ofScheduledThreadPoolExecutor
to zero, which may lead to unintended behavior and programmer error. The changes include adding the query logic, documentation, test cases, and integration into the query suite.MRVA top 100 only reports 4 alerts. I checked autofix on 3 of these. Two autofix suggestions completely removed the
executor.setCorePoolSize(0)
calls, the third one changed the 0 value toSchedulers.DEFAULT_POOL_SIZE
, which is the value used insetMaximumPoolSize
.