Race condition while running auto_lint.py
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
charm-juju-lint |
New
|
Medium
|
Unassigned |
Bug Description
There is a code block that ensures there's only one instance of the `auto_lint.py` process executing at any given moment. Usually this script is run on a cronjob, which is installed to the system during the install hook of the juju-lint charm. I said "usually" because there are two instances where this script is run as a subprocess by the charm itself:
1 - during install: after the cronjob installation is completed, the script is run once.
2 - during config-changed.
If any of these hooks are running while the cronjob is also running, the charm code is crashing, which is not very graceful.
Output taken from LP #1990992
https:/
unit-juju-lint-0: 23:00:03 ERROR unit.juju-
/var/lib/
warnings.
/var/lib/
"class": algorithms.
/tmp/auto_lint.pid already exists, exiting
unit-juju-lint-0: 23:00:03 ERROR unit.juju-
Traceback (most recent call last):
File "./src/charm.py", line 125, in <module>
main(
File "/var/lib/
_emit_
File "/var/lib/
event_
File "/var/lib/
framework.
File "/var/lib/
self.
File "/var/lib/
custom_
File "./src/charm.py", line 91, in on_config_changed
self.
File "/var/lib/
raise error
File "/var/lib/
subprocess.
File "/usr/lib/
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/
raise CalledProcessEr
subprocess.
unit-juju-lint-0: 23:00:04 ERROR juju.worker.
tags: | added: bseng-463 |
Changed in charm-juju-lint: | |
importance: | Undecided → Medium |