panel icon indicating copy to clipboard operation
panel copied to clipboard

Wings Memory Issue

Open Verox001 opened this issue 1 year ago • 7 comments

Current Behavior

When letting Wings run for a few hours, the memory usage skyrockets to 23.3G. Yesterday (after letting the server run for 6 days) the memory usage had reached 80G.

sudo service wings status
● wings.service - Pterodactyl Wings Daemon
     Loaded: loaded (/etc/systemd/system/wings.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-06-04 10:39:57 CEST; 2s ago
   Main PID: 21776 (wings)
      Tasks: 18 (limit: 96471)
     Memory: 19.1M
        CPU: 91ms
     CGroup: /system.slice/wings.service
             └─21776 /usr/local/bin/wings

Expected Behavior

Wings shouldn't be using that much memory to be honest. Also, when restarting the Wings process, the memory consumption of wings seems to go down to an acceptable value, even though the host still uses up this memory, which can only be solved by a reboot.

Steps to Reproduce

Start your Wings process on Debian 12 and let it run for a few hours.

Panel Version

1.11.3

Wings Version

1.11.13

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

I'm just getting a lot of failed SFTP logins from these cyber-crimininality clients.

Is there an existing issue for this?

  • [X] I have searched the existing issues before opening this issue.
  • [X] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • [X] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.

Verox001 avatar Jun 04 '24 08:06 Verox001

sudo free -h
               total        used        free      shared  buff/cache   available
Mem:            78Gi        14Gi        39Gi       3.7Mi        24Gi        63Gi
Swap:          974Mi          0B       974Mi

Important to note is that the cache seems to be extremly high, which seems to be the cause of the high memory usage.

Verox001 avatar Jun 04 '24 08:06 Verox001

I never really paid attention to it, but now you mention it: I'm on Ubuntu 22.04 with wings 1.11.12, however I believe the last 2 commits shouldn't have effect on memory usage

● wings.service - Pterodactyl Wings Daemon
     Loaded: loaded (/etc/systemd/system/wings.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-05-03 18:38:33 UTC; 1 month 1 day ago
   Main PID: 3187774 (wings)
      Tasks: 60 (limit: 153442)
     Memory: 25.0G
        CPU: 1month 1d 1h 53min 55.118s
     CGroup: /system.slice/wings.service
             └─3187774 /usr/local/bin/wings
               total        used        free      shared  buff/cache   available
Mem:           124Gi        95Gi       1.1Gi        54Mi        28Gi        28Gi
Swap:             0B          0B          0B

Jcodeerd avatar Jun 04 '24 19:06 Jcodeerd

@Jcodeerd Okay, seems like you're having the same issue as me. I found a dirty, but effective solution: You can set MemoryMax as bytes in your service file under the [Service] tag to 10 Mb - 50 Mb, to limit the memory consumption. I set it to 50 Mb (52428800), just in case and it seems to doesn't affect Wings at all. It throttles perfectly at 50 Mb and doesn't use any more cache. You have to reload the systemctl daemon after that (systemctl daemon-reload) and reboot your server to get rid of the cache.

Of course that isn't an optimal solution and this has something to dore with Wings overall, so I'd like @matthewpi to have a look at this.

Verox001 avatar Jun 05 '24 09:06 Verox001

I appear to be having the same issue on my server, memory usage goes to 100% and so does swap, crippling my server completely until whatever is going on (likely the SFTP logins) stops, I've personally set SFTP to be on port 0 since i don't use it until this is fixed, but i think the memory max is probably better to use

Soapy7261 avatar Jul 27 '24 05:07 Soapy7261

We already checked that @Soapy7261 and it does not come from the SFTP login, but rather from the indexing of server files. The method for this is recursive and somehow, Go doesn't clear up some of the memory after each iteration, resulting in high memory usage.

Verox001 avatar Jul 27 '24 12:07 Verox001

@matthewpi can confirm, but I think this will be resolved by https://github.com/pterodactyl/wings/commit/8744e64f1d888921b6f7cac1ebacc31d86e48cd4 ?

danny6167 avatar Aug 29 '24 03:08 danny6167

After a while I think I've tracked my issue down to a tar.gz file that when unarchived in the panel somehow causes a memory leak, although I haven't done conclusive testing, or testing on anybody else's machine, either way, I just limited the memory in wings and the problem went away

Soapy7261 avatar Aug 29 '24 05:08 Soapy7261