hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uma Maheswara Rao G (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-7688) When a servlet filter throws an exception in init(..), the Jetty server failed silently.
Date Fri, 04 Nov 2011 16:21:52 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-7688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144117#comment-13144117
] 

Uma Maheswara Rao G commented on HADOOP-7688:
---------------------------------------------

2011-11-04 10:55:04,403 INFO  http.HttpServer (HttpServer.java:start(647)) - Port returned
by webServer.getConnectors()[0].getLocalPort() before open() is -1. Opening the listener on
0
2011-11-04 10:55:04,434 INFO  http.HttpServer (HttpServer.java:start(652)) - listener.getLocalPort()
returned 3356 webServer.getConnectors()[0].getLocalPort() returned 3356
2011-11-04 10:55:04,434 INFO  http.HttpServer (HttpServer.java:start(685)) - Jetty bound to
port 3356
2011-11-04 10:55:04,434 INFO  mortbay.log (Slf4jLog.java:info(67)) - jetty-6.1.26
2011-11-04 10:55:04,668 WARN  mortbay.log (Slf4jLog.java:warn(76)) - failed recording: javax.servlet.ServletException
2011-11-04 10:55:04,668 WARN  mortbay.log (Slf4jLog.java:warn(89)) - Failed startup of context
org.mortbay.jetty.webapp.WebAppContext@10045eb{/,file:/E:/Trunk-Common/hadoop-common-project/hadoop-common/target/test-classes/webapps/test}
javax.servlet.ServletException
	at org.apache.hadoop.http.TestGlobalFilter$RecordingFilter.init(TestGlobalFilter.java:51)
	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.apache.hadoop.http.HttpServer.start(HttpServer.java:686)
	at org.apache.hadoop.http.TestGlobalFilter.testServletFilter(TestGlobalFilter.java:108)
        .........
	........
2011-11-04 10:55:04,700 WARN  mortbay.log (Slf4jLog.java:warn(76)) - failed recording: javax.servlet.ServletException
2011-11-04 10:55:04,700 WARN  mortbay.log (Slf4jLog.java:warn(76)) - failed org.mortbay.jetty.servlet.Context@1cdeff{/static,file:/E:/Trunk-Common/hadoop-common-project/hadoop-common/target/test-classes/webapps/static/}:
javax.servlet.ServletException
2011-11-04 10:55:04,700 WARN  mortbay.log (Slf4jLog.java:warn(76)) - failed ContextHandlerCollection@6cb8:
javax.servlet.ServletException
2011-11-04 10:55:04,700 WARN  mortbay.log (Slf4jLog.java:warn(89)) - Error starting handlers
javax.servlet.ServletException
	at org.apache.hadoop.http.TestGlobalFilter$RecordingFilter.init(TestGlobalFilter.java:51)
	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
	at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.apache.hadoop.http.HttpServer.start(HttpServer.java:686)
	at org.apache.hadoop.http.TestGlobalFilter.testServletFilter(TestGlobalFilter.java:108)
        ...........
	.......... 
2011-11-04 10:55:04,731 INFO  mortbay.log (Slf4jLog.java:info(67)) - Started SelectChannelConnector@0.0.0.0:3356
2011-11-04 10:55:04,731 WARN  http.HttpServer (TestGlobalFilter.java:access(82)) - access
http://localhost:3356/fsck
2011-11-04 10:55:04,856 WARN  http.HttpServer (TestGlobalFilter.java:access(96)) - urlstring=http://localhost:3356/fsck
java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost:3356/fsck
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1241)
	at org.apache.hadoop.http.TestGlobalFilter.access(TestGlobalFilter.java:89)
	at org.apache.hadoop.http.TestGlobalFilter.testServletFilter(TestGlobalFilter.java:128)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
-----------------------------------------------------------------------------------
------------------------------------------------------------------------------------

See the javadoc for ServeletHandler#initialize
http://jetty.codehaus.org/jetty/jetty-6/apidocs/org/mortbay/jetty/servlet/ServletHandler.html#initialize()
initialize
public void initialize()
                throws ExceptionInitialize filters and load-on-startup servlets. Called automatically
from start if autoInitializeServlet is true. 
Throws: 
Exception

*From your above comment,* 
  Whatever filters available in config with *hadoop.http.filter.initializers* it is adding
the Filters and mappings.
{code}
final FilterInitializer[] initializers = getFilterInitializers(conf); 
   if (initializers != null) {
     for(FilterInitializer c : initializers) {
       c.initFilter(this, conf);
     }
 }{code}
  So, while starting the contexts they are getting initialized.
  I am not sure we added all the filters by default. is there any other way to add lazily?

 Regarding to other proposal:
  {quote}
    How about pinging itself once the http server has started?
  {quote}
 Even if we assume all filters will not initialize at startup, 
I feel this may not help because we need to send the requests for all the urls which are mapping
to Fileters to ensure all filters initialized properly. Creating connections with all the
urls may not be the correct choice.
  and I think Connecting with all the urls wil be equals to setting servletHandlers.setAutoInitializeServlets(true);
explicitely.

  From Spec: https://jira.sakaiproject.org/secure/attachment/16135/servlet-2_4-fr-spec.pdf
  SRV.6.2.1 Filter Lifecycle
After deployment of the Web application, and before a request causes the container
to access a Web resource, the container must locate the list of filters that must be
applied to the Web resource as described below. The container must ensure that it
has instantiated a filter of the appropriate class for each filter in the list, and called
its
init(FilterConfig config) method. The filter may throw an exception to indicate
that it cannot function properly. If the exception is of type UnavailableException,
the container may examine the isPermanent attribute of the exception and may
choose to retry the filter at some later time.
Only one instance per <filter> declaration in the deployment descriptor is
instantiated per Java Virtual Machine (JVMTM) of the container. The container
provides the filter config as declared in the filter’s deployment descriptor, the
reference to the ServletContext for the Web application, and the set of
initialization parameters.


Thanks
Uma


                
> When a servlet filter throws an exception in init(..), the Jetty server failed silently.

> -----------------------------------------------------------------------------------------
>
>                 Key: HADOOP-7688
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7688
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 0.23.0, 0.24.0
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Uma Maheswara Rao G
>         Attachments: filter-init-exception-test.patch, org.apache.hadoop.http.TestServletFilter-output.txt
>
>
> When a servlet filter throws a ServletException in init(..), the exception is logged
by Jetty but not re-throws to the caller.  As a result, the Jetty server failed silently.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message