zhaijack commented on issue #414: Test failure in UpdateLedgerOpTest
URL: https://github.com/apache/bookkeeper/issues/414#issuecomment-321153010
   The problem is that the configuration in baseConf not get the wanted value 
after `new ServerConfiguration(baseConf)`.
   In the test, we setAllowLoopback(true), and thought it always true, but 
seems acturally not. 
   public UpdateLedgerOpTest() {
       baseConf.setAllowLoopback(true);  < === here set true
   BookieSocketAddress curBookieId = Bookie.getBookieAddress(baseConf);
   if (addr.getSocketAddress().getAddress().isLoopbackAddress()
       && !conf.getAllowLoopback()) {  < === getAllowLoopback get false, but we 
want it to be true.
       throw new UnknownHostException("Trying to listen on loopback address, "
               + addr + " but this is forbidden by default "
               + "(see ServerConfiguration#getAllowLoopback())");
   Add some log to trace and debug, Here is the place that the value in 
baseConf turns into unwanted at here:
   protected ServerConfiguration newServerConfiguration(int port, String 
zkServers, File journalDir, File[] ledgerDirs) {
       ServerConfiguration conf = new ServerConfiguration(baseConf);  < ===  
       LOG.info("baseConf: getAllowLoopBack: {} ", 
baseConf.getAllowLoopback()); < == print true
       conf.setAllowLoopback(true);  < == after this call, baseConf value also 
       LOG.info("baseConf: getAllowLoopBack: {} ", 
baseConf.getAllowLoopback()); < == print false
       LOG.info("newConf: getAllowLoopBack: {} ", conf.getAllowLoopback());
       String[] ledgerDirNames = new String[ledgerDirs.length];
       for (int i=0; i<ledgerDirs.length; i++) {
           ledgerDirNames[i] = ledgerDirs[i].getPath();
       return conf;
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

Reply via email to