Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-10461

sanity 77c failure due to variables called in cleanup routine are out of scope

    XMLWordPrintable

Details

    • 3
    • 9223372036854775807

    Description

      In sanity test 77c, we call cleanup_77c() at the end of the test to cleanup at the end of the test and a trap is set to call the clean up function when the test is exited. cleanup_77c() uses variables from test_77c which are declared local. From sanity.sh:

      6375 cleanup_77c() {
      6376         trap 0
      6377         set_checksums 0
      6378         $LCTL set_param osc.*osc-[^mM]*.checksum_dump=0
      6379         $check_ost &&
      6380                 do_facet ost1 $LCTL set_param obdfilter.*-OST*.checksum_dump=0
      6381         [ -n $osc_file_prefix ] && rm -f ${osc_file_prefix}*
      6382         $check_ost && [ -n $ost_file_prefix ] &&
      6383                 do_facet ost1 rm -f ${ost_file_prefix}\*
      6384 }
      6385 
      6386 test_77c() {
      6387         [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
      6388         $GSS && skip "could not run with gss" && return
      6389 
      6390         local bad1
      6391         local osc_file_prefix
      6392         local osc_file
      6393         local check_ost=false
      6394         local ost_file_prefix
      6395         local ost_file
      6396         local orig_cksum
      6397         local dump_cksum
      6398         local fid
      6399 
      …
      6417         osc_file_prefix=$($LCTL get_param -n debug_path)
      6418         osc_file_prefix=${osc_file_prefix}-checksum_dump-osc-\\${fid}
      6419 
      6420         trap cleanup_77c EXIT
      …
      

      When the test exits normally and cleanup_77c() is called at the end of the test, there is no issue; the variables from the test are still in scope.

      There is a problem when we exit test_77c when we encounter an error or exit the test before calling cleanup_77c. In these cases, the trap specified in line 6420 is invoked and cleanup_77c() is called. Yet, the variables that are local to test_77c are no longer visible to the cleanup routine.

      One fix for this is to increase the scope of the variables, remove “local”, and this should fix the problem. What are other solutions?

      Logs for this test failing are at:
      https://testing.hpdd.intel.com/test_sets/9dbb758a-e767-11e7-8027-52540065bddc
      https://testing.hpdd.intel.com/test_sets/6958de42-f002-11e7-854b-52540065bddc

      I suspect there are more examples of this issue in our test suites.

      Attachments

        Issue Links

          Activity

            People

              jamesanunez James Nunez (Inactive)
              jamesanunez James Nunez (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: