Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] SWTBot tests

On Thu, Mar 21, 2013 at 1:18 PM, Laurent Goubet <laurent.goubet@xxxxxxx> wrote:
I can confirm that the failure is random, but when a pack file is held by the WindowCache, it is locked in that state and nothing seems to free it: if one deletion fails because of that lock, all will on that same file, whatever the number of tests that run in-between. Any test that tries and clear the test folder will fail with the same error.

Without your proposed change:

Running GitRepositoriesViewRepoHandlingTest.testSearchDirectoryWithBareRepos(), the test alone, it will never fail (out of ten runs).
Running GitRepositoriesViewRepoHandlingTest, all tests in the class, testSearchDirectoryWithBareRepos will fail at random (5 failures out of 6 runs).

With your proposed change, all tests of the class pass, out of 6 runs.

Since it seems like a success, I wanted to use the same kind of fix for every failure, but there are some less obvious, for example:

org.eclipse.egit.ui.view.repositories.GitRepositoriesViewRepoDeletionTest.testDeleteSubmoduleRepository() is particularly aimed at testing repository deletions. Further down the road, this test uses a org.eclipse.egit.ui.internal.repository.tree.command.RemoveCommand, which fails within deleteRepositoryContent(List<RepositoryNode>, boolean):

    repo.close();
    FileUtils.delete(repo.getDirectory(),
            FileUtils.RECURSIVE | FileUtils.RETRY
            | FileUtils.SKIP_MISSING);

the call to "delete" will recursively delete all files within the repositories but, here too, one of the "pack" files is held open by the WindowCache, despite the call to "repo.close()" just above.

JGit's WindowCache keeps a handle on pack files when opening a repository, in order to release
the handle the repository needs to be closed.

Usually we use JPicus [1] created by a SAP colleague to analyze file handle leaks. 
In order to download it you need to register a free public SDN (SAP developer network) account.

Start the app to be analyzed with the JPicus java agent. Using the Eclipse based analysis tool
you can collect snapshots of open handles and find the stacktrace of the code which opened handles
which are still open when the snapshot is taken.


--
Matthias

Back to the top