Service object leak

We use the Remoting SDK Server, ApplicationServer to create a number microservices. However, we recently noticed there was a resource leak with each API call in our service. Slowly eliminating elements of our code, didn’t resolve the leaks.

So a whole new project with very few modifications was created - essentially this is a RemObjects template. The only change was to expose the API using the HttpApiDispatcher - to enable standard RESTful clients like “Advanced REST Client” and “NestJS” as shown below:

    public static IHostBuilder CreateHostBuilder(string[] args)
    {

        return Host.CreateDefaultBuilder(args)
            .ConfigureServices((hostContext, services) =>
            {
            })
            .UseApplicationServer(configuration =>
            {
                configuration.ApplicationName = "Test";
                configuration.RodlNamespace = "Test";

                // Auto-generate the traffic encryption certificate on startup
                configuration.SelfSignedCertificate.GenerateOnStartup = false;
            })
            .UseNetworkServer(server =>
            {
                var channel = new IpHttpServerChannel();
                channel.HttpServer.ServerName = "Test";
                server.ServerChannel = channel;
                server.Port = 9199;
                server.ApiDispatcher = new HttpApiDispatcher();
                server.ApiDispatcher.ApiHost = "localhost";
                server.UseTLS = false;
            })
            .UseConsoleLifetime();

    }

This is using the latest RemObjects stable Remoting SDK (10.0.0.1555). The default exposed method just capitalizes the input text.

After issuing a number of initial API calls, I waited a couple minutes, then took a memory snapshot.

At this point memory utilization seemed to be stable, so 5 more API requests were issued, and then a new memory snapshot was taken. This reported 5 new Service objects in memory. Then when examining the full list of Service objects, it reported a fairly large list (i.e. likely one for each API call issued).

I repeated the API call and the collection of Service objects grew to 200…

Any idea why these Service objects aren’t being released?

Hi,

Can you share the whole project, pls?
you can drop it to support@ for keeping privacy

Hi Evgeny,

No privacy issues, since it’s just a stock default application, but corporate policy prevents file uploads to protect IP.

I’m sending the project now.

Tim

1 Like

Hi,

try to use code like

        public static void Main(string[] args)
        {
            ApplicationServer server = new ApplicationServer("Test");
            server.NetworkServer.ServerChannel = new IpHttpServerChannel();
            server.NetworkServer.Port = 9199;
            server.NetworkServer.ApiDispatcher = new HttpApiDispatcher();
            server.NetworkServer.ApiDispatcher.ApiHost = "localhost";
            server.NetworkServer.UseTLS = false;
            server.Run(args);
        }