Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-16877

solr backup via collections api fails with NPE when config contains an empty zookeeper node

    XMLWordPrintableJSON

Details

    Description

      The root cause for the backup to fail is an empty node in zookeeper (E.g. the querqy request handler in solr creates an empty .data node when starting up).

      To reproduce the issue, create a new (empty) node in zk (via zkCli.sh session and "create" command) under a configset of your collection and back up this collection via the collections API with action=BACKUP command.

      The reason is that the byte array provided to java.io.OutputStream.write is null in the case of an empty zookeeper node.

      Error:
      2023-07-07 12:33:52.121 DEBUG (OverseerThreadFactory-17-thread-3) [c:gettingstarted_20230707] o.a.s.c.b.BackupManager Writing file querqy/rewriters/.data
      2023-07-07 12:33:52.123 ERROR (OverseerThreadFactory-17-thread-3) [c:gettingstarted_20230707] o.a.s.c.a.c.OverseerCollectionMessageHandler Collection: gettingstarted_20230707 operation: backup failed => java.lang.NullPointerException: Cannot read the array length because "<parameter1>" is null
      at java.base/java.io.OutputStream.write(Unknown Source)
      java.lang.NullPointerException: Cannot read the array length because "<parameter1>" is null
      at java.io.OutputStream.write(Unknown Source) ~[?:?]
      at org.apache.solr.core.backup.BackupManager.downloadConfigToRepo(BackupManager.java:349) ~[?:?]
      at org.apache.solr.core.backup.BackupManager.downloadConfigDir(BackupManager.java:276) ~[?:?]
      at org.apache.solr.cloud.api.collections.BackupCmd.call(BackupCmd.java:149) ~[?:?]
      at org.apache.solr.cloud.api.collections.OverseerCollectionMessageHandler.processMessage(OverseerCollectionMessageHandler.java:126) ~[?:?]
      at org.apache.solr.cloud.OverseerTaskProcessor$Runner.run(OverseerTaskProcessor.java:566) ~[?:?]
      at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:289) ~[?:?]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
      at java.lang.Thread.run(Unknown Source) [?:?]

       

      Note:

      • when you create an empty file (with touch) and copy it in zookeeper (with "solr zk cp"), the backup doesn't raise the error (and backup succeeds).
      • when you create an empty node in zookeeper (via zkCli.sh session and "create" command), the backup raises the same error.

      Attachments

        Issue Links

          Activity

            People

              houston Houston Putman
              paul@search-solutions.net Paul Blanchaert
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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