Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-3035

Log loop print “Using default maxIOWorkers”,Cause stack overflow

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7.0
    • Fix Version/s: None
    • Component/s: Client SDK
    • Environment:
      • jdk version:jdk1.8
      • software platform:win10/CentOs 7

      Description

      Configuration:
      pom.xml

              <dependency>
                  <groupId>org.apache.flume.flume-ng-clients</groupId>
                  <artifactId>flume-ng-log4jappender</artifactId>
                  <version>1.7.0</version>
              </dependency>
      

      log4j.properties

      log4j.appender.flume = org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender
      log4j.appender.flume.Hosts = fooflumesource.com:25430 barflumesource.com:25430
      log4j.appender.flume.Selector = ROUND_ROBIN
      log4j.appender.flume.MaxBackoff = 60000
      log4j.logger.org.apache.flume.clients.log4jappender = DEBUG,flume
      

      Problem description:
      Log loop print “2016-12-17 10:48:53,629 WARN NettyAvroRpcClient:634 Using default maxIOWorkers”,Cause stack overflow;

      Exception in thread "main" java.lang.StackOverflowError
      	at java.util.Calendar.setTime(Calendar.java:1770)
      	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943)
      	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)
      	at java.text.DateFormat.format(DateFormat.java:345)
      	at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:443)
      	at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:65)
      	at org.apache.log4j.PatternLayout.format(PatternLayout.java:506)
      	at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:310)
      	at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
      	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      	at org.apache.log4j.Category.callAppenders(Category.java:206)
      	at org.apache.log4j.Category.forcedLog(Category.java:391)
      	at org.apache.log4j.Category.log(Category.java:856)
      	at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:400)
      	at org.apache.flume.api.NettyAvroRpcClient.configure(NettyAvroRpcClient.java:634)
      	at org.apache.flume.api.RpcClientFactory.getInstance(RpcClientFactory.java:90)
      	at org.apache.flume.api.LoadBalancingRpcClient.createClient(LoadBalancingRpcClient.java:214)
      	at org.apache.flume.api.LoadBalancingRpcClient.getClient(LoadBalancingRpcClient.java:197)
      	at org.apache.flume.api.LoadBalancingRpcClient.append(LoadBalancingRpcClient.java:71)
      	at org.apache.flume.clients.log4jappender.Log4jAppender.append(Log4jAppender.java:162)
      	at org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender.append(LoadBalancingLog4jAppender.java:111)
      	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      	at org.apache.log4j.Category.callAppenders(Category.java:206)
      	at org.apache.log4j.Category.forcedLog(Category.java:391)
      	at org.apache.log4j.Category.log(Category.java:856)
      	at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:400)
      	at org.apache.flume.api.NettyAvroRpcClient.configure(NettyAvroRpcClient.java:634)
      	at org.apache.flume.api.RpcClientFactory.getInstance(RpcClientFactory.java:90)
      	at org.apache.flume.api.LoadBalancingRpcClient.createClient(LoadBalancingRpcClient.java:214)
      	at org.apache.flume.api.LoadBalancingRpcClient.getClient(LoadBalancingRpcClient.java:197)
      	at org.apache.flume.api.LoadBalancingRpcClient.append(LoadBalancingRpcClient.java:71)
      	at org.apache.flume.clients.log4jappender.Log4jAppender.append(Log4jAppender.java:162)
      	at org.apache.flume.clients.log4jappender.LoadBalancingLog4jAppender.append(LoadBalancingLog4jAppender.java:111)
      	at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
      	at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
      	at org.apache.log4j.Category.callAppenders(Category.java:206)
      	at org.apache.log4j.Category.forcedLog(Category.java:391)
      	at org.apache.log4j.Category.log(Category.java:856)
      	at org.slf4j.impl.Log4jLoggerAdapter.warn(Log4jLoggerAdapter.java:400)
      

      Problem analysis:

      NettyAvroRpcClient.java
      // Some comments here
      public synchronized void configure(Properties properties)
            throws FlumeException {
      
      //=====Ignore the above code=======
          String maxIoWorkersStr = properties.getProperty(RpcClientConfigurationConstants.MAX_IO_WORKERS);
          if (!StringUtils.isEmpty(maxIoWorkersStr)) {
            try {
              maxIoWorkers = Integer.parseInt(maxIoWorkersStr);
            } catch (NumberFormatException ex) {
              logger.warn("Invalid maxIOWorkers:" + maxIoWorkersStr + " Using " +
                  "default maxIOWorkers.");
              maxIoWorkers = -1;
            }
          }
        // When maxIoWorkersStr is null,maxIoWorkers less than 1,then print log into dead loop;
          if (maxIoWorkers < 1) {
            logger.warn("Using default maxIOWorkers");
            maxIoWorkers = -1;
          }
      
          this.connect();
      }
      

      Temporary solution:

      LoadBalancingLog4jAppender.java
      private Properties getProperties(String hosts, String selector,
      			String maxBackoff, long timeout) throws FlumeException {
      //=====Ignore the above code=======
      props.setProperty(RpcClientConfigurationConstants.MAX_IO_WORKERS,(Runtime.getRuntime()
                      .availableProcessors() * 2)+"");
      		return props;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Yashon Yashon
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified