View Issue Details

IDProjectCategoryView StatusLast Update
0005745unrealircdpublic2020-08-29 15:07
ReporterNoXPhasma Assigned Tosyzop  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformVPSOSDebian 
Product Version5.0.6 
Fixed in Version5.0.7-rc1 
Summary0005745: Memory leak and constant rehashing of certificates
Descriptionunrealircd 5 reloads my TLS certificate every minute and raises used memory usage every time without giving it free. The usage goes up to over 400MB until it gets killed by OOM. It's a pretty small server (less than 10 users) and unrealircd 4 never exceed 10 MB memory usage.

There is no cronjob or anything the like running, to force a reload of the certificate, the server does it on it's own.
Steps To ReproduceStart the server and wait.
TagsNo tags attached.
3rd party modules

Activities

NoXPhasma

2020-08-24 16:41

reporter  

log.txt (3,346 bytes)

syzop

2020-08-24 17:31

administrator   ~0021720

Thanks for the report, I will of course look into the memory leak, this sounds easy to reproduce and investigate.

I don't think anyone else is reloading the tls certificates every minute, though, and well.. as you mentioned on IRC, clearly you did not intend to do this either.
Thing is: UnrealIRCd will never do this by itself. This can only be caused by a cron job or some other process (not the unrealircd daemon itself).
The only thing that is clear is that SOME process is sending SIGUSR1 (signal 10) to the unrealircd process. Privilege-wise that can only be done by the 'root' user or the 'irc' user.
Hope you can track that down, because.. even when this memory leak is fixed, it is still not really desirable to reload the TLS certificates every minute.

NoXPhasma

2020-08-24 18:11

reporter   ~0021722

There is only one cronjob running for root, which is for the certificate update, which also reloads the cert in unrealircd, and that runs only once a month. Well at least I thought it would, but apparently I miss configured that and it was indeed running each minute. This was the case for almost forever and never caused an issue in unrealircd 4.

So you are right and just because of my mistake I found this memory leak and thanks again for pointing out that root user has to be the cause, as this lead to find the wrong cronjob on my side.

syzop

2020-08-24 18:31

administrator   ~0021723

Glad you found it!
I'll let you know once the memory leak issue has been fixed, we don't want any memory leaks in UnrealIRCd, even if they are rare. Probably won't be within the next few weeks though.

syzop

2020-08-29 15:07

administrator   ~0021727

Fixed, thanks for the report!

commit fea252206747d06e6d6bcdd28851676731ee4f1d (HEAD -> unreal50, origin/unreal50)
Author: Bram Matthys <syzop@vulnscan.org>
Date: Sat Aug 29 15:05:41 2020 +0200

    Fix memory leak on './unrealircd reloadtls' / '/REHASH -tls'
    Reported by NoXPhasma in https://bugs.unrealircd.org/view.php?id=5745

https://github.com/unrealircd/unrealircd/commit/fea252206747d06e6d6bcdd28851676731ee4f1d

Issue History

Date Modified Username Field Change
2020-08-24 16:41 NoXPhasma New Issue
2020-08-24 16:41 NoXPhasma File Added: log.txt
2020-08-24 17:31 syzop Note Added: 0021720
2020-08-24 17:31 syzop Assigned To => syzop
2020-08-24 17:31 syzop Status new => acknowledged
2020-08-24 18:11 NoXPhasma Note Added: 0021722
2020-08-24 18:31 syzop Note Added: 0021723
2020-08-29 15:07 syzop Status acknowledged => resolved
2020-08-29 15:07 syzop Resolution open => fixed
2020-08-29 15:07 syzop Fixed in Version => 5.0.7-rc1
2020-08-29 15:07 syzop Note Added: 0021727