mono / mono

Mono open source ECMA CLI, C# and .NET implementation.
https://www.mono-project.com
Other
11.09k stars 3.82k forks source link

Memory leak in mono 6.0.0.313 for delegates with target that are passed to native code #15751

Closed MattL0 closed 5 years ago

MattL0 commented 5 years ago

Hi,

I have tested the 6.x.x.x preview a couple of time. ( first time at 6.0.0.171, and there was already this memory leak!)

I know 5.0.1.34 has been a ''nightmare', and you have my empathy ! I believe you had to push this version as the stable one, under the circumstances

But here , i use mono to run Homeseer. So Homeseer is completely dependent of mono to run.

Before 6.x.x.x the HOMESEER process was not eating memory like this before. after 1 hour , it was more like 130-140 mo. And could eat 250-275 mo after 1.5-2 days. There was already a small leak on mono 5.x.x.x (70-80mb/day), but it was nothing compared to now.

I did run my install of HomeSeer on windows for testing , and there is no memory leak at all. Homeseer officially support Linux via mono

So, now it ( the memory) just keep raising, How can i track this down?

Thanks Capture

MattL0 commented 5 years ago

Capture

MattL0 commented 5 years ago

Capture

I am sending every 20 mins via mqtt, HOMESEER memory usage to Nodered dashboard ui.

mono

MattL0 commented 5 years ago

Here I have downgraded to the VS build mono 5.18.1.28.

will post again tomorrow . I need to restart the pc now... But will let it run for the night Capture

MattL0 commented 5 years ago

Capture

as you can see, there seems to be a memory leak on 5.18.1.28, but not as big as on mono 6.0.0.313

MattL0 commented 5 years ago

Anyone? there must have been a change in mono 6 x.x.x.x concerning memory? This is with the exact same setup. If I know what changed, maybe i can transfer the info the the Homeseer plugin developer... and then..they can adapt with the new requirement of mono 6.0? thanks

marek-safar commented 5 years ago

There has been a lot of changes for that reason it's not trivial to confirm this. Could you share with some any repro we could use to see the memory leak?

MattL0 commented 5 years ago

Hi @marek-safar , I have prepared a Virtual machine for your with vm ware.

Installed mono 6.0.0.313.

Loaded my config on it but removed as much as i can my personal info. I have loaded a 30 days trial with it.

  1. Run it on vmware ( you can acess via ssh)

  2. username : root

  3. password : 1234567

  4. cd /HomeSeer

    1. then run ./HSConsole.exe --log ( if you close this homeseer will close ( you can add a systemd service, but you won't see the detailed log like that )
  5. to access the web interface go to your navigator : Machine_ip:88

Do you have an email I can send the link to ?

MattL0 commented 5 years ago

The link is now ready. I just uploaded it. Just need an email address to sent it to you.

BrzVlad commented 5 years ago

@MattL0 I could take a look at this. vlbrez@microsoft.com

MattL0 commented 5 years ago

Thanks @BrzVlad Sent you the link via email .

MattL0 commented 5 years ago

Hi thanks a lot for this !

Please see the hsconsole.exe memory consumption .

  1. ( 4 hours runtime and 232m) I have tested mono 6.0.0.319 binary ( precompiled with llvm I think) and it still leaks. htop

  2. (18 hours runtime and 156m) I have compiled mono 6.7 ( without llvm compilation since i was not able to use it see : https://github.com/mono/mono/issues/16099) yesterday and it does not leak. I think it is leaking but way less. This is something that was present in mono 5.x.x.x.

htop2

Mono JIT compiler version 6.7.0 (master/b52830cf112 Fri 09 Aug 2019 04:58:30 PM EDT) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug Interpreter: yes LLVM: supported, not enabled. Suspend: hybrid GC: sgen (concurrent by default)

Would it be possible to test the Virtual machine again?

thanks.

MattL0 commented 5 years ago

@BrzVlad

MattL0 commented 5 years ago

@marek-safar @BrzVlad please reopen.

Thanks

ghost commented 5 years ago

While @ MattL0 is moving I am watching. the 6.7.0.99 nightly build worked nearly perfect. I upgrade to .105 and the nightly build was not allowing the z-wave module to function (could not turn on/off devices).

MattL0 commented 5 years ago

Why is this issue closed ? Thanks

BrzVlad commented 5 years ago

I ran the repro for almost two days and I didn't see any unreasonable increases in memory consumption / leaks.

The small leak is fixed by https://github.com/mono/mono/commit/e49be5b9ec63e526d6bec04a957cbe48753b651b

MattL0 commented 5 years ago

Thanks @BrzVlad