NOAA-GFDL / FMS

GFDL's Flexible Modeling System
Other
92 stars 134 forks source link

Modern_diag_manager:: Crashes when two+ empty files #1502

Closed uramirez8707 closed 4 months ago

uramirez8707 commented 5 months ago

Describe the bug If you have two empty files in my diag_table.yaml, the code will crash with something like

forrtl: severe (151): allocatable array is already allocated
Image              PC                Routine            Line        Source             
libFMS.so.18.0.0   00007F58E9FD56BA  fms_diag_yaml_mod         669  fms_diag_yaml.F90
libFMS.so.18.0.0   00007F58E9FCA010  fms_diag_yaml_mod         416  fms_diag_yaml.F90
libFMS.so.18.0.0   00007F58EA0055B3  fms_diag_object_m         128  fms_diag_object.F90
libFMS.so.18.0.0   00007F58E9F01553  diag_manager_mod_        4213  diag_manager.F90
test_reduction_me  000000000040F0A8  MAIN__                    102  test_reduction_methods.F90
test_reduction_me  000000000040E82D  Unknown               Unknown  Unknown
libc-2.28.so       00007F58E467BD85  __libc_start_main     Unknown  Unknown
test_reduction_me  000000000040E74E  Unknown               Unknown  Unknown

This is because the variable filename is not deallocated so when it reaches the second empty file it crashes.

To Reproduce Modify the test_time_none.sh to include this test

cat <<_EOF > diag_table.yaml
title: test_none
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_send_data_never_called
  time_units: hours
  unlimdim: time
  freq: 6 hours
- file_name: test_wut
  time_units: hours
  unlimdim: time
  freq: 6 hours
_EOF

my_test_count=`expr $my_test_count + 1`
test_expect_success "Testing diag manager two empty files (test $my_test_count)" '
  mpirun -n 6 ../test_reduction_methods
  '

and run it make check TESTS="test_time_none" SKIP_TESTS="test_time_none.[1-21]"

Expected behavior That should not crash

System Environment This happens in any system

Additional context N/A