Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-10207

CLOSE_WAIT socket connection leaks during rendering of (corrupted) aggregated logs on the JobHistoryServer Web UI

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0, 3.2.2, 3.4.0
    • Component/s: yarn
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      File descriptor leaks are observed coming from the JobHistoryServer process while it tries to render a "corrupted" aggregated log on the JHS Web UI.

      Issue reproduced using the following steps:

      1. Ran a sample Hadoop MR Pi job, it had the id - application_1582676649923_0026.
      2. Copied an aggregated log file from HDFS to local FS:
        hdfs dfs -get /tmp/logs/systest/logs/application_1582676649923_0026/<nm_hostname>_8041
        
      3. Updated the TFile metadata at the bottom of this file with some junk to corrupt the file :
        Before:
        		        ^@^GVERSION*(^@&container_1582676649923_0026_01_000003^F^Dnone^A^Pª5²ª5²^C^Qdata:BCFile.index^Dnoneª5þ^M^M^Pdata:TFile.index^Dnoneª5È66^Odata:TFile.meta^Dnoneª5Â^F^F^@^@^@^@^@^B6^K^@^A^@^@Ñ^QÓh<91>µ×¶9ßA@<92>ºáP
        

        After:

        		
        		        ^@^GVERSION*(^@&container_1582676649923_0026_01_000003^F^Dnone^A^Pª5²ª5²^C^Qdata:BCFile.index^Dnoneª5þ^M^M^Pdata:TFile.index^Dnoneª5È66^Odata:TFile.meta^Dnoneª5Â^F^F^@^@^@^@^@^B6^K^@^A^@^@Ñ^QÓh<91>µ×¶9ßA@<92>ºáPblah
        

        Notice "blah" (junk) added at the very end.

      4. Remove the existing aggregated log file that will need to be replaced by our modified copy from step 3 (as otherwise HDFS will prevent it from placing the file with the same name as it already exists):
        hdfs dfs -rm -r -f /tmp/logs/systest/logs/application_1582676649923_0026/<nm_hostname>_8041
        
      5. Upload the corrupted aggregated file back to HDFS:
        hdfs dfs -put <nm_hostname>_8041 /tmp/logs/systest/logs/application_1582676649923_0026
        
      6. Visit HistoryServer Web UI
      7. Click on job_1582676649923_0026
      8. Click on "logs" link against the AM (assuming the AM ran on nm_hostname)
      9. Review the JHS logs, following exception will be seen:
        	2020-03-24 20:03:48,484 ERROR org.apache.hadoop.yarn.webapp.View: Error getting logs for job_1582676649923_0026
        	java.io.IOException: Not a valid BCFile.
        	        at org.apache.hadoop.io.file.tfile.BCFile$Magic.readAndVerify(BCFile.java:927)
        	        at org.apache.hadoop.io.file.tfile.BCFile$Reader.<init>(BCFile.java:628)
        	        at org.apache.hadoop.io.file.tfile.TFile$Reader.<init>(TFile.java:804)
        	        at org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat$LogReader.<init>(AggregatedLogFormat.java:588)
        	        at org.apache.hadoop.yarn.logaggregation.filecontroller.tfile.TFileAggregatedLogsBlock.render(TFileAggregatedLogsBlock.java:111)
        	        at org.apache.hadoop.yarn.logaggregation.filecontroller.tfile.LogAggregationTFileController.renderAggregatedLogsBlock(LogAggregationTFileController.java:341)
        	        at org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlock.render(AggregatedLogsBlock.java:117)
        	        at org.apache.hadoop.yarn.webapp.view.HtmlBlock.render(HtmlBlock.java:69)
        	        at org.apache.hadoop.yarn.webapp.view.HtmlBlock.renderPartial(HtmlBlock.java:79)
        	        at org.apache.hadoop.yarn.webapp.View.render(View.java:235)
        	        at org.apache.hadoop.yarn.webapp.view.HtmlPage$Page.subView(HtmlPage.java:49)
        	        at org.apache.hadoop.yarn.webapp.hamlet2.HamletImpl$EImp._v(HamletImpl.java:117)
        	        at org.apache.hadoop.yarn.webapp.hamlet2.Hamlet$TD.__(Hamlet.java:848)
        	        at org.apache.hadoop.yarn.webapp.view.TwoColumnLayout.render(TwoColumnLayout.java:71)
        	        at org.apache.hadoop.yarn.webapp.view.HtmlPage.render(HtmlPage.java:82)
        	        at org.apache.hadoop.yarn.webapp.Controller.render(Controller.java:212)
        	        at org.apache.hadoop.mapreduce.v2.hs.webapp.HsController.logs(HsController.java:202)
        	        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	        at java.lang.reflect.Method.invoke(Method.java:498)
        	        at org.apache.hadoop.yarn.webapp.Dispatcher.service(Dispatcher.java:162)
        	        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        	        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287)
        	        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277)
        	        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182)
        	        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
        	        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
        	        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:941)
        	        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:875)
        	        at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:829)
        	        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        	        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)
        	        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
        	        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
        	        at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
        	        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
        	        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
        	        at org.apache.hadoop.security.http.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:57)
        	        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
        	        at org.apache.hadoop.http.lib.StaticUserWebFilter$StaticUserFilter.doFilter(StaticUserWebFilter.java:110)
        	        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
        	        at org.apache.hadoop.http.HttpServer2$QuotingInputFilter.doFilter(HttpServer2.java:1553)
        	        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
        	        at org.apache.hadoop.http.NoCacheFilter.doFilter(NoCacheFilter.java:45)
        	        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
        	        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
        	        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        	        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        	        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
        	        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
        	        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513)
        	        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        	        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
        	        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        	        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
        	        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        	        at org.eclipse.jetty.server.Server.handle(Server.java:539)
        	        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
        	        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        	        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
        	        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
        	        at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:259)
        	        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
        	        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
        	        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
        	        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
        	        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
        	        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
        	        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
        	        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
        	        at java.lang.Thread.run(Thread.java:748)
        
      10. Run lsof -p 13224 | grep CLOSE_WAIT
        java    13224 mapred  231u     IPv4          138429719       0t0       TCP nm_hostname:53040-><datanode_hostname>:9866 (CLOSE_WAIT)
        

        where 9866 is the Datanode port in my cluster and 13224 is the JobHistoryServer process id.

      As long as I repeat 6,7,8 (in order and collectively) the CLOSE_WAIT instances keep increasing.

        Attachments

        1. YARN-10207.001.patch
          4 kB
          Siddharth Ahuja
        2. YARN-10207.002.patch
          4 kB
          Siddharth Ahuja
        3. YARN-10207.003.patch
          4 kB
          Siddharth Ahuja
        4. YARN-10207.004.patch
          3 kB
          Siddharth Ahuja
        5. YARN-10207.branch-3.2.001.patch
          3 kB
          Szilard Nemeth

          Activity

            People

            • Assignee:
              sahuja Siddharth Ahuja
              Reporter:
              sahuja Siddharth Ahuja
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: