AsyncWebRequest IllegalStateException when using render method with just the status code
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
Rendering just the status code asynchronously throws IllegalStateException and also doubles the execution of the action (as you can see with 'hello' being printed out twice in the first image below).
In the synchronous version, rendering does not have the same problem and an object is returned with a predefined message attribute.
Adding a text argument to the asynchronous render call e.g. `render status: 404, text: ''` dispels the problem. I've not had the time to do a trace -- but rendering behavior is expected to be consistent whether synchronous or asynchronous.
### Async rendering

```
Grails application running at http://localhost:8080 in environment: development
hello
hello
ERROR org.grails.web.errors.GrailsExceptionResolver - IllegalStateException occurred when processing request: [POST] /keys
Can't set AsyncWebRequest with concurrent handling in progress. Stacktrace follows:
java.lang.IllegalStateException: Can't set AsyncWebRequest with concurrent handling in progress
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]
```
### Synchronous rendering

Contributor guide
Research direction
Start by reproducing the asynchronous `render status: 404` case described in the issue and compare it with the synchronous render behavior. Trace the `AsyncWebRequest` handling around the render call; done means the status-only asynchronous render does not throw `IllegalStateException` or execute the action twice, and behaves consistently with the synchronous version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100