ioBroker / ioBroker.javascript

Script engine for JavaScript and Blockly
MIT License
320 stars 119 forks source link

two or more instances with different versions will force restarting each other using TS as a global script #1464

Open volkerrichert opened 6 months ago

volkerrichert commented 6 months ago

Describe the bug
I have two instances, accidentally with different minor version (7.5.1 <-> 7.5.0). This will force the adapter to restart after compiling a global TS , because it will change the souceHash.

To Reproduce
Steps to reproduce the behavior:

  1. install 2 instances. One 7.5.0 and one 7.5.1
  2. create a global Typescript
  3. (re)start one of them

Expected behavior
I'd like to see a warning during start of the older instance that there is a version miss match and not being started.

Screenshots & Logfiles

javascript.0 | 18295 | 2023-12-20 10:13:31.638 | info | Stop script script.js.Licht.Badezimmer
-- | -- | -- | -- | --
javascript.0 | 18295 | 2023-12-20 10:13:31.634 | warn | Restart initiated
javascript.0 | 18295 | 2023-12-20 10:13:31.633 | info | Global Script script.js.global.icon_mapping updated. Restart instance.
javascript.2 | 832217 | 2023-12-20 10:13:30.564 | info | script.js.global.e3dc: TypeScript compilation successful
javascript.2 | 832217 | 2023-12-20 10:13:29.743 | info | script.js.global.e3dc: compiling TypeScript source...
javascript.2 | 832217 | 2023-12-20 10:13:26.424 | info | script.js.global.icon_mapping: TypeScript compilation successful
javascript.2 | 832217 | 2023-12-20 10:13:22.174 | info | script.js.global.icon_mapping: compiling TypeScript source...
javascript.2 | 832217 | 2023-12-20 10:13:21.712 | info | received all objects
javascript.2 | 832217 | 2023-12-20 10:13:14.259 | info | received all states
javascript.2 | 832217 | 2023-12-20 10:13:08.295 | info | requesting all objects
javascript.2 | 832217 | 2023-12-20 10:13:08.294 | info | requesting all states
javascript.2 | 832217 | 2023-12-20 10:13:08.158 | info | starting. Version 7.5.1 in /opt/iobroker/node_modules/iobroker.javascript, node: v18.16.0, js-controller: 5.0.16
Diginix commented 6 months ago

How is it possible to have adapter instances with different versions? One adapter can only be installed in exactly one version. It isn't possible to have two versions of the same adapter. Where do you see that you have different versions for the instances?

volkerrichert commented 6 months ago

if you have them on different systems in a master / slave environment, you can have on updated but not the other one

Diginix commented 6 months ago

Yeah, ok with master slave it is possible. I guess the restart is not related to different versions and would also happen if both instances were the same and on the same host. I'm using global blockly scripts but have only one javascript instance. You could test if javascript.1 or .3 on the master will be also restarted if you change a global TS script on javascript.0 Then we would know whether the master/slave or different version aspect is relevant.

volkerrichert commented 6 months ago

They generate different hashes, so the other ist forced to restart 

Ilovegym66 commented 5 months ago

here the same, 3 instances, nspanel-scripts (icons.ts in global) are installed on instance 0, all 3 instances are restarting permanently. System Docker buanet V9.0.1 Node 18.19.0, NPM 10.2.3, js-controller 5.0.19, Admin 6.13.16, Multihost Master on Synology1. System Docker buanet V9.0.1 Node 18.19.0, NPM 10.2.3, js-controller 5.0.19, Admin 6.13.16, Multihost Slave on Synology2. System Proxmox LXC Debian Bookworm, Node 20, NPM 10.2.4, js-controller 5.0.19, Admin 6.13.16, Multihost Slave. Adapter back to 7.7.0 everything is fine and running quiet...

Ilovegym66 commented 4 months ago

Small update: I stopped all 3 instances on the 3 hosts, updated to 7.8.0 on every host, start a upload (for safety) on every host, than start the adapter first on the multihost master, wait if everything is running, than the next etc... Now Version 7.8.0 is working with the global typescript.