You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Madhan Neethiraj <ma...@apache.org> on 2016/03/05 04:00:31 UTC

Re: Review Request 44312: RANGER-863 : Make parameters like maxHttpHeaderSize configurable for EmbeddedServer

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44312/#review122177
-----------------------------------------------------------


Ship it!




Ship It!

- Madhan Neethiraj


On March 3, 2016, 9:07 a.m., Pradeep Agrawal wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/44312/
> -----------------------------------------------------------
> 
> (Updated March 3, 2016, 9:07 a.m.)
> 
> 
> Review request for ranger, Alok Lal, Don Bosco Durai, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Ramesh Mani, Selvamohan Neethiraj, and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-863
>     https://issues.apache.org/jira/browse/RANGER-863
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> **Problem Statement :**
> Parameters like maxHttpHeaderSize are not configurable in EmbeddedServer used by Ranger and RangerKMS.
> This ability is required to handle large header requests in kerberised (when ticket size is large) environment for Ranger KMS as well as Ranger Admin.
> 
> **Proposed Solution :**
> Attached patch contains changes in EmbeddedServer.java file which is being used to start tomcat service after instantiating the connector. In ranger-admin-site.xml and kms-site.xml properties file, tomcat attributes can be added with prefix ranger.service.http.connector.property., Where ranger.service.http.connector.property.<tomcat-attribute> shall be the property name and value tag can have valid value allowed in tomcat connector.
> For example : An entry for maxHttpHeaderSize attribute in ranger-admin-site would be : 
> 
> <property>
>     <name>ranger.service.http.connector.property.maxHttpHeaderSize</name>
>     <value>81920</value>
> </property>
> 
> Similarly below given connector properties can be configured : 
> 
> acceptCount
> acceptorThreadCount
> connectionTimeout
> keepAliveTimeout
> maxConnections
> maxHttpHeaderSize
> maxKeepAliveRequests
> maxThreads
> compression
> 
> Also there are few attributes which can't be overridden using above mentioned approach as tomcat has separate setter method to override those attribute values. For these attributes we will use prefix ranger.service.http.connector.attrib., but only below mentioned attribute shall be supported in this approach as of now. 
> 
> allowTrace
> asyncTimeout
> enableLookups
> maxHeaderCount
> maxParameterCount
> maxPostSize
> maxSavePostSize
> methods
> 
> I have implemented both approaches to override the default value of above attributes and the other properties also which can be configured through setProperty() method of Connector class.
> 
> 
> Diffs
> -----
> 
>   embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java fbd61f0 
> 
> Diff: https://reviews.apache.org/r/44312/diff/
> 
> 
> Testing
> -------
> 
> **Steps performed (with patch) :**
> 1. After Ranger installation, started Ranger admin and tried a REST call with huge HTTP header size.
> curl -i -u admin:admin -H "X-LongHeader: $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8192 | head -n 1)" http://localhost:6080/service/users/1
> 
> 2. After above request got below given response from server :
> 
> HTTP/1.1 400 Bad Request
> Server: Apache-Coyote/1.1
> Transfer-Encoding: chunked
> Date: Thu, 03 Mar 2016 04:49:20 GMT
> Connection: close
> 
> and below given log was observed in catalina.out :
> 
> INFO: Error parsing HTTP request header
> 
> 3. Now to solve above issue stopped the Ranger admin and configured property for maxHttpHeaderSize attribute in ranger-admin-site.xml and then restart the Ranger admin.
> <property>
>     <name>ranger.service.http.connector.property.maxHttpHeaderSize</name>
>     <value>81920</value>
> </property>
> 
> 4. Tried above mentioned REST call again and got the Response code '200 OK' along with expected output.
> 
> 
> Thanks,
> 
> Pradeep Agrawal
> 
>