Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] javascript.0 terminated with code NaN

    NEWS

    • Monatsrückblick – September 2025

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    [gelöst] javascript.0 terminated with code NaN

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      senior1418 last edited by senior1418

      Node.js : v14.19.0
      js-controller 3.3.22
      Javascript v5.2.21

      Zur Simulation sollten alle 2 Sekunden Werte im Bereich 400 - 450 bzw. 14000 - 16000 geschrieben werden.

      2f01afc4-20bf-4285-9a91-79aedc548743-image.png
      Code dazu :

      var bool, Intervall, Intervall2;
      
      function mathRandomInt(a, b) {
       if (a > b) {
         // Swap a and b to ensure a is smaller.
         var c = a;
         a = b;
         b = c;
       }
       return Math.floor(Math.random() * (b - a + 1) + a);
      }
      
      
      while (!bool) {
       if (getState("0_userdata.0.Testsystem.Boolean").val) {
         Intervall = setInterval(async function () {
           setState("0_userdata.0.Testsystem.Number"/*Number*/, (mathRandomInt(400, 450)));
           console.log(getState("0_userdata.0.Testsystem.Number").val);
         }, 2000);
       } else {
         Intervall2 = setInterval(async function () {
           setState("0_userdata.0.Testsystem.Number"/*Number*/, (mathRandomInt(14500, 16000)));
           console.log(getState("0_userdata.0.Testsystem.Number").val);
         }, 2000);
       }
      }
      

      Das führt aber wiederholbar zu m Absturz der JavaScript Instanz.

      2022-02-19 08:07:04.443 - info: javascript.0 (1401) Start javascript script.js.Strom.Durchlauferhitzer.demo
      2022-02-19 08:08:07.750 - error: host.iobroker-test Caught by controller[0]: <--- Last few GCs --->
      2022-02-19 08:08:07.753 - error: host.iobroker-test Caught by controller[0]: [1401:0x5781770] 837893 ms: Mark-sweep (reduce) 2051.6 (2058.5) -> 2051.5 (2059.2) MB, 3538.5 / 0.0 ms (average mu = 0.079, current mu = 0.001) allocation failure scavenge might not succeed
      2022-02-19 08:08:07.753 - error: host.iobroker-test Caught by controller[0]: [1401:0x5781770] 841439 ms: Mark-sweep (reduce) 2052.5 (2056.2) -> 2052.4 (2058.2) MB, 3543.4 / 0.0 ms (average mu = 0.041, current mu = 0.001) allocation failure scavenge might not succeed
      2022-02-19 08:08:07.753 - error: host.iobroker-test Caught by controller[0]: <--- JS stacktrace --->
      2022-02-19 08:08:07.754 - error: host.iobroker-test Caught by controller[0]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
      2022-02-19 08:08:07.754 - error: host.iobroker-test Caught by controller[1]: 1: 0xa389b0 node::Abort() [io.javascript.0]
      2022-02-19 08:08:07.754 - error: host.iobroker-test Caught by controller[2]: 2: 0x96e0af node::FatalError(char const*, char const*) [io.javascript.0]
      2022-02-19 08:08:07.754 - error: host.iobroker-test Caught by controller[3]: 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [io.javascript.0]
      2022-02-19 08:08:07.754 - error: host.iobroker-test Caught by controller[4]: 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [io.javascript.0]
      2022-02-19 08:08:07.755 - error: host.iobroker-test Caught by controller[5]: 5: 0xd73fd5 [io.javascript.0]
      2022-02-19 08:08:07.755 - error: host.iobroker-test Caught by controller[6]: 6: 0xd74b5f [io.javascript.0]
      2022-02-19 08:08:07.755 - error: host.iobroker-test Caught by controller[7]: 7: 0xd8299b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [io.javascript.0]
      2022-02-19 08:08:07.755 - error: host.iobroker-test Caught by controller[8]: 8: 0xd8655c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [io.javascript.0]
      2022-02-19 08:08:07.755 - error: host.iobroker-test Caught by controller[9]: 9: 0xd54c3b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [io.javascript.0]
      2022-02-19 08:08:07.756 - error: host.iobroker-test Caught by controller[10]: 10: 0x109d21f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [io.javascript.0]
      2022-02-19 08:08:07.756 - error: host.iobroker-test Caught by controller[11]: 11: 0x1446379 [io.javascript.0]
      2022-02-19 08:08:07.756 - warn: host.iobroker-test instance system.adapter.javascript.0 terminated due to SIGABRT
      2022-02-19 08:08:07.756 - info: host.iobroker-test instance system.adapter.javascript.0 terminated with code NaN ()
      2022-02-19 08:08:07.756 - info: host.iobroker-test Restart adapter system.adapter.javascript.0 because enabled
      

      Könnte mir bitte jemand sagen wie ich das besser machen kann. Vielen Dank !

      Asgothian 1 Reply Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @senior1418 last edited by Asgothian

        @senior1418
        Was besser machen …

        • Das ‘wiederhole solange’ weg.
        • um das ‘falls Wert’ einen Baustein aus dem trigger Bereich legen, trigger auf den gleichen datenpunkt, wurde geändert
        • vor dem falls noch ein ‘anhalten intervall’ und ein ‘anhalten intervall2’ und es sollte gut aussehen.

        A.

        S 1 Reply Last reply Reply Quote 0
        • S
          senior1418 @Asgothian last edited by

          @asgothian

          vielen Dank, so läuft das. Per Schleife immer neue Intervalle zu erzeugen bringen das Fass zum überlaufen.

          .. glaube ich hab's 🙂

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          Support us

          ioBroker
          Community Adapters
          Donate

          948
          Online

          32.1k
          Users

          80.7k
          Topics

          1.3m
          Posts

          blockly
          2
          3
          171
          Loading More Posts
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes
          Reply
          • Reply as topic
          Log in to reply
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
          The ioBroker Community 2014-2023
          logo