Azure/azure-event-hubs-node

Nodejs: subscriber timeout

Closed this issue · 2 comments

I am seeing this issue today. It occasionally throws following error.

/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/frames.js:54
stream.write(buffer);
^

TypeError: Cannot read property 'write' of null
at Object.frames.writeFrame (/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/frames.js:54:9)
at Connection.sendFrame (/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/connection.js:333:10)
at ReceiverLink.Link.attach (/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/link.js:108:27)
at ReceiverLink.Link._attemptReattach (/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/link.js:237:8)
at Timeout._onTimeout (/home/ubuntu/workspace/axon-winjit-bridge/node_modules/amqp10/lib/link.js:225:10)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)

--sample Code

const client = EventHubClient.fromConnectionString(connectionString);
const receiveAfterTime = Date.now() - 5000;

client.open()
.then(client.getPartitionIds.bind(client))
.then(partitionIds =>
partitionIds.map(partitionId =>
client.createReceiver('$Default', partitionId, { startAfterTime: receiveAfterTime })
.then(receiver => {
receiver.on('errorReceived', logger.error);
receiver.on('message', processEventQueue);
}).catch(logger.error)
)
).catch(logger.error);

mharj commented

I have this same issue for few days already.
Currently fails to start ~9 times out of 10 .

I resolved the issue today..

just caught the exception

process.on('uncaughtException', err => {
console.log('Caught exception: ', err);
});

It will not terminate the app. Will wait for connection to establish..