-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
MQTTjs Version
5.5.5
Broker
Mosquitto 2.0.18
Environment
NodeJS
Description
My NestJS application works fine using MQTT.js 5.5.4, but when upgrading to 5.5.5, my connection keeps timing out.
Minimal Reproduction
I'm initializing the connection like this:
async function bootstrap() {
const logger = new Logger('main');
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
logger: ['fatal', 'error', 'warn', 'log', 'debug'],
});
const mqttUrl = app.get(ConfigService).get('MQTT_URL', 'mqtt://localhost:1883');
logger.log(`Connecting to MQTT broker at ${mqttUrl}`);
app.connectMicroservice<MicroserviceOptions>({
transport: Transport.MQTT,
options: { url: mqttUrl },
});
await app.startAllMicroservices();
await app.listen(3000);
}
bootstrap();There is nothing fancy I do here. The NestJS application keeps logging that it has restarted microservices every 96 seconds.
Debug logs
mosquitto-1 | 1715423490: New connection from 10.180.1.202:44188 on port 1883.
mosquitto-1 | 1715423490: New client connected from 10.180.1.202:44188 as mqttjs_617bdbe8 (p2, c1, k60).
mosquitto-1 | 1715423492: New connection from 10.180.1.202:44202 on port 1883.
mosquitto-1 | 1715423492: New client connected from 10.180.1.202:44202 as mqttjs_60b2f9b7 (p2, c1, k60).
mosquitto-1 | 1715423506: New connection from 127.0.0.1:53642 on port 1883.
mosquitto-1 | 1715423506: New client connected from 127.0.0.1:53642 as auto-FE0B77F7-6E76-B46C-635B-B0A5F2C34FBD (p2, c1, k60).
mosquitto-1 | 1715423506: Client auto-FE0B77F7-6E76-B46C-635B-B0A5F2C34FBD disconnected.
mosquitto-1 | 1715423536: New connection from 127.0.0.1:33478 on port 1883.
mosquitto-1 | 1715423536: New client connected from 127.0.0.1:33478 as auto-C2035B25-9FC2-7088-6DC1-C3B4995410A7 (p2, c1, k60).
mosquitto-1 | 1715423536: Client auto-C2035B25-9FC2-7088-6DC1-C3B4995410A7 disconnected.
mosquitto-1 | 1715423567: New connection from 127.0.0.1:38178 on port 1883.
mosquitto-1 | 1715423567: New client connected from 127.0.0.1:38178 as auto-5DB0DCCF-5B57-0577-0542-963CA2D6A0F1 (p2, c1, k60).
mosquitto-1 | 1715423567: Client auto-5DB0DCCF-5B57-0577-0542-963CA2D6A0F1 disconnected.
mosquitto-1 | 1715423583: Client mqttjs_617bdbe8 has exceeded timeout, disconnecting.
mosquitto-1 | 1715423587: New connection from 10.180.1.202:44287 on port 1883.
mosquitto-1 | 1715423587: New client connected from 10.180.1.202:44287 as mqttjs_617bdbe8 (p2, c1, k60).
mosquitto-1 | 1715423597: New connection from 127.0.0.1:53002 on port 1883.
mosquitto-1 | 1715423597: New client connected from 127.0.0.1:53002 as auto-6816911E-2532-1858-621A-08EA78769C57 (p2, c1, k60).
mosquitto-1 | 1715423597: Client auto-6816911E-2532-1858-621A-08EA78769C57 disconnected.
mosquitto-1 | 1715423627: New connection from 127.0.0.1:48890 on port 1883.
mosquitto-1 | 1715423627: New client connected from 127.0.0.1:48890 as auto-E7D347CF-6216-3948-C8D8-38E16D41B524 (p2, c1, k60).
mosquitto-1 | 1715423627: Client auto-E7D347CF-6216-3948-C8D8-38E16D41B524 disconnected.
mosquitto-1 | 1715423657: New connection from 127.0.0.1:51206 on port 1883.
mosquitto-1 | 1715423657: New client connected from 127.0.0.1:51206 as auto-4E212B57-53B7-FD6F-7FEE-01E0BB937C42 (p2, c1, k60).
mosquitto-1 | 1715423657: Client auto-4E212B57-53B7-FD6F-7FEE-01E0BB937C42 disconnected.
mosquitto-1 | 1715423679: Client mqttjs_617bdbe8 has exceeded timeout, disconnecting.
mosquitto-1 | 1715423683: New connection from 10.180.1.202:44465 on port 1883.
mosquitto-1 | 1715423683: New client connected from 10.180.1.202:44465 as mqttjs_617bdbe8 (p2, c1, k60).
mosquitto-1 | 1715423687: New connection from 127.0.0.1:49510 on port 1883.
mosquitto-1 | 1715423687: New client connected from 127.0.0.1:49510 as auto-8FA15F68-DCA0-1B05-50D7-207B0A57578C (p2, c1, k60).
mosquitto-1 | 1715423687: Client auto-8FA15F68-DCA0-1B05-50D7-207B0A57578C disconnected.
mosquitto-1 | 1715423718: New connection from 127.0.0.1:33114 on port 1883.
mosquitto-1 | 1715423718: New client connected from 127.0.0.1:33114 as auto-B7659D45-6F73-E0FC-F234-009037976EAD (p2, c1, k60).
mosquitto-1 | 1715423718: Client auto-B7659D45-6F73-E0FC-F234-009037976EAD disconnected.
It's the Client mqttjs_XXXXXXXX has exceeded timeout, disconnecting. that signals the problem.