Ansible: OSError: [Errno 26] Text file busy updating {{ avalanche_daemon_lib_dir }}/avalanchego-latest
Describe the bug If scripts/ansible/service_playbook.yml is is used to upgrade a node that is running, and was previously installed by this playbook, then during installation the following Ansible error may occur
TASK [avalanche_install : Install support files] ********************************************************
changed: [avanode] => (item=/usr/local/lib/avalanchego/avalanchego-preupgrade)
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 26] Text file busy: b'/usr/local/lib/avalanchego/avalanchego-latest/avalanchego-process'
failed: [avanode] (item=/usr/local/lib/avalanchego/avalanchego-latest) => {"ansible_loop_var": "item", "changed": false, "item": {"src": "~<redacted>/go/src/github.com/ava-labs/avalanchego/build/avalanchego-latest"}, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 102, in <module>\n File \"<stdin>\", line 94, in _ansiballz_main\n File \"<stdin>\", line 40, in invoke_module\n File \"/usr/lib/python3.7/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.7/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib/python3.7/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_copy_payload_g6nv1a13/ansible_copy_payload.zip/ansible/modules/files/copy.py\", line 790, in <module>\n File \"/tmp/ansible_copy_payload_g6nv1a13/ansible_copy_payload.zip/ansible/modules/files/copy.py\", line 753, in main\n File \"/tmp/ansible_copy_payload_g6nv1a13/ansible_copy_payload.zip/ansible/modules/files/copy.py\", line 417, in copy_diff_files\n File \"/usr/lib/python3.7/shutil.py\", line 121, in copyfile\n with open(dst, 'wb') as fdst:\nOSError: [Errno 26] Text file busy: b'/usr/local/lib/avalanchego/avalanchego-latest/avalanchego-process'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
To Reproduce
Run service_playbook.yml -i <inventory> against 1 or more nodes running avalanchego 1.4.5+. It is probably dependant on whether the node is mid or post database upgrade. It may not be 100% reproducible, e.g. there may be a race condition.
Expected behavior New copies of these files are installed without disturbing the running service,
Operating System Debian 10.x
Additional context This bug is my own doing (I wrote that ansible role), please assign it to me if you consider that appropriate. I'm not asking for assistance. It's here as I marker until I can submit a PR.