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

[Different Request, Response Thread] Sring Boot 2.6.1 + MVC + Weclient + Kotlin Coroutines #33029

Closed
sungbo5934 opened this issue Nov 7, 2022 · 1 comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@sungbo5934
Copy link

sungbo5934 commented Nov 7, 2022

Spring boot 2.6.1
Kotlin 1.6.0
mycode

@Controller
class Test{

    @GetMapping(..)
    suspend fun api(): Response {
      System.out.print(Thread.currentthread()) <-- http-nio-port-exec-1
      
      Webclient().post().url().retrieve().bodyToMono()..awaitSingle() // api call
      System.out.print(Thread.currentthread()) <-- reactor-1
      throw Exception() <- example
      
      return Response.builder(suspend fun...)
    }

    @exceptionhadler
    fun..{
       System.out.print(Thread.currentthread()) <-- http-nio-port-exec-2 ?? why!
    }

}

It is being developed through coroutine. Currently, spring boot 2.6 version supports the suspend function, but the thread of request and response are different, so MDC and trace cannot be tracked. Could you give me some help?

trace track and Mdc Context

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 7, 2022
@sungbo5934 sungbo5934 changed the title Sring Boot 2.6.1 + MVC + Weclient + Kotlin Coroutines [Different Request, Response Thread] Sring Boot 2.6.1 + MVC + Weclient + Kotlin Coroutines Nov 7, 2022
@philwebb
Copy link
Member

philwebb commented Nov 7, 2022

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that
other people can find it) or add some more details if you feel this is a genuine bug.

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2022
@philwebb philwebb added for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

3 participants