StandardServletMultipartResolver.resolveMultipart invoked multiple times for same request
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
The following should be analyzed because off hand it seems inefficient. Multipart requests are resolved multiple times for handling url mappings which appears to be real inefficient.
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/UrlMappingsHandlerMapping.groovy#L157
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/GrailsControllerUrlMappings.java#L45-L67
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/AbstractGrailsControllerUrlMappings.groovy#L185-L203
-> `DefaultUrlMappingInfo.tryMultipartParams` is invoked for every UrlMappingInfo because of the call to getActionName()
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/AbstractUrlMappingInfo.java#L70-L102
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java#L197-L205
due to `checkDispatchAction(webRequest.getCurrentRequest());`
https://github.com/grails/grails-core/blob/6f9d173e0af20a852971aad78a42cc42bba7fd80/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java#L215-L221
Contributor guide
Research direction
Start at UrlMappingsHandlerMapping.groovy, GrailsControllerUrlMappings.java, and AbstractGrailsControllerUrlMappings.groovy, then trace getActionName() through AbstractUrlMappingInfo.java and DefaultUrlMappingInfo.java. Check how often DefaultUrlMappingInfo.tryMultipartParams and checkDispatchAction resolve the same request. Done means establishing whether repeated resolution occurs and identifying the required change or test scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100