[HanziQ] [15.6] Mac headless must be in foreground

This subforum contains all the issues which we already resolved.
Post Reply
WarmCat
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Feb 21, 2016 1:32 am
Contact:

[HanziQ] [15.6] Mac headless must be in foreground

Post by WarmCat »

Brand new install of Factorio 15.6 on a MacMini, fresh install of Sierra.
Running headless via:

Code: Select all

/Applications/factorio.app/Contents/MacOS/factorio --server-settings ~/Documents/factorio-server.json --start-server-load-latest
Factorio runs (windowless obviously) and I can connect to the server no problem with another mac.

However, if Factorio is no longer in the foreground on the server, my client will report "server not responding" and disconnect unless I bring Factorio back to the foreground on the server.

Log:

Code: Select all

   0.000 2017-05-04 08:06:51; Factorio 0.15.6 (build 29362, mac, alpha)
   0.000 Operating system: Mac OS X 10.12.4
   0.000 Program arguments: "/Applications/factorio.app" "--server-settings" "/Users/MacMini/Documents/factorio-server.json" "--start-server-load-latest" 
   0.000 Read data path: /Applications/factorio.app/Contents/data
   0.000 Write data path: /Users/MacMini/Library/Application Support/factorio
   0.000 Binaries path: /
   0.008 System info: [CPU: Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz, 4 cores, RAM: 4096MB]
   0.017 Running in headless mode
   0.029 Loading mod core 0.0.0 (data.lua)
   0.041 Loading mod base 0.15.6 (data.lua)
   0.225 Loading mod base 0.15.6 (data-updates.lua)
   0.312 Checksum for core: 3409166051
   0.312 Checksum of base: 2213884006
   0.509 Info PlayerData.cpp:55: Local player-data.json available, timestamp 1493880206
   0.509 Info PlayerData.cpp:62: Cloud player-data.json unavailable
   0.510 Custom inputs active: 0
   0.511 Info Updater.cpp:753: Downloading https://updater.factorio.com/get-available-versions?username=WarmCat&token=<private>&apiVersion=2
   1.635 0 packages available to download (experimental updates enabled).
   1.636 Factorio initialised
   1.637 Info HttpSharedState.cpp:44: Downloading https://auth.factorio.com/api-login?api_version=2
   2.365 Info HttpSharedState.cpp:111: Status code: 200
   2.365 Info AuthServerConnector.cpp:169: Got token from auth server for username(WarmCat).
   2.365 Info ServerSynchronizer.cpp:27: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   2.365 Info ServerMultiplayerManager.cpp:663: mapTick(-1) changing state from(Ready) to(PreparedToHostGame)
   2.365 Info ServerMultiplayerManager.cpp:663: mapTick(-1) changing state from(PreparedToHostGame) to(CreatingGame)
   2.365 Loading map /Users/MacMini/Library/Application Support/factorio/saves/Moo.zip: 3065209 bytes.
   2.366 Error FileUtil.cpp:291: Can't remove /Users/MacMini/Library/Application Support/factorio/temp/currently-playing: No such file or directory
   2.388 Loading Level.dat: 6076332 bytes.
   2.396 Info Scenario.cpp:133: Map version 0.15.6-0
   2.724 Loading script.dat: 190 bytes.
   2.727 Checksum for script /Users/MacMini/Library/Application Support/factorio/temp/currently-playing/control.lua: 76911248
   2.731 Info UDPSocket.cpp:27: Opening socket at (0.0.0.0:34197)
   2.732 Hosting game at 0.0.0.0:34197
   2.732 Info ServerMultiplayerManager.cpp:663: mapTick(216740) changing state from(CreatingGame) to(InGame)
   2.732 Info UDPSocket.cpp:39: Opening socket for broadcast
  35.503 ConnectionRequestReplyConfirm (type(ConnectionRequestReplyConfirm) ) from(10.0.1.186:59916)
  35.503 Info ServerRouter.cpp:389: Replying to connectionRequest for address(10.0.1.186:59916).
  35.503 Info ServerSynchronizer.cpp:521: nextHeartbeatSequenceNumber(807) adding peer(1)
  35.525 Info ServerMultiplayerManager.cpp:663: mapTick(216740) changing state from(InGame) to(InGameSavingMap)
  35.525 Info ServerMultiplayerManager.cpp:747: mapTick(216740) received stateChanged peerID(1) oldState(Ready) newState(ConnectedWaitingForMap)
  35.769 Info ServerMultiplayerManager.cpp:801: MapTick(216740) Serving map(/Users/MacMini/Library/Application Support/factorio/temp/mp-save-0.zip) for peer(1) size(3065713) crc(836575515)
  35.769 Info ServerMultiplayerManager.cpp:663: mapTick(216740) changing state from(InGameSavingMap) to(InGame)
  35.824 Info ServerMultiplayerManager.cpp:747: mapTick(216740) received stateChanged peerID(1) oldState(ConnectedWaitingForMap) newState(ConnectedDownloadingMap)
  37.520 Info ServerMultiplayerManager.cpp:747: mapTick(216740) received stateChanged peerID(1) oldState(ConnectedDownloadingMap) newState(ConnectedLoadingMap)
  37.750 Info ServerMultiplayerManager.cpp:747: mapTick(216753) received stateChanged peerID(1) oldState(ConnectedLoadingMap) newState(TryingToCatchUp)
  37.789 Info ServerMultiplayerManager.cpp:747: mapTick(216755) received stateChanged peerID(1) oldState(TryingToCatchUp) newState(WaitingForCommandToStartSendingTickClosures)
  37.790 Info GameActionHandler.cpp:3253: MapTick (216755) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect ) 
  37.882 Info ServerMultiplayerManager.cpp:747: mapTick(216761) received stateChanged peerID(1) oldState(WaitingForCommandToStartSendingTickClosures) newState(InGame)
2017-05-04 08:07:29 [JOIN] WarmCat joined the game
 277.574 Info ServerMultiplayerManager.cpp:747: mapTick(227175) received stateChanged peerID(1) oldState(InGame) newState(WaitingForUserToSaveOrQuitAfterServerLeft)
Server json:

Code: Select all

  {
  "name": "WarmCat",
  "description": "Friends",
  "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": false,
    "lan": true
  },

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

  "_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": false,

  "_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": 10,

  "_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": false,

  "_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": false,

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

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: [HanziQ] [15.6] Mac headless must be in foreground

Post by HanziQ »

This is caused by App Nap, but I cannot seem to disable it programatically for some reason, so I'll have to investigate more.

There is a workaround, you can disable app nap system wide with

Code: Select all

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES
and re-enable it with

Code: Select all

defaults delete NSGlobalDomain NSAppSleepDisabled
but it will increase your power draw/battery life.

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: [HanziQ] [15.6] Mac headless must be in foreground

Post by HanziQ »

Ok, nevermind, should be fixed in the next version.

WarmCat
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Feb 21, 2016 1:32 am
Contact:

Re: [HanziQ] [15.6] Mac headless must be in foreground

Post by WarmCat »

Tested and working awesomely :-)
Thanks, and thanks for the workaround, thats good to know.

Cheers,
WarmCat

Post Reply

Return to “Resolved Problems and Bugs”