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

KTOR-7729 Add logging for tracking concurrent access in the dev mode #4477

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

e5l
Copy link
Member

@e5l e5l commented Nov 13, 2024

Will help with the investigation of KTOR-7729 Kotlinx-io Check failed from ByteChannel

@e5l e5l requested a review from bjhham November 13, 2024 14:01
@e5l e5l self-assigned this Nov 13, 2024
Copy link
Contributor

@bjhham bjhham left a comment

Choose a reason for hiding this comment

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

Cool 😎

init {
if (DEVELOPMENT_MODE) {
created = Throwable("ReadTask 0x${continuation.hashCode().toString(16)}").also {
it.stackTraceToString()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this also { it.stackTraceToString() } doing anything here?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, by default the stacktrace is not filled


init {
if (DEVELOPMENT_MODE) {
created = Throwable("ReadTask 0x${continuation.hashCode().toString(16)}").also {
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice if we appended some diagnostic info from the coroutine context here too, since sometimes the stacktraces can be hard to follow as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't have it in the init block, let me check what we can do

@e5l e5l merged commit 2bbee41 into main Nov 14, 2024
2 checks passed
@e5l e5l deleted the e5l/concurrent-access-stack branch November 14, 2024 10:22
Comment on lines +272 to +275
public class ConcurrentIOException(
taskName: String,
cause: Throwable? = null
) : IllegalStateException("Concurrent $taskName attempts", cause) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we provide a @Deprecated(HIDDEN) constructor with an old signature for binary compatibility purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, let me add

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.

3 participants