Headless std::bad_alloc error

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
pofigismo
Burner Inserter
Burner Inserter
Posts: 16
Joined: Mon Mar 21, 2016 7:16 am
Contact:

Headless std::bad_alloc error

Post by pofigismo »

I have 2 factorio servers running and everything is perfectly fine normally, but after i disconnect for a long time and try to connect back in - the server stops working with the following: (this happens consistently on both servers and has happened before when i had only one)

Code: Select all

2017-01-02 21:02:50 [COMMAND] Penguin (command): game.server_save()
14950.103 Info AppManager.cpp:237: Saving game as /factorio/saves/0.14_trirat_map.zip
14952.662 Info ServerMultiplayerManager.cpp:822: Disconnect notification for peer (4)
14952.662 Info ServerMultiplayerManager.cpp:742: mapTick(3506818) received stateChanged peerID(4) oldState(InGame) newState(DisconnectScheduled)
14952.681 Info ServerSynchronizer.cpp:539: nextHeartbeatSequenceNumber(391253) removing peer(4).
68622.684 Error Util.cpp:57: std::bad_alloc
68622.873 Info ServerMultiplayerManager.cpp:115: Disconnecting multiplayer connection.
68622.873 Info ServerMultiplayerManager.cpp:658: mapTick(3506820) changing state from(InGame) to(DisconnectingScheduled)
68622.884 Info ServerMultiplayerManager.cpp:139: Quitting multiplayer connection.
68622.884 Info ServerMultiplayerManager.cpp:658: mapTick(-1) changing state from(DisconnectingScheduled) to(Closed)
Now from what I understand it failed to allocate memory. Most likely for the map save before sending it to me when i tried to connect. What i don't understand is why. I'm running a debian machine, factorio server is on its own factorio user and it has ownership of "/factorio/*". All of the permissions in /factorio/* on all files are set to chmod 774 and the server was clearly able to save the map before i disconnected. Sooo... at this point im straight up confused at what's the issue here. Am I missing something or is this to be reported as a potential bug?

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Headless std::bad_alloc error

Post by posila »

pofigismo wrote:Now from what I understand it failed to allocate memory. Most likely for the map save before sending it to me when i tried to connect. What i don't understand is why.
It depends. How much memory does your server have? Does it happen only if you disconnect for long time? Is "pause server when nobody is connected" disabled?

pofigismo
Burner Inserter
Burner Inserter
Posts: 16
Joined: Mon Mar 21, 2016 7:16 am
Contact:

Re: Headless std::bad_alloc error

Post by pofigismo »

posila wrote:
pofigismo wrote:Now from what I understand it failed to allocate memory. Most likely for the map save before sending it to me when i tried to connect. What i don't understand is why.
It depends. How much memory does your server have? Does it happen only if you disconnect for long time? Is "pause server when nobody is connected" disabled?
Hard drive space:

Code: Select all

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md0p1      440G   30G  388G   8% /
RAM:

Code: Select all

top - 00:53:18 up 120 days, 11:39,  2 users,  load average: 0.00, 0.01, 0.05
Tasks:  99 total,   1 running,  98 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  16406788 total,  3153208 used, 13253580 free,   197452 buffers
KiB Swap: 19775976 total,        0 used, 19775976 free.  2444392 cached Mem
So I have plenty of both.
Server is set to automatically pause and this only happens after a long time. I just checked and it works just fine if i connect, then disconnect and reconnect right away - this only happens after a long time of being disconnected.

edit:
Here's the config file:

Code: Select all

cat server-settings-trirat.json
{
  "name": "Penguin",
  "description": "Penguin's server.",
  "tags": ["game", "tags"],

  "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
  "max_players": 0,

  "_comment_visibility": ["public: Game will be published on the official Factorio matching server",
                          "lan: Game will be broadcast on LAN"],
  "visibility":
  {
    "public": true,
    "lan": true
  },

  "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
  "username": "",
  "password": "",

  "_comment_token": "Authentication token. May be used instead of 'password' above.",
  "token": "",

  "game_password": "",

  "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
  "require_user_verification": true,

  "_comment_max_upload_in_kilobytes_per_second" : "optional, default value is 0. 0 means unlimited.",
  "max_upload_in_kilobytes_per_second": 0,

  "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.",
  "minimum_latency_in_ticks": 0,

  "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
  "ignore_player_limit_for_returning_players": false,

  "_comment_allow_commands": "possible values are, true, false and admins-only",
  "allow_commands": "admins-only",

  "_comment_autosave_interval": "Autosave interval in minutes",
  "autosave_interval": 4,

  "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
  "autosave_slots": 5,

  "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
  "afk_autokick_interval": 0,

  "_comment_auto_pause": "Whether should the server be paused when no players are present.",
  "auto_pause": true,

  "only_admins_can_pause_the_game": true,

  "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
  "autosave_only_on_server": true,

  "_comment_admins": "List of case insensitive usernames, that will be promoted immediately",
  "admins": ["Penguin"]
}

Post Reply

Return to “Technical Help”