hk2166 commented on PR #16786: URL: https://github.com/apache/grails-core/pull/16786#issuecomment-6466845652
All five points are addressed in 05ec87c807. - **One copy per request**: completion takes a single copy however many tasks were started during the request, and each task reads it through a view of its own, so a second task gets the same body as the first (detail in the inline reply). - **Nothing recycled is held**: the copy skips `org.grails.WEB_REQUEST` and any attribute holding the request itself, and the live request is released even when taking the copy fails (detail in the inline reply). - **The stream keeps its position**: a view serves the body through one stream or reader — a later `getInputStream()` returns the same stream where the last read ended, and `getReader()` after it throws the `IllegalStateException` the live request throws, and the other way around. Covered by `a task reads the copied body through one stream whose position persists, as on the live request`. - **A completed multipart request keeps its parameters**: a lazily resolving multipart wrapper parses the body for its parameters, which a request that is completing no longer offers; when that fails, the parameters are copied from the request the wrapper wraps. Covered by `the copy keeps the parameters of a multipart request that can no longer parse them as it completes`. - **A task started from a task gets its own view**: it no longer shares the stream of the task that started it, so each reads the whole body, while attributes stay shared across views as they are on the live request. Covered by `a task started from a task reads the request through a view of its own`. The release test now binds the web request the way the filter does (`WebUtils.storeGrailsWebRequest`), so `org.grails.WEB_REQUEST` is on the request when the copy is taken. On the previous head, the two-task body test, the stream-position test, the multipart-parameters test and the release test fail (the nested-task test passes there only because the old copy restarted the body on every `getInputStream` call). With the fix, the module's 54 tests pass, and so do the pubsub demo's 18 integration tests; Checkstyle, CodeNarc, PMD and the repository conventions are clean, and the guide builds with the updated paragraph. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
