Games-and-Simulations / sc-docker

Multi-platform Version of StarCraft: Brood War in a Docker Container, ready to use for bot play simulations.
MIT License
230 stars 41 forks source link

Containers exit prematurely #86

Open cij11 opened 5 years ago

cij11 commented 5 years ago

expected behaviour

After launching scbw.play with sudo scbw.play --bots "PurpleWave" "krasi0" --headless --log_level DEBUG --log_verbose expect game to be played between bots.

actual behaviour

Game crashes with the following error message

sudo scbw.play --bots "PurpleWave" "krasi0" --headless --log_level DEBUG --log_verbose 2019-05-13 23:38:20 DEBUG docker.utils.config[9106] Trying paths: ['/home/chris/.docker/config.json', '/home/chris/.dockercfg'] 2019-05-13 23:38:20 DEBUG docker.utils.config[9106] Found file at path: /home/chris/.docker/config.json 2019-05-13 23:38:20 DEBUG docker.auth[9106] Found 'auths' section 2019-05-13 23:38:20 DEBUG docker.auth[9106] Found entry (registry='https://index.docker.io/v1/', username='chrisjolly25') 2019-05-13 23:38:20 DEBUG scbw.bot_storage[9106] checking bot in /home/chris/.scbw/bots/PurpleWave 2019-05-13 23:38:20 DEBUG scbw.bot_storage[9106] found bot in /home/chris/.scbw/bots/PurpleWave 2019-05-13 23:38:20 DEBUG scbw.bot_storage[9106] checking bot in /home/chris/.scbw/bots/krasi0 2019-05-13 23:38:20 DEBUG scbw.bot_storage[9106] found bot in /home/chris/.scbw/bots/krasi0 2019-05-13 23:38:20 DEBUG scbw.docker_utils[9106] checking docker-machine presence 2019-05-13 23:38:21 DEBUG scbw.docker_utils[9106] using docker machine version version 0.16.0, build 702c267f Error: No machine name(s) specified and no "default" machine exists 2019-05-13 23:38:21 DEBUG scbw.docker_utils[9106] docker machine not present 2019-05-13 23:38:21 DEBUG scbw.game[9106] Using vnc host 'localhost' 2019-05-13 23:38:21 DEBUG scbw.docker_utils[9106] docker_image=starcraft:game-1.0.4 command=[ '/app/play_bot.sh', '--game', 'GAME_C5E2B302', '--name', 'PurpleWave', '--race', 'P', '--lan', '--host', '--map', '/app/sc/maps/sscai/(2)Benzene.scx'] name=GAME_C5E2B302_0_PurpleWave detach=True environment={ 'BOT_BWAPI': '4.1.2', 'BOT_FILE': 'PurpleWave.jar', 'CAPTURE_MOUSE_MOVEMENT': '0', 'DROP_PLAYERS': '0', 'EXIT_CODE_REALTIME_OUTED': 2, 'GAME_NAME': 'GAME_C5E2B302', 'GAME_TYPE': 'FREE_FOR_ALL', 'HEADFUL_AUTO_LAUNCH': '0', 'HIDE_NAMES': '0', 'JAVA_DEBUG': '0', 'JAVA_DEBUG_PORT': '', 'JAVA_OPTS': '', 'MAP_NAME': '/app/sc/maps/sscai/(2)Benzene.scx', 'NTH_PLAYER': 0, 'NUM_PLAYERS': 2, 'PLAYER_NAME': 'PurpleWave', 'PLAYER_RACE': 'P', 'SPEED_OVERRIDE': 0, 'TM_ALLOW_USER_INPUT': '0', 'TM_LOG_FRAMETIMES': '../logs/frames.csv', 'TM_LOG_RESULTS': '../logs/scores.json', 'TM_SPEED_OVERRIDE': 0} privileged=True volumes={ '/home/chris/.scbw/bots/PurpleWave': {'bind': '/app/bot', 'mode': 'ro'}, '/home/chris/.scbw/bwapi-data/BWTA': { 'bind': '/app/sc/bwapi-data/BWTA', 'mode': 'rw'}, '/home/chris/.scbw/bwapi-data/BWTA2': { 'bind': '/app/sc/bwapi-data/BWTA2', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/crashes_0': { 'bind': '/app/sc/Errors', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/logs_0': { 'bind': '/app/logs', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/write_0/': { 'bind': '/app/sc/bwapi-data/write', 'mode': 'rw'}, '/home/chris/.scbw/maps': {'bind': '/app/sc/maps', 'mode': 'rw'}} network=sc_net ports={}

2019-05-13 23:38:21 INFO scbw.docker_utils[9106] launched BotPlayer:PurpleWave:P 2019-05-13 23:38:21 DEBUG scbw.docker_utils[9106] container name = 'GAME_C5E2B302_0_PurpleWave', container id = '['4c6b546351']' 2019-05-13 23:38:21 DEBUG scbw.docker_utils[9106] docker_image=starcraft:game-1.0.4 command=[ '/app/play_bot.sh', '--game', 'GAME_C5E2B302', '--name', 'krasi0', '--race', 'T', '--lan', '--join'] name=GAME_C5E2B302_1_krasi0 detach=True environment={ 'BOT_BWAPI': '4.2.0', 'BOT_FILE': 'krasi0AIClient.exe', 'CAPTURE_MOUSE_MOVEMENT': '0', 'DROP_PLAYERS': '0', 'EXIT_CODE_REALTIME_OUTED': 2, 'GAME_NAME': 'GAME_C5E2B302', 'GAME_TYPE': 'FREE_FOR_ALL', 'HEADFUL_AUTO_LAUNCH': '0', 'HIDE_NAMES': '0', 'JAVA_DEBUG': '0', 'JAVA_DEBUG_PORT': '', 'JAVA_OPTS': '', 'MAP_NAME': '/app/sc/maps/sscai/(2)Benzene.scx', 'NTH_PLAYER': 1, 'NUM_PLAYERS': 2, 'PLAYER_NAME': 'krasi0', 'PLAYER_RACE': 'T', 'SPEED_OVERRIDE': 0, 'TM_ALLOW_USER_INPUT': '0', 'TM_LOG_FRAMETIMES': '../logs/frames.csv', 'TM_LOG_RESULTS': '../logs/scores.json', 'TM_SPEED_OVERRIDE': 0} privileged=True volumes={ '/home/chris/.scbw/bots/krasi0': {'bind': '/app/bot', 'mode': 'ro'}, '/home/chris/.scbw/bwapi-data/BWTA': { 'bind': '/app/sc/bwapi-data/BWTA', 'mode': 'rw'}, '/home/chris/.scbw/bwapi-data/BWTA2': { 'bind': '/app/sc/bwapi-data/BWTA2', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/crashes_1': { 'bind': '/app/sc/Errors', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/logs_1': { 'bind': '/app/logs', 'mode': 'rw'}, '/home/chris/.scbw/games/GAME_C5E2B302/write_1/': { 'bind': '/app/sc/bwapi-data/write', 'mode': 'rw'}, '/home/chris/.scbw/maps': {'bind': '/app/sc/maps', 'mode': 'rw'}} network=sc_net ports={}

2019-05-13 23:38:22 INFO scbw.docker_utils[9106] launched BotPlayer:krasi0:T 2019-05-13 23:38:22 DEBUG scbw.docker_utils[9106] container name = 'GAME_C5E2B302_1_krasi0', container id = '['46af9c1a2c']' 2019-05-13 23:38:22 DEBUG scbw.docker_utils[9106] checking if game has launched properly... 2019-05-13 23:38:23 ERROR scbw.cli[9106] some containers exited prematurely, please check logs Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/scbw/cli.py", line 231, in main game_result = run_game(args) File "/usr/local/lib/python3.6/dist-packages/scbw/game.py", line 108, in run_game _wait_callback) File "/usr/local/lib/python3.6/dist-packages/scbw/docker_utils.py", line 378, in launch_game 'some containers exited prematurely, please check logs') scbw.error.DockerException: some containers exited prematurely, please check logs `

Checking logs of container 'GAME_C5E2B302_1_krasi0' shows:
`

[auto_menu] auto_menu = LAN pause_dbg = OFF lan_mode = Local Area Network (UDP) auto_restart = OFF map = game = GAME_C5E2B302 mapiteration = RANDOM race = Terran enemy_count = 1 enemy_race = Protoss enemy_race_1 = Default enemy_race_2 = Default enemy_race_3 = Default enemy_race_4 = Default enemy_race_5 = Default enemy_race_6 = Default enemy_race_7 = Default game_type = FREE_FOR_ALL game_type_extra = save_replay = maps/replays/GAME_C5E2B302_1.rep wait_for_min_players = 2 wait_for_max_players = 8 wait_for_time = 60000

[config] holiday = OFF shared_memory = OFF console_attach_on_startup = FALSE console_alloc_on_startup = FALSE console_attach_auto = TRUE console_alloc_auto = TRUE

[window] windowed = OFF left = 0 top = 0 width = 640 height = 480

[starcraft] sound = OFF screenshots = gif speed_override = 0 drop_players = ON

`

steps to reproduce

Install as per instructions in INSTALL.md. Create network sc_net manually to avoid issue raised here: https://github.com/Games-and-Simulations/sc-docker/issues/85

Run command sudo scbw.play --bots "PurpleWave" "krasi0" --headless --log_level DEBUG --log_verbose

operating system

Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic

docker version

Client: Version: 18.09.2 API version: 1.38 (downgraded from 1.39) Go version: go1.10.4 Git commit: 6247962 Built: Tue Feb 26 23:52:23 2019 OS/Arch: linux/amd64 Experimental: false

Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.4 Git commit: e68fc7a Built: Tue May 7 17:57:34 2019 OS/Arch: linux/amd64 Experimental: false

scbw version

1.0.4

Awesom1-Tech commented 5 years ago

same here

royjacket commented 5 years ago

You can test to add
os.chmod(log_dir, 0o777) after os.makedirs(log_dir, mode=0o777, exist_ok=True) in scbw/docker_utils.py

The mode argument of the os.makedirs function may be ignored on some systems.

cij11 commented 5 years ago

You can test to add os.chmod(log_dir, 0o777) after os.makedirs(log_dir, mode=0o777, exist_ok=True) in scbw/docker_utils.py

The mode argument of the os.makedirs function may be ignored on some systems.

Thanks for your reply.
There is no line os.makedirs(log_dir, mode=0o777, exist_ok=True) in the file scbw/docker_utils.py

There is a line os.makedirs(log_dir, mode=511, exist_ok=True), but adding os.chmod(log_dir, 0o777) after it does not change the behaviour.