Mark Gui created HDDS-5417:
------------------------------

             Summary: Fix json parse stackoverflow for cmd ozone debug 
container list
                 Key: HDDS-5417
                 URL: https://issues.apache.org/jira/browse/HDDS-5417
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Mark Gui
            Assignee: Mark Gui


When I run the command `ozone debug container list`, I saw the output:
{code:java}
[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"]->
...{code}
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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to