thecoder-001 / MineColab

Run Minecraft Server on Google Colab.
GNU General Public License v3.0
244 stars 58 forks source link

[BUG] Playit.gg Error: Cannot assign requested address #75

Open kazantsev-v opened 1 year ago

kazantsev-v commented 1 year ago

Playit isn't working Playit isn't working

I use playit and i get the link (playit/claim/...), but this is not working i see the bug:

2022-10-31T12:46:22.692013Z ERROR playit_agent_core::name_lookup: failed to perform hostname lookup error=Custom { kind: Uncategorized, error: "failed to lookup address information: Temporary failure in name resolution" } name=control.ply.gg:5523
2022-10-31T12:46:22.692077Z  INFO agent: loading msg=failed to connect to tunnel
kazantsev-v commented 1 year ago

After a long time, I decided to repeat the previous experience, but the miracle of history repeated itself. This error falls out no matter what you do. msedge_SE3sPZIY8Y

thecoder-001 commented 1 year ago

Hi! Sorry for the late response. You should be able to connect to the server even after the errors. At least that's what seems to be happening in my case. Still I would try to figure out if something else is going wrong, though not being able to reproduce it on my end would make it hard.

image

kazantsev-v commented 1 year ago

Thanks for the reply! Anyway, I didn't fix the error, but I was able to connect playit.gg through their plugin - https://www.spigotmc.org/resources/playit-gg.105566/ Although essentially the same, perhaps I entered something wrong, and the plugin automatically corrected my mistakes. :)

DEFYREALITY250 commented 1 year ago

Thanks for the reply! Anyway, I didn't fix the error, but I was able to connect playit.gg through their plugin - https://www.spigotmc.org/resources/playit-gg.105566/ Although essentially the same, perhaps I entered something wrong, and the plugin automatically corrected my mistakes. :)

Can confirm it does work my advice remove the last lines other than: print('Starting server...') !java $memory_allocation $server_flags -jar $jar_name nogui

I also added 10.5gb of ram all of the code is:

import os import re import json

Update the package lists

!sudo apt update &>/dev/null && echo "apt cache successfully updated" || echo "apt cache update failed, you might receive stale packages"

Install OpenJDK 17

!wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -

!sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ &>/dev/null || echo "Failed to add repo. Still can be ignored if openjdk17 gets installed."

!sudo apt-get install openjdk-17-jre-headless &>/dev/null && echo "Yay! Openjdk17 has been successfully installed." || echo "Failed to install OpenJdk17."

Perform java version check

java_ver = !java -version 2>&1 | awk -F[\".] -v OFS=. 'NR==1{print $2}' if java_ver[0] == "17" : print("Openjdk17 is working correctly, you are good to go.") else: print("Openjdk17 doesn't seems to be installed or isn't working, falling back to java", java_ver[0], ". You might experience reduced performance. Minecraft 1.17 and above might fail to launch.")

Mount Google Drive

from google.colab import drive drive.mount('/content/drive')

Change directory to the Minecraft server folder on Google Drive

%cd "/content/drive/My Drive/Minecraft-server" !ls #list the directory contents (to verify that working directory was changed)

Import config file.

if os.path.isfile("colabconfig.json"): colabconfig = json.load(open("colabconfig.json")) else: colabconfig = {"server_type": "generic"} # using default, if config doesn't exists. json.dump(colabconfig, open("colabconfig.json",'w'))

Server jar names.

jar_list = {'paper': 'server.jar', 'fabric': 'fabric-server-launch.jar', 'generic': 'server.jar'} jar_name = jar_list[colabconfig["server_type"]]

Java arguments.

if colabconfig["server_type"] == "paper": server_flags = "-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true" else: server_flags = "" # aiker's flags might negatively impact performance on non-paper servers. memory_allocation = "-Xmx10500M -Xms10500M"

print('Starting server...') !java $memory_allocation $server_flags --add-modules=jdk.incubator.vector -jar $jar_name nogui