GwynethLlewelyn / restbot

The original project was hosted on code.google.com/p/restbot and was automatically exported to GitHub once Google shut down their own free code repository services; subsequent development is now being done here on GitHub.
Other
12 stars 2 forks source link

Massive memory leak! #8

Open GwynethLlewelyn opened 2 years ago

GwynethLlewelyn commented 2 years ago

Leaving this running for several hours will generate a major memory leak. Something is clearly missing!

This needs to be addressed before the package is ready to be shipped to NuGet.

GwynethLlewelyn commented 2 years ago

Status: Still unresolved as of today...

GwynethLlewelyn commented 2 years ago

There is a good chance that this is related to an issue of the underlying LibreMetaverse version. I think it has to do with 'new' caps errors sent by LL which LibreMetaverse does not recognise, and, by default, not knowing if they're errors or not, keeps the communications open.

However, it's clear that the SL grid is sending messages with 'InternalServerError' inside its XML container. According to what I've read, it's expected that LL's caps servers will return an 'unknown' error to tell the client that it should close the connection. Previously, it seems that SL would mostly use 404 for the error, but, because it's not, strictly speaking, a client issue, but a server issue, it looks like LL now prefers to send back a 500 when it wishes the client to close the connection.

To test this theory, I need to learn how to use the dotnet CLI to work on a fork of LibreMetaverse while still continuing to work nicely with everything else, until, eventually, a forthcoming PR to the LibreMetaverse maintainers might be accepted and the NuGet repository for it properly updated. But I'm not going to hold my breath that this happens 'soon', thus the need to experiment a bit first!

GwynethLlewelyn commented 2 years ago

A short update: I have submitted a PR to the LibreMetaverse project. It doesn't 'fix' the memory leak, but makes it a bit more manageable.

According to my (current) tests, which are not very scientific neither rigorous, it seems that RESTbot will consume around 5 to 10 MBytes per managed agent. There will be some fluctuations over time, but, thankfully, the Garbage Collector seems to keep these in check. It's better than nothing.