Skip to content

large stack build uses a lot of space in temp directory #3018

Closed
@joeyh

Description

@joeyh

General summary/comments (optional)

When stack build needs to build a lot of dependencies, it uses a lot of disk space in the system temp directory. In particular, build directories for all packages are left there after the libraries have been installed into .stack-work, and are only cleaned up after the build finishes.

Steps to reproduce

stack build in git-annex source tree on a system with eg a 1.3 gb tmpfs for /tmp. (The default on a modern debian system with 4 gb of ram.)

Expected

successful build

Actual

Build will eventually use over a GB of space in /tmp/stacknnnn and fail. The temp directory is then freed, and re-running the build picks up where it left off, clearly not needing any of the stuff that was being kept in the temp directory.

Workaround

Set TMP to point to a directory with more space than /tmp

Suggested fix

Delete package build directories of dependencies after the copy/register step.

Stack version

1.1.2

I'm fairly sure current stack also behaves this way too. Looking at https://github.com/commercialhaskell/stack/blob/4ee027d2d93f42e790ff170c139094cc8dbb2373/src/Stack/Build/Execute.hs , withExecuteEnv is used to run the build plan and uses a single withSystemTempDir

Method of installation

apt-get

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions