Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This repository was archived by the owner on May 28, 2025. It is now read-only.

No thread-bound request found error in controller promise  #19

Open
@ryang-bgl

Description

@ryang-bgl

Thanks for reporting an issue for Grails Async, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.

Task List

  • Steps to reproduce provided
    Stacktrace (if present) provided
    Example that reproduces the problem uploaded to Github
    Full description of the issue provided (see below)

Steps to Reproduce

I am trying to upgrade a grails 2.5.4 application to grails 3.3.2. Some of the codes used to work now couldn't work. Basically, the issue is that the async task in the controller is referencing request.params which is not available in the async thread.

I created a 2.5.4 project (demo254) and a 3.3.2 project (demo332) to demonstrate the issue. Both projects have the same controller and view code.

Please refer to the readme in https://github.com/ruiyang/grails-issue-demo.git to reproduce.

Expected Behaviour

I am not sure about the expected behaviour. I just need to know if there is any way I could get this code working to avoid a lot of rewrites.

Actual Behaviour

Exception:
URI /helloWorld
Class . java.lang.IllegalStateException
Message . null
Caused by: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.

Environment Information

  • Operating System: MacOs
  • Grails Version: 2.5.4 VS 3.3.2
  • JDK Version: 8

Example Application

Activity

jaguar1975cn

jaguar1975cn commented on Jun 25, 2018

@jaguar1975cn

I have the same issue on 3.3.6. Any news about this problem? Thanks

mortensoby

mortensoby commented on Jan 8, 2019

@mortensoby

I have the same problem with 3.3.9

ppazos

ppazos commented on Sep 16, 2021

@ppazos

I have found using this in controllers and running integration tests will cause the problem, I'm on Grails 3.3.10:

class XXXController {
   def config = grailsApplication.config
   ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ryang-bgl@ppazos@mortensoby@jaguar1975cn

        Issue actions

          No thread-bound request found error in controller promise · Issue #19 · grails/grails-async