Skip to content

[#14044] Strengthen coroutine lifecycle regression#14047

Open
cj848 wants to merge 1 commit into
pinpoint-apm:masterfrom
cj848:cj848/strengthen-kotlin-coroutine-regression
Open

[#14044] Strengthen coroutine lifecycle regression#14047
cj848 wants to merge 1 commit into
pinpoint-apm:masterfrom
cj848:cj848/strengthen-kotlin-coroutine-regression

Conversation

@cj848

@cj848 cj848 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Why

Follow-up to #14046. The original unit test verifies the block-aware callback contract, but reverting the production change fails at the interface assertion before exercising the stale-current-trace behavior.

This revision keeps both callback contracts executable in the test and models the lifecycle observed around coroutine/Reactor nesting: before() starts trace A, a simulated nested callback clears the async context's current trace, and after() must still close the exact block from trace A.

Related to #14044.

What

  • Simulate the current async trace being cleared between ResumeWithInterceptor.before() and after().
  • Exercise either the pre-fix AroundInterceptor or fixed BlockAroundInterceptor callback contract from the same test source.
  • Verify no second currentAsyncTraceObject() lookup and preserve exact block identity plus enter/begin/leave/close ordering.

Regression proof

  • Pre-fix superclass: ResumeWithInterceptorTest fails because AsyncContextSpanEventSimpleAroundInterceptor.after() calls currentAsyncTraceObject() after it has been cleared.
  • Block-aware superclass: the same test passes and closes the block returned by before().

Verification

  • ./mvnw -q -pl agent-module/plugins/kotlin-coroutines -am -DskipITs -Dtest=ResumeWithInterceptorTest -Dsurefire.failIfNoSpecifiedTests=false test
  • ./mvnw -q -pl agent-module/plugins/kotlin-coroutines -am -DskipITs test
  • Coroutines_1_6_IT: 38 tests, 0 failures/errors/skips
  • git diff --check

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cj848

cj848 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing this follow-up to keep the upstream change represented by the already merged #14046. The behavioral test refinement will not be proposed as a separate PR.

@cj848 cj848 closed this Jul 22, 2026
@cj848
cj848 deleted the cj848/strengthen-kotlin-coroutine-regression branch July 22, 2026 07:25
@cj848
cj848 restored the cj848/strengthen-kotlin-coroutine-regression branch July 22, 2026 07:54
@cj848 cj848 reopened this Jul 22, 2026
@sonarqubecloud

Copy link
Copy Markdown

@cj848
cj848 marked this pull request as ready for review July 22, 2026 08:00
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