Repository navigation
Description
Hey all,
I've setup ioBroker on an Intel Atom Z8350 and Ubuntu 18.04 LTS using the script installer. The setup worked fine, but I had to switch from the js2fs adapter to the script mirroring feature of the Javascript adapter because of the known soef issues.
The javascript adapter works well but I encounter an issue that modified scripts get started multiple times. This is the scenario:
- I create and modify scripts with Microsoft Visual Studio Code.
- It doesn't matter if I modify the script file on the Linux file system or on the exposed Samba file share. Copying based on
sshorscptriggers the same behavior. - I can easily reproduce the issue with the simple test-script.
- If I modify a script after the adapter has been started or restarted, everything works as expected: The adapter stops the modified script and restarts the script.
- If I modify the same or another script again, the adapter will start the modified script multiple times, but at least two times.
- After an amount of time, I don't know how much time exactly, the adapter works as expected again and modified scripts get started only once. The next modification will trigger the issue again.
This is the test-script script.js.Skript1 for reproducing the issue.
///
let counter = 0;
function main() {
// Test 07.06.2020
// Javascript-adapter
counter += 1;
log(`Skript startet: ${counter}`,"error");
}
main();These are the debug-log entries for the first modification of the script after starting or restarting the adpater:
javascript.0 2020-06-07 11:01:28.809 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:01:27.138 info (22075) script.js.Skript1: registered 0 subscriptions and 0 schedules
javascript.0 2020-06-07 11:01:27.138 error (22075) script.js.Skript1: Skript startet: 1
javascript.0 2020-06-07 11:01:27.105 info (22075) Start javascript script.js.Skript1
javascript.0 2020-06-07 11:01:27.092 info (22075) Stop script script.js.Skript1
javascript.0 2020-06-07 11:01:27.074 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:01:27.073 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:01:27.069 debug (22075) Update script script.js.Skript1 in DB
javascript.0 2020-06-07 11:01:27.064 debug (22075) File /opt/iobroker/scripts/Skript1.js change
If I change the script once again without restarting the adapter the adapter will start the script at least two times:
javascript.0 2020-06-07 11:02:56.734 info (22075) script.js.Skript1: registered 0 subscriptions and 0 schedules
javascript.0 2020-06-07 11:02:56.734 error (22075) script.js.Skript1: Skript startet: 1
javascript.0 2020-06-07 11:02:56.704 info (22075) Start javascript script.js.Skript1
javascript.0 2020-06-07 11:02:56.698 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.680 info (22075) script.js.Skript1: registered 0 subscriptions and 0 schedules
javascript.0 2020-06-07 11:02:56.680 error (22075) script.js.Skript1: Skript startet: 1
javascript.0 2020-06-07 11:02:56.662 info (22075) Start javascript script.js.Skript1
javascript.0 2020-06-07 11:02:56.656 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.651 info (22075) Stop script script.js.Skript1
javascript.0 2020-06-07 11:02:56.646 debug (22075) Update /opt/iobroker/scripts/Skript1.js on disk
javascript.0 2020-06-07 11:02:56.639 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.637 info (22075) Stop script script.js.Skript1
javascript.0 2020-06-07 11:02:56.630 debug (22075) Update /opt/iobroker/scripts/Skript1.js on disk
javascript.0 2020-06-07 11:02:56.618 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.617 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.610 debug (22075) Update script script.js.Skript1 in DB
javascript.0 2020-06-07 11:02:56.608 debug (22075) File /opt/iobroker/scripts/Skript1.js change
javascript.0 2020-06-07 11:02:56.604 debug (22075) Update script script.js.Skript1 in DB
javascript.0 2020-06-07 11:02:56.601 debug (22075) File /opt/iobroker/scripts/Skript1.js change
Please let me know if you need further information or if I can assist anymore.
KR, MiGoller
Activity
Apollon77 commentedon Jul 26, 2020
Bitte in Javascript 4.6.19 versuchen
MiGoller commentedon Jul 28, 2020
Hallo @Apollon77 .
Vielen Dank. Sieht gut aus in den Versionen 4.6.19 und auch 4.6.20: Skripte werden bislang nur einmalig bei Änderungen gestartet.
Allerdings bin ich soeben auf folgende Fehlermeldungen gestoßen, nachdem ich direkt von einem Windows Client auf die SMB-Freigabe zu ioBroker zugegriffen habe.
Ein Verzeichnis
.tmpgibt es in dem Verzeichnis/opt/iobroker/scriptsauch eben nicht. Anscheinend reagiert der FS-Watcher aber auf eine Veränderung eben dieses Verzeichnisses, was zu einem Neustart des Adapters geführt hat. Ich werde das weiter beobachten und dann Feedback geben.Danke und viele Grüße,
MiGoller
Apollon77 commentedon Jul 28, 2020
Den Fehler kann ich morgen mal noch anfangen. Das .tmp kann vllt von bestimmten file Aktionen kommen.
MiGoller commentedon Jul 28, 2020
Alles klar. Ich hatte auch schon meine
smb.confüberprüft, ob ich da irgendwelche Sonderlocken konfiguriert hatte. Das brachte allerdings auch keine Erkenntnisse.Apollon77 commentedon Jul 30, 2020
4.6.22 fixt das ... wird geloggt, muss man mal beonachten (Sag al hast Du Sentry deaktiviert oder nen js.controller <3? ... den Fehler hatte ich garnicht im Sentry bekommen)