#50985 Issue 50984 - Memory leaks in disk monitoring
Closed 3 years ago by spichugi. Opened 4 years ago by spichugi.
spichugi/389-ds-base i50984  into  master

@@ -576,8 +576,10 @@ 

          else:

              subprocess.call(['dd', 'if=/dev/zero', f'of={file_path}', 'bs=1M', f'count={FULL_THR_FILL_SIZE}'])

          _withouterrorlog(topo, 'topo.standalone.status() == True', 120)

-         with pytest.raises(subprocess.CalledProcessError):

+         try:

              topo.standalone.start()

+         except (ValueError, subprocess.CalledProcessError):

+             topo.standalone.log.info("Instance start up has failed as expected")

          _witherrorlog(topo, f'is too far below the threshold({THRESHOLD_BYTES} bytes). Exiting now', 2)

          # Verify DS has recovered from shutdown

          os.remove(file_path)

@@ -612,6 +612,7 @@ 

                              slapi_be_free(&be);

                          }

                      }

+                     slapi_ch_array_free(dirs);

minor comment. slapi_ch_array_free frees the dirs elements but does not reset dirs pointer.
you may add 'dirs = NULL;' after each slapi_ch_array_free(dirs).

                      return;

                  }

                  /*
@@ -710,6 +711,7 @@ 

                  slapi_be_free(&be);

              }

          }

+         slapi_ch_array_free(dirs);

the same

          g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);

          return;

  }

@@ -957,6 +957,7 @@ 

              return_value = 1;

              goto cleanup;

          }

+         slapi_ch_array_free(dirs);

the same

      }

      /* log the max fd limit as it is typically set in env/systemd */

      slapi_log_err(SLAPI_LOG_INFO, "main",

Description: Memory leaks are reported by the disk monitoring test suite.
The direct leak is related to char **dirs array which is not freed at all.
Free the array when we clean up or go to shutdown.
Fix disk_monitoring_test.py::test_below_half_of_the_threshold_not_starting_after_shutdown.
It should accept different exception whe the instance is not started.

https://pagure.io/389-ds-base/issue/50984

Reviewed by: ?

rebased onto 8ecada0

4 years ago

Pull-Request has been merged by spichugi

4 years ago

minor comment. slapi_ch_array_free frees the dirs elements but does not reset dirs pointer.
you may add 'dirs = NULL;' after each slapi_ch_array_free(dirs).

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4038

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago