matterbridge 3.4.2-dev-20251204-a39ec9e → 3.4.2-dev-20251204-5a2b977
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/dist/matterbridge.js +14 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,16 @@ Advantages:
|
|
|
30
30
|
|
|
31
31
|
## [3.4.2] - 2025-12-??
|
|
32
32
|
|
|
33
|
+
### Race condition
|
|
34
|
+
|
|
35
|
+
We have a race condition when, after a blackout or with docker compose or with other systems that start more then one process, Matterbridge starts before other required system or network components.
|
|
36
|
+
|
|
37
|
+
Race condition can cause missing configuration or missed devices on the controller side. All Matterbridge official plugins already wait for system and network components to be ready so there is no need of delay.
|
|
38
|
+
|
|
39
|
+
To solve the race condition on blackout, use the --delay parameter. There is no delay on normal restart.
|
|
40
|
+
|
|
41
|
+
To solve the race condition on docker compose, use the --fixed_delay parameter. The start will always be delayed.
|
|
42
|
+
|
|
33
43
|
### Added
|
|
34
44
|
|
|
35
45
|
- [frontend]: Added throttle and timeout to autoScroll in the logs.
|
|
@@ -37,7 +47,8 @@ Advantages:
|
|
|
37
47
|
- [frontend]: Added close on success to Install dialog.
|
|
38
48
|
- [BroadcastServer]: Added check for port closed.
|
|
39
49
|
- [platform]: Added isShuttingDown property to MatterbridgePlatform.
|
|
40
|
-
- [delay]: Added --delay [seconds]. It will wait to start Matterbridge for the specified delay (default 2 minutes) if the system uptime is less then 5 minutes. It is a safe switch to avoid race conditions on start.
|
|
50
|
+
- [delay]: Added --delay [seconds]. It will wait to start Matterbridge for the specified delay (default 2 minutes) if the system uptime is less then 5 minutes. It is a safe switch to avoid race conditions on start after a blackout.
|
|
51
|
+
- [fixed_delay]: Added --fixed_delay [seconds]. It will wait to start Matterbridge for the specified delay (default 2 minutes). It is a safe switch to always avoid race conditions on start on docker compose. Use only if really needed cause it will always wait.
|
|
41
52
|
|
|
42
53
|
### Changed
|
|
43
54
|
|
package/dist/matterbridge.js
CHANGED
|
@@ -19,7 +19,6 @@ import { copyDirectory } from './utils/copyDirectory.js';
|
|
|
19
19
|
import { createDirectory } from './utils/createDirectory.js';
|
|
20
20
|
import { isValidString, parseVersionString, isValidNumber, isValidObject } from './utils/isvalid.js';
|
|
21
21
|
import { formatBytes, formatPercent, formatUptime } from './utils/format.js';
|
|
22
|
-
import { withTimeout, waiter, wait } from './utils/wait.js';
|
|
23
22
|
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_NAME, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, typ } from './matterbridgeTypes.js';
|
|
24
23
|
import { PluginManager } from './pluginManager.js';
|
|
25
24
|
import { DeviceManager } from './deviceManager.js';
|
|
@@ -121,7 +120,6 @@ export class Matterbridge extends EventEmitter {
|
|
|
121
120
|
aggregatorUniqueId = getParameter('uniqueId');
|
|
122
121
|
advertisingNodes = new Map();
|
|
123
122
|
server;
|
|
124
|
-
debug = hasParameter('debug') || hasParameter('verbose');
|
|
125
123
|
verbose = hasParameter('verbose');
|
|
126
124
|
constructor() {
|
|
127
125
|
super();
|
|
@@ -654,10 +652,17 @@ export class Matterbridge extends EventEmitter {
|
|
|
654
652
|
await this.nodeContext?.set('bridgeMode', 'bridge');
|
|
655
653
|
}
|
|
656
654
|
if (hasParameter('delay') && os.uptime() <= 60 * 5) {
|
|
655
|
+
const { wait } = await import('./utils/wait.js');
|
|
657
656
|
const delay = getIntParameter('delay') || 2000;
|
|
658
|
-
this.log.warn('Delay switch found with system uptime less
|
|
657
|
+
this.log.warn('Delay switch found with system uptime less then 5 minutes. Waiting for ' + delay + ' seconds before starting matterbridge...');
|
|
659
658
|
await wait(delay * 1000, 'Race condition delay', true);
|
|
660
659
|
}
|
|
660
|
+
if (hasParameter('fixed_delay')) {
|
|
661
|
+
const { wait } = await import('./utils/wait.js');
|
|
662
|
+
const delay = getIntParameter('fixed_delay') || 2000;
|
|
663
|
+
this.log.warn('Fixed delay switch found. Waiting for ' + delay + ' seconds before starting matterbridge...');
|
|
664
|
+
await wait(delay * 1000, 'Fixed race condition delay', true);
|
|
665
|
+
}
|
|
661
666
|
if (hasParameter('bridge') || (!hasParameter('childbridge') && (await this.nodeContext?.get('bridgeMode', '')) === 'bridge')) {
|
|
662
667
|
this.bridgeMode = 'bridge';
|
|
663
668
|
this.log.debug(`Starting matterbridge in mode ${this.bridgeMode}`);
|
|
@@ -928,6 +933,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
928
933
|
await this.cleanup('updating...', false);
|
|
929
934
|
}
|
|
930
935
|
async unregisterAndShutdownProcess(timeout = 1000) {
|
|
936
|
+
const { wait } = await import('./utils/wait.js');
|
|
931
937
|
this.log.info('Unregistering all devices and shutting down...');
|
|
932
938
|
for (const plugin of this.plugins.array()) {
|
|
933
939
|
if (plugin.error || !plugin.enabled)
|
|
@@ -990,6 +996,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
990
996
|
}
|
|
991
997
|
this.log.notice(`Stopping matter server nodes in ${this.bridgeMode} mode...`);
|
|
992
998
|
if (pause > 0) {
|
|
999
|
+
const { wait } = await import('./utils/wait.js');
|
|
993
1000
|
this.log.debug(`Waiting ${pause}ms for the MessageExchange to finish...`);
|
|
994
1001
|
await wait(pause, `Waiting ${pause}ms for the MessageExchange to finish...`, false);
|
|
995
1002
|
}
|
|
@@ -1206,6 +1213,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1206
1213
|
async startChildbridge(delay = 1000) {
|
|
1207
1214
|
if (!this.matterStorageManager)
|
|
1208
1215
|
throw new Error('No storage manager initialized');
|
|
1216
|
+
const { wait } = await import('./utils/wait.js');
|
|
1209
1217
|
this.log.debug('Loading all plugins in childbridge mode...');
|
|
1210
1218
|
await this.startPlugins(true, false);
|
|
1211
1219
|
this.log.debug('Creating server nodes for DynamicPlatform plugins and starting all plugins in childbridge mode...');
|
|
@@ -1507,6 +1515,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1507
1515
|
await matterServerNode.start();
|
|
1508
1516
|
}
|
|
1509
1517
|
async stopServerNode(matterServerNode, timeout = 30000) {
|
|
1518
|
+
const { withTimeout } = await import('./utils/wait.js');
|
|
1510
1519
|
if (!matterServerNode)
|
|
1511
1520
|
return;
|
|
1512
1521
|
this.log.notice(`Closing ${matterServerNode.id} server node`);
|
|
@@ -1558,6 +1567,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1558
1567
|
}
|
|
1559
1568
|
}
|
|
1560
1569
|
async addBridgedEndpoint(pluginName, device) {
|
|
1570
|
+
const { waiter } = await import('./utils/wait.js');
|
|
1561
1571
|
const plugin = this.plugins.get(pluginName);
|
|
1562
1572
|
if (!plugin) {
|
|
1563
1573
|
this.log.error(`Error adding bridged endpoint ${dev}${device.deviceName}${er} (${zb}${device.id}${er}) plugin ${plg}${pluginName}${er} not found`);
|
|
@@ -1695,6 +1705,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1695
1705
|
this.devices.remove(device);
|
|
1696
1706
|
}
|
|
1697
1707
|
async removeAllBridgedEndpoints(pluginName, delay = 0) {
|
|
1708
|
+
const { wait } = await import('./utils/wait.js');
|
|
1698
1709
|
this.log.debug(`Removing all bridged endpoints for plugin ${plg}${pluginName}${db}${delay > 0 ? ` with delay ${delay} ms` : ''}`);
|
|
1699
1710
|
for (const device of this.devices.array().filter((device) => device.plugin === pluginName)) {
|
|
1700
1711
|
await this.removeBridgedEndpoint(pluginName, device);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.4.2-dev-20251204-
|
|
3
|
+
"version": "3.4.2-dev-20251204-5a2b977",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.4.2-dev-20251204-
|
|
9
|
+
"version": "3.4.2-dev-20251204-5a2b977",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.6",
|
package/package.json
CHANGED