Skip to content

[Bug]: File mirroring triggers multiple script executions #2467

Open

Description

@ManniDerLibero

I'm sure that

  • This issue is still present in the current beta version of this adapter
  • There is no other (open) issue with the same topic (use the search!)
  • This issue is not described in the adapter documentation / FAQ (read the docs!)

Script type

JavaScript, Blockly (did not test the other ones)

The problem

Steps to reproduce:

  1. Enable “Mirror scripts to file path”.
  2. Create and enable a JavaScript script named JsScript in the web editor:
    log("Changed by javascript website", "warn");
  3. Save. The message appears once.
  4. Open the mirrored file through the filesystem.
  5. Change its content to:
    log("Changed by file", "warn");
  6. Save the file.

Actual behavior:
The message appears multiple times. Debug logs show multiple “Update script … in DB” entries and repeated script starts for a single save. With long-running scripts, concurrent executions have also been observed.

Expected behavior:
One restart per saved change, with only one active execution of the script.

Adapter version: 10.4.4
Possibly related: #598, #905

The underlying cause has not yet been verified.

iobroker.current.log (in debug mode!)

11/20/2026, 10:15:41 AM.113 [debug]: javascript.0 (128677) Script history: stored version 1795166141100 of script.js.scripts.test.JsScript (29 kept)
11/20/2026, 10:15:41 AM.116 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: Stopping script
11/20/2026, 10:15:41 AM.125 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: start JavaScript (Javascript/js)
11/20/2026, 10:15:41 AM.128 [warn ]: javascript.0 (128677) script.js.scripts.test.JsScript: Änderung mit javascript-website
11/20/2026, 10:15:41 AM.128 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
11/20/2026, 10:15:53 AM.953 [debug]: javascript.0 (128677) Update script script.js.scripts.test.JsScript in DB
11/20/2026, 10:15:53 AM.955 [debug]: javascript.0 (128677) Update script script.js.scripts.test.JsScript in DB
11/20/2026, 10:15:53 AM.960 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: Stopping script
11/20/2026, 10:15:53 AM.963 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: start JavaScript (Javascript/js)
11/20/2026, 10:15:53 AM.964 [warn ]: javascript.0 (128677) script.js.scripts.test.JsScript: Änderung mit file change
11/20/2026, 10:15:53 AM.964 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
11/20/2026, 10:15:53 AM.965 [debug]: javascript.0 (128677) Script history: stored version 1795166153959 of script.js.scripts.test.JsScript (30 kept)
11/20/2026, 10:15:53 AM.965 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: Stopping script
11/20/2026, 10:15:54 AM.009 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: start JavaScript (Javascript/js)
11/20/2026, 10:15:54 AM.010 [warn ]: javascript.0 (128677) script.js.scripts.test.JsScript: Änderung mit file change
11/20/2026, 10:15:54 AM.010 [info ]: javascript.0 (128677) script.js.scripts.test.JsScript: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions

Version of nodejs

v24.22.3

Version of ioBroker js-controller

7.2.5

Version of adapter

v10.4.4

Activity

  1. GermanBluefox commented on Nov 21, 2026

    @GermanBluefox
    Contributor

    Thanks for the detailed report. The mirror reacts to every single fs.watch event immediately. Many editors save a file in several steps (truncate + write, or temp file + rename), so one save fires several events. The first one probably reads an intermediate content and updates the DB, and the second one updates it again with the final content. Each update restarts the script.

    The fix will be to debounce file changes per file, so that one save leads to one update and one restart. A PR will follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions