I am getting this error when destroying producer or consumer

I started getting this error:

Channel request handler with ID 4138db5f-e1df-4a99-b088-9ca19e740546 not found [method:producer.getStats]

or
Channel request handler with ID 4138db5f-e1df-4a99-b088-9ca19e740546 not found [method:transport.getStats]

or
Channel request handler with ID 892363bf-230c-4744-a704-5b0a03b17b10 not found [method:consumer.getStats]

anyone knows why?

when I debugged the code Transport object still exists then when I called trasport.close(), then right after that I get the error mentioned above for the transport case

Obviously because your code keeps calling producer.gerStats() after closing the producer or its parent transport or its parent router.

what do you mean with “transport object still exists”? Of course it exists if you hold it in a variable. Things don’t auto destroy in JavaScript, the transport is just an object. The fact that you call close() on it doesn’t mean that it magically disappears. So please don’t try to go that way. Your code is calling producer.getStats() after closing the producer. That’s all.

true I have intervals that keeps checking the health of producer and consumer, but they are cleared right before my code reach the transport.close()

The error is:

Channel request handler with ID 4138db5f-e1df-4a99-b088-9ca19e740546 not found [method:producer.getStats]

It literally means that you are calling producer.gerStats() on a closed producer. So just recheck your code. There is no magic here.

1 Like

Instead of doing the clean-up before calling by hand to the close() method, do the calling ot the close event, this way it will be clean-up no matter how way the object gets clossed.