Skip to content
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

Fixes #11282 - Deadlocks with DEBUG logging enabled in jetty-server testing. #11306

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Jan 23, 2024

Introduced AutoLock.tryLock() to use it in the toString() implementations that lock in order to retrieve a consistent state to produce the string.

…esting.

Introduced AutoLock.tryLock() to use it in the toString() implementations that lock in order to retrieve a consistent state to produce the string.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from joakime, gregw and lorban January 23, 2024 21:05
@sbordet sbordet linked an issue Jan 23, 2024 that may be closed by this pull request
@lorban
Copy link
Contributor

lorban commented Jan 24, 2024

The PR build failed with a timeout in the forked process. We need to investigate to figure out if this was a fluke or if this change introduces a bug we've overlooked.

@joakime
Copy link
Contributor

joakime commented Jan 24, 2024

Comment on lines +51 to +59
* <p>Tries to acquire the lock.</p>
* <p>Whether the lock was acquired can be tested
* with {@link #isHeldByCurrentThread()}.</p>
* <p>Typical usage of this method is in {@code toString()},
* to avoid deadlocks when the implementation needs to lock
* to retrieve a consistent state to produce the string.</p>
*
* @return this AutoLock for unlocking
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* <p>Tries to acquire the lock.</p>
* <p>Whether the lock was acquired can be tested
* with {@link #isHeldByCurrentThread()}.</p>
* <p>Typical usage of this method is in {@code toString()},
* to avoid deadlocks when the implementation needs to lock
* to retrieve a consistent state to produce the string.</p>
*
* @return this AutoLock for unlocking
*/
* <p>Tries to acquire the lock.</p>
* <p>Whether the lock was acquired can be tested
* with {@link #isHeldByCurrentThread()}.</p>
* <p>Typical usage of this method is in {@code toString()},
* to avoid deadlocks when the implementation needs to lock
* to retrieve a consistent state to produce the string.</p>
* @see ReentrantLock#isHeldByCurrentThread()
* @return this AutoLock for unlocking
*/

@joakime joakime merged commit ef75595 into jetty-12.0.x Jan 25, 2024
8 checks passed
@joakime joakime deleted the fix/jetty-12/11282/debug-deadlock branch January 25, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Deadlocks with DEBUG logging enabled in jetty-server testing
4 participants