Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Service Bus Relay memory leak

$
0
0

Hi.

Looks like Service bus relay has memory leak on client side when listener does not listen.

There is 1 listener, 1 client.
Client sends one way messages to listener, and if message processed channel closed, otherwise (when there is no listener) channel aborted.
This is code (message sent from timer with 1 sec delay for test purposes) of sending message function:

void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            _timer.Stop();
            Debug.WriteLine("Timer stopped");
            var channel = _cf.CreateChannel();
            try
            {
                var msg = new HeartbeatMessage
                {
                    MessageId = DateTime.UtcNow.ToString("o")
                };

                if (channel != null)
                {
                    channel.ProcessHeartbeat(msg);
                    channel.Close();
                    Debug.WriteLine("Channel closed");
                }
            }
            catch (Exception hbChannelEx)
            {
                if (channel != null)
                {
                    channel.Abort();
                    Debug.WriteLine("Channel aborted");
                }

                            }
            finally
            {
                if (channel != null)
                {
                    channel.Dispose();
                    Debug.WriteLine("Disposed");
                }
            }
             _timer.Start();
            Debug.WriteLine("Timer Started");
        }
In the code above channel created from channel factory (

_cf = newChannelFactory<IHeartbeatListenerClientChannel>("Azure_NetTcpRelayClientEndpoint");

) and used to call method ProcessHeartBeat();
If there is listener -> no exception raised-> channel closed. Otherwise channel aborted.
Next timer loop everything is repeated.

Now the problem. If there is no listener client channel aborted and memory is leaking. Look at attached screenshot below.

 Memory profiling session is here: Memory profiling session for the image above

I did experiment, created local service which implements same service Interface and redirected client to local service (via channel factory config) using BasicHttpBinding.

Same test steps, service listening, and service down. Look at this picture:

With local service no memory leak.

Bug -((




Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>