Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-5417

Fix json parse stackoverflow for cmd ozone debug container list

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.2.0
    • None

    Description

      When I run the command `ozone debug container list`, I saw the output:

      [ozoneadmin@0dc124237e09 ozone-1.2.0-SNAPSHOT]$ ./bin/ozone debug container list
      2021-07-07 03:59:48,075 [main] INFO volume.HddsVolume: Creating HddsVolume: /data1/hdds of storage type : DISK capacity : 47341600768
      2021-07-07 03:59:48,076 [main] INFO volume.MutableVolumeSet: Added Volume : /data1/hdds to VolumeSet
      2021-07-07 03:59:48,077 [main] INFO volume.HddsVolume: Creating HddsVolume: /data2/hdds of storage type : DISK capacity : 47341600768
      2021-07-07 03:59:48,078 [main] INFO volume.MutableVolumeSet: Added Volume : /data2/hdds to VolumeSet
      2021-07-07 03:59:48,078 [main] INFO volume.HddsVolume: Creating HddsVolume: /data3/hdds of storage type : DISK capacity : 47341600768
      2021-07-07 03:59:48,079 [main] INFO volume.MutableVolumeSet: Added Volume : /data3/hdds to VolumeSet
      2021-07-07 03:59:48,153 [main] INFO container.ContainerCommands: Starting the read all the container metadata
      2021-07-07 03:59:48,153 [main] INFO container.ContainerCommands: Loading container metadata from volume /data1/hdds
      2021-07-07 03:59:48,154 [main] INFO ozoneimpl.ContainerReader: Running in upgrade mode:true
      2021-07-07 03:59:48,155 [main] INFO ozoneimpl.ContainerReader: Start to verify containers on volume /data1/hdds
      2021-07-07 03:59:48,568 [main] INFO ozoneimpl.ContainerReader: Finish verifying containers on volume /data1/hdds
      2021-07-07 03:59:48,568 [main] INFO container.ContainerCommands: Loading container metadata from volume /data2/hdds
      2021-07-07 03:59:48,568 [main] INFO ozoneimpl.ContainerReader: Running in upgrade mode:true
      2021-07-07 03:59:48,568 [main] INFO ozoneimpl.ContainerReader: Start to verify containers on volume /data2/hdds
      2021-07-07 03:59:48,750 [main] INFO ozoneimpl.ContainerReader: Finish verifying containers on volume /data2/hdds
      2021-07-07 03:59:48,751 [main] INFO container.ContainerCommands: Loading container metadata from volume /data3/hdds
      2021-07-07 03:59:48,751 [main] INFO ozoneimpl.ContainerReader: Running in upgrade mode:true
      2021-07-07 03:59:48,751 [main] INFO ozoneimpl.ContainerReader: Start to verify containers on volume /data3/hdds
      2021-07-07 03:59:48,887 [main] INFO ozoneimpl.ContainerReader: Finish verifying containers on volume /data3/hdds
      2021-07-07 03:59:48,887 [main] INFO container.ContainerCommands: All the container metadata is loaded.
      Infinite recursion (StackOverflowError) (through reference chain: org.apache.hadoop.ozone.container.common.volume.HddsVolume["volumeSet"]->org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet["volumeMap"]->com.google.common.collect.RegularImmutableMap["/data1/hdds"]->org.apache.hadoop.ozone.container.common.volume.HddsVolume["volumeSet"]->org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet["volumeMap"]->com.google.common.collect.RegularImmutableMap["/data1/hdds"]->org.apache.hadoop.ozone.container.common.volume.HddsVolume["volumeSet"]->org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet["volumeMap"]->com.google.common.collect.RegularImmutableMap["/data1/hdds"]->org.apache.hadoop.ozone.container.common.volume.HddsVolume["volumeSet"]->org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet["volumeMap"]->com.google.common.collect.RegularImmutableMap["/data1/hdds"]->org.apache.hadoop.ozone.container.common.volume.HddsVolume["volumeSet"]->
      ...

      This is due to the json parser will try recursively to parse each field of ContainerData, and when it meets `HddsVolume`, it enters a loop 'HddsVolume->VolumeSet->VolumeMap->HddsVolume'.

      We could break the loop by letting json parser ignore the HddsVolume in ContainerData, we already have location information like chunksPath, so detailed volume info in HddsVolume is not necessary for container info for debug.

      Attachments

        Issue Links

          Activity

            People

              markgui Mark Gui
              markgui Mark Gui
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: