oya icon indicating copy to clipboard operation
oya copied to clipboard

"text file is busy" when running a task and updating a pack at the same time

Open pierec opened this issue 4 years ago • 0 comments

I get a "text file is busy" error when running a task calling a script from a pack that's getting updated within the same task invocation. As far as I can tell this only happens when installing a newer version of already-installed pack. It also may be a Linux-specific issue.

$ oya run test
INFO[0002] Installing pack github.com/foo-inc/oya-packs/foo-py-project version v1.4.0 into "/tmp/oya585242744/github.com/foo-inc/oya-packs/[email protected]" (git tag: foo-py-project/v1.4.0)
INFO[0003] Installing pack github.com/foo-inc/oya-packs/foo-py-project version v1.4.0 into "/home/pierec/.oya/packs/github.com/foo-inc/oya-packs/[email protected]" (git tag: foo-py-project/v1.4.0)
------------------------------------------------------------------------------
Error: fork/exec /home/pierec/.oya/packs/github.com/foo-inc/oya-packs/[email protected]/chkdeps: text file busy

 at line 6, column 1

 5| # If venv is already setup, skip this task
> 6| "${Oya[BasePath]}/chkdeps" \
    ^

------------------------------------------------------------------------------
Error: task "venv" failed

 in github.com/foo-inc/oya-packs/foo-py-project imported as "_py"

------------------------------------------------------------------------------
Error: task "_py.venv" failed

 in file "/home/pierec/coding/tpx/foo/py-lib-logging/Oyafile"

------------------------------------------------------------------------------
Error: exit status 255

 at line 4, column 1

 3| # Make sure "pip-tools" is installed
> 4| oya run venv
    ^

------------------------------------------------------------------------------
Error: task "freeze" failed

 in github.com/foo-inc/oya-packs/foo-py-project imported as "_py"

------------------------------------------------------------------------------
Error: task "_py.freeze" failed

 in file "/home/pierec/coding/tpx/foo/py-lib-logging/Oyafile"

------------------------------------------------------------------------------
Error: exit status 255

 at line 3, column 1

 2|
> 3| oya run freeze
    ^

------------------------------------------------------------------------------
Error: task "test" failed

 in github.com/foo-inc/oya-packs/foo-py-project imported as "_py"

------------------------------------------------------------------------------
Error: task "_py.test" failed

 in file "/home/pierec/coding/tpx/foo/py-lib-logging/Oyafile"

------------------------------------------------------------------------------
Error: exit status 255

 at line 2, column 1

 1| set -e
> 2| oya run _py.test $@
    ^

------------------------------------------------------------------------------
Error: task "test" failed

 in file "/home/pierec/coding/tpx/foo/py-lib-logging/Oyafile"

Let me break that down into a minimal example. Consider a pack the following structure:

$ ls -l
drwxr-xr-x 3 pierec pierec  200 Oct 27 21:05 .
drwxr-xr-x 5 pierec pierec  120 Oct 27 10:57 ..
-rwxr-xr-x 1 pierec pierec  712 Oct 26 23:44 a-shell-script
-rw-r--r-- 1 pierec pierec 4551 Oct 29 19:53 Oyafile

$ cat Oyafile
Project: github.com/foo/some-pack

a-task: |
  set -e
  "${Oya[BasePath]}/a-shell-script"

Consider a project using the above pack:

$ cat Oyafile
Project: github.com/foo/some-project

Require:
  github.com/foo/some-pack: v1.0.0

a-task:
  some-pack.a-task

Steps to reproduce:

  1. git clone some-project to some directory.
  2. Run oya run a-task - no errors.
  3. Update Oyafile to refer to a newer version of some-pack.
  4. Run oya run a-task - "text file is busy" error occurs.
  5. Run oya run a-task again - no errors.

pierec avatar Oct 29 '21 18:10 pierec