apache / apache/grails-core

StandardServletMultipartResolver.resolveMultipart invoked multiple times for same request

Open
#13,841 0 comments 0 reactions 0 assignees View on GitHub
bug relate-to: performance
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.