activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (ARTEMIS-958) Improve web server tmp dir cleanup
Date Wed, 15 Feb 2017 01:19:41 GMT


ASF GitHub Bot commented on ARTEMIS-958:

Github user clebertsuconic commented on a diff in the pull request:
    --- Diff: artemis-web/src/main/java/org/apache/activemq/artemis/component/
    @@ -145,9 +149,16 @@ public void internalStop() throws Exception {
                    //tmpdir will be removed by deleteOnExit()
                    //somehow when broker is stopped and restarted quickly
                    //this tmpdir won't get deleted sometimes
    -               boolean fileDeleted = TimeUtils.waitOnBoolean(false, 10000, tmpdir::exists);
    +               boolean fileDeleted = TimeUtils.waitOnBoolean(false, 5000, tmpdir::exists);
                    if (!fileDeleted) {
    -                  ActiveMQWebLogger.LOGGER.tmpFileNotDeleted(tmpdir);
    +                  //because the execution order of shutdown hooks are
    +                  //not determined, so it's possible that the deleteOnExit
    +                  //is executed after this hook, in that case we force a delete.
    +                  FileUtil.deleteDirectory(tmpdir);
    +                  logger.debug("Force to delete temporary file on shutdown: " + tmpdir.getAbsolutePath());
    --- End diff --
    I'm going to merge this,
    but just as a future reference, we do a lot of if (logger.isDebugEnabled());
    This is a negative test and it won't be affected, so no big deal, and it will be merged..

    just saying that for future reference.

> Improve web server tmp dir cleanup
> ----------------------------------
>                 Key: ARTEMIS-958
>                 URL:
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.5.2
>            Reporter: Howard Gao
>            Assignee: Howard Gao
>            Priority: Minor
>             Fix For: 2.0.0
> When server is shutdown by user the shutdown hook will check if the tmpdir of the web
server is cleaned up. However the cleanup is also performed in a shutdown hook (using File.deleteOnExit).
Because the order of execution of hooks is not guaranteed, if the tmp dir is not cleaned up
by the time of check, we should add a 'force' delete to make sure the tmp dir is removed after
server stop.

This message was sent by Atlassian JIRA

View raw message