Skip to content

Adapter process does not terminate correctly if using some 3rd party modules #1278

@raintonr

Description

@raintonr

I'm using exclusive keyboard to read input from a Bluetooth remote. This node module seems rather ill behaved and can cause the Javascript adapter to crash. Not in itself a problem with the adapter, but...

... when the adapter crashes and is restarted duplicate processes appear. Eg, crash...

2023-03-22 07:43:59.013  - error: javascript.10 (15976) An error happened which is most likely from one of your scripts, but the originating script could not be detected.
2023-03-22 07:43:59.014  - error: javascript.10 (15976) Error: Attempt to access memory outside buffer bounds
2023-03-22 07:43:59.015  - error: javascript.10 (15976) RangeError: Attempt to access memory outside buffer bounds
    at new NodeError (node:internal/errors:387:5)
    at boundsError (node:internal/buffer:84:11)
    at Buffer.readUInt16LE (node:internal/buffer:243:5)
    at parse (/opt/iobroker/node_modules/iobroker.javascript/node_modules/exclusive-keyboard/index.js:16:14)
    at ReadStream.onData (/opt/iobroker/node_modules/iobroker.javascript/node_modules/exclusive-keyboard/index.js:54:21)
    at ReadStream.emit (node:events:513:28)
    at ReadStream.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at ReadStream.Readable.push (node:internal/streams/readable:228:10)
    at node:internal/fs/streams:279:14
    at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5)

... restart...

2023-03-22 07:44:37.417  - info: host.pl stopInstance system.adapter.javascript.10 (force=false, process=true)
2023-03-22 07:44:37.476  - info: host.pl stopInstance system.adapter.javascript.10 send kill signal
2023-03-22 07:44:38.477  - info: host.pl stopInstance system.adapter.javascript.10 killing pid 15976
2023-03-22 07:44:40.650  - info: host.pl instance system.adapter.javascript.10 started with pid 3282
2023-03-22 07:44:45.278  - info: javascript.10 (3282) starting. Version 6.1.4 in /opt/iobroker/node_modules/iobroker.javascript, node: v16.19.0, js-controller: 4.0.24
2023-03-22 07:44:45.524  - info: javascript.10 (3282) requesting all states
2023-03-22 07:44:45.526  - info: javascript.10 (3282) requesting all objects
2023-03-22 07:44:47.787  - info: javascript.10 (3282) received all objects
2023-03-22 07:44:48.044  - info: javascript.10 (3282) received all states

... and yet now there are 2 processes running:

$ ps -ef | grep javascript.10 | grep -v grep
iobroker  3282  8519  3 07:44 ?        00:00:31 io.javascript.10
iobroker 15976  8519  0 Mar21 ?        00:02:07 io.javascript.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions