Failed to allocate memory from system heap except my server has 3GB memory left.

General help and assistance forum.
Post Reply
IoI_xD
New User
Posts: 5
Joined: Sat Nov 27, 2021 11:51 pm

Failed to allocate memory from system heap except my server has 3GB memory left.

#1

Post by IoI_xD » Sun Nov 28, 2021 12:02 am

I downloaded `zandronum-server` to my Debian bullseye VPS, which has four cores from an AMD EPYC CPU and 8gb ram. (full neofetch is avaliable here: https://www.toptal.com/developers/haste ... duzelezeqe) I'm also using the default, generated `zandronum.ini`.

And I am unable to start up the server due to memory errors.

Code: Select all

gavin@debian-4gb-hel1-1 ~/doom [255]> zandronum-server -port 2100 -iwad DOOM2.wad +deathmatch 1 +sv_hostname "i shit my pants" +sv_updatemaster True +sv_cheats True
Zandronum 3.0 - 170901-1140 - SDL version
Compiled on Sep  1 2017

M_LoadDefaults: Load system defaults.
Gameinfo scan took 0 ms
Failed to allocate memory from system heap
As if the shell would make a difference, I tried using bash, to no avail. I've confirmed that I am kernel version 5.10, but I got this when I was accidentally on 4.19 as well. And I find it very unlikely that a server for a game from 1994, even if it's a modern source port, can't at least start up with 3GB ram remaining, but when I compiled it from source (and got the same error), I decided to remove the error message forcefully, and I got...this.

Code: Select all

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Again, `free -m` reports 3GB avaliable.

Code: Select all

root@debian-4gb-hel1-1 ~/S/z/z/buildserver (default)# free -m
              total        used        free      shared  buff/cache   available
Mem:           7788        4218        1593          43        1977        3238
Swap:             0           0           0
I am at a loss for why this would be erroring out. What could possibly be wrong?

IoI_xD
New User
Posts: 5
Joined: Sat Nov 27, 2021 11:51 pm

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#2

Post by IoI_xD » Sat Feb 26, 2022 12:03 am

Decided to come back to this after a few months, I spent almost an hour typing my findings and then the site logged me out and I lost everything. I will summarize everything here:

[*] I compiled with -DCMAKE_BUILD_TYPE=Debug and used gdb to get some debug information.
[*] Simply launching the program with start got me this:

Code: Select all

Starting program: /root/Sources/zandronum_build/zandronum/buildserver/zandronum-server 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff6516700 (LWP 4431)]
[Thread 0x7ffff6516700 (LWP 4431) exited]
[Inferior 1 (process 4426) exited with code 0377]
[*] I couldn't get a stack trace for some reason, all I got was "No stack."
[*] So I did the next best thing and stepped through the program's start up process, and found the exact function that tripped things up.

Code: Select all

272		Args = new DArgs(argc, argv);
DObject::operator new (len=56) at /root/Sources/zandronum_build/zandronum/src/./dobject.h:496
496			return M_Malloc(len);
M_Malloc_Dbg (size=56, 
    file=0x555555da8e48 "/root/Sources/zandronum_build/zandronum/src/./dobject.h", lineno=496)
    at /root/Sources/zandronum_build/zandronum/src/m_alloc.cpp:135
135		void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
[New Thread 0x7ffff6516700 (LWP 6696)]
[Thread 0x7ffff6516700 (LWP 6696) exited]
[Inferior 1 (process 6544) exited with code 0377]
[*] I confirmed that what I was compiling was 64-bit, it can definitely see more then 4GB.
[*] I created a 10GB swapfile to rule out the possibilty that it is geniunely running out of memory.
[*] I tried running somebody else's Docker container and got the same error.

I've never had to debug a program in this way before, so if please tell me if there are ways in which I can provide more useful information.

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#3

Post by Torr Samaho » Sun Feb 27, 2022 8:44 pm

This looks really strange. The server shouldn't try to allocate so much memory when just starting up on some map from DOOM2.wad. Did you try running the flatpak version of Zandronum 3.1?

IoI_xD
New User
Posts: 5
Joined: Sat Nov 27, 2021 11:51 pm

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#4

Post by IoI_xD » Fri Mar 04, 2022 2:41 am

Torr Samaho wrote:
Sun Feb 27, 2022 8:44 pm
This looks really strange. The server shouldn't try to allocate so much memory when just starting up on some map from DOOM2.wad. Did you try running the flatpak version of Zandronum 3.1?
Hi, sorry I took a long time to respond.

It seems that the server version is not on Flatpak (and given that I tried a docker image, I'm not sure how this would help).
Eonfge wrote:
Mon Sep 23, 2019 9:34 am
Hi all,

Today I can announce that I've packaged Zandronum + Doomseeker for Flatpak:
...
[*] It's only the client. Server is not included because Flatpak is less suited for that

User avatar
Torr Samaho
Lead Developer
Posts: 1543
Joined: Fri May 25, 2012 6:03 pm
Location: Germany

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#5

Post by Torr Samaho » Sun Mar 20, 2022 8:37 pm

IoI_xD wrote:
Fri Mar 04, 2022 2:41 am
It seems that the server version is not on Flatpak
If the client is started with "zandronum -host" is should go into server mode. Would be worth a try.
IoI_xD wrote:
Fri Mar 04, 2022 2:41 am
(and given that I tried a docker image, I'm not sure how this would help).
That is indeed strange. So the docker image works for somebody else, but not for you?

IoI_xD
New User
Posts: 5
Joined: Sat Nov 27, 2021 11:51 pm

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#6

Post by IoI_xD » Sat Jun 04, 2022 12:51 am

Hi, again very sorry for the late response, I should likely be checking this site more, though perhaps we could also talk about this in the Discord (I check that more often then forums these days)?

First of all, I came back to say that I actually ended up needed to switch servers anyways and ended up getting an entirely different distro (Ubuntu 22.04 LTS, instead of Debian 11) and encountered the exact same error. I'm curious to know what Linux distro this IS tested on, if any?

Furthermore, I actually launched it without any wads in /home/.zandronum. So it's actually crashing before it even loads a wad.
Torr Samaho wrote:
Sun Mar 20, 2022 8:37 pm
If the client is started with "zandronum -host" is should go into server mode. Would be worth a try.

Code: Select all

gavin@ubuntu-4gb-hel1-3:~$ zandronum -host
/usr/games/zandronum/zandronum: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
gavin@ubuntu-4gb-hel1-3:~$ 
The VPS I'm using doesn't have a graphics card, unless you count "00:02.0 Vendor 1234 Device 1111" as one.
That is indeed strange. So the docker image works for somebody else, but not for you?
Yep, I spun up another one (this one to be precise, I can't even pull the one on hub.docker.com without getting a "manifest unknown" error). Same error.

IoI_xD
New User
Posts: 5
Joined: Sat Nov 27, 2021 11:51 pm

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#7

Post by IoI_xD » Sun Jun 26, 2022 4:25 am

I got it!!! I finally got it!!!
...on another server that happens to have a graphics card shown to the operating system.

I have no proof that this is relevant but given the other error that I was given, my best guess as to what's happening is that the zandronum server (...despite being headless...) at least needs a GPU presented to Linux in order to at least start up.

So to anyone else having this problem...yeah just get another provider or server, sorry. The server definitely worked on the servers I rented from Linode, you could try them.

User avatar
Sean
IRC Operator
Posts: 951
Joined: Thu Jan 16, 2014 9:09 pm
Location: United Kingdom
Contact:

Re: Failed to allocate memory from system heap except my server has 3GB memory left.

#8

Post by Sean » Mon Jun 27, 2022 4:54 am

IoI_xD wrote:
Sun Jun 26, 2022 4:25 am
I got it!!! I finally got it!!!
...on another server that happens to have a graphics card shown to the operating system.

I have no proof that this is relevant but given the other error that I was given, my best guess as to what's happening is that the zandronum server (...despite being headless...) at least needs a GPU presented to Linux in order to at least start up.

So to anyone else having this problem...yeah just get another provider or server, sorry. The server definitely worked on the servers I rented from Linode, you could try them.
Client builds are linked against graphics-related libraries and as such they are required to launch, even if you're launching it in host mode where they won't actually be used. You could probably just install Mesa's libGL and libGLU to launch it in this case. The server-only zandronum-server builds are not linked against these libraries and should work without.
<capodecima> i dont say any more word without my loyer jenova

Post Reply