proton-j: transport lifecycle

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

proton-j: transport lifecycle

Garlapati Sreeram Kumar
Hello All!

I am from Microsoft Azure EventHubs team & our javaclient depends on proton-j for Amqp.

We use Reactor API’s to implement the client and also have built a connection Retry mechanism on top of this – which is running great! Recently, we ran into a Memory leak of byte[]’s which are held by Reactor (actually, zombie instances of ConnectionImpl aka TransportImpl) and am trying to understand who owns cleaning up TransportImpl objects (unbind from Connection and free its resources) while using Reactor APIs - in these 3 scenarios after the Connection is already bound to Transport:

  1.  When the remote peer sends detach frame on the connection – with error (for ex: “connection-force-detached”), reactor invokes onConnectionRemoteClose() handler.
  2.  When the local peer want to send the Close frame <-- in this scenario – reactor/proton performs cleanup and removes the ConnectionImpl object from the Reactor Children set.
  3.  On temporary n/w loss scenario (we see onTransportError event), reactor invokes the onTransportError handler.

In cases (1) and (3) – it looks like – we need to invoke event.getTransport().unbind() explicitly – upon the respective event-handlers:
https://github.com/Azure/azure-event-hubs-java/blob/fix.connLeak/azure-eventhubs/src/main/java/com/microsoft/azure/servicebus/amqp/ConnectionHandler.java#L101

I am trying to make sure that this understanding is Correct & expected, and not a slip-off from proton/reactor code-base (as almost everyone using this framework might run into this issue 😊).

Any help is much appreciated!
Sreeram