martin059 / virtualization-level-2-vagrant-setup

TFG Project's Second & Third Virtualization Levels
Apache License 2.0
0 stars 0 forks source link

Test race condition hypothesis for known Grafana bug #62

Open martin059 opened 4 months ago

martin059 commented 4 months ago

Issue description

Originally posted by @martin059 in https://github.com/martin059/virtualization-level-2-vagrant-setup/issues/54#issuecomment-2199731764

After some testing for the final project’s presentation, it was discovered that even the workaround reproduces the error if it is executed very quickly (i.e., if it is executed as a single command separated by semicolons). Adding a sleep command for 2-5 seconds seems to fix this new error in the workaround.

Therefore, it seems this issue might be caused by race conditions. Perhaps the Ansible task tries to update Grafana's configuration while its container is not in an ideal state. Adding a sleep task in between the role, to give enough time for the container to prepare, might prove to fix this issue.

The single-line workaround with the sleep command is the following one:

cd grafana/; docker compose down -v; sudo rm -f initialConfig/grafana.db; docker compose up -d; sleep 5; sudo bash /home/vagrant/utils/grafanaUtils/restoreConfig.sh /home/vagrant/grafana/initialConfig/ <grafana_config_pwd>

Development task