Unable to download mojang.jar on an IPv6-only server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
I expected the server to spin up normally.
Observed/Actual behavior
When the server has an IPv4 address that doesn't actually route to the internet, it just hangs.
Upon removing the IPv4 address, the server immediately crashes.
$ java -jar /opt/server.jar
Downloading mojang_1.21.11.jar
Failed to download mojang_1.21.11.jar
at java.base/sun.nio.ch.Net.connect(Net.java:589)
at java.base/sun.nio.ch.Net.connect(Net.java:578)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:583)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:751)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304)
at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:181)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:183)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:531)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:636)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:377)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1257)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1143)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1705)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1629)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
at java.base/java.net.URL.openStream(URL.java:1325)
at io.papermc.paperclip.DownloadContext.download(DownloadContext.java:55)
at io.papermc.paperclip.Paperclip.setupClasspath(Paperclip.java:63)
at io.papermc.paperclip.Paperclip.main(Paperclip.java:28)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.papermc.paperclip.Main.main(Main.java:26)
Steps/models to reproduce
- Spin up a Linux VM/VPS/whatever with IPv6 connectivity
- Ensure no IPv4 connectivity (this maybe done by checking ips
ip aand deleting any IPv4 addresses, e.g.ip addr del 123.123.123.123/32 dev <DEVICE>) java -jar paper.jar
Plugin and Datapack List
(none yet)
Paper version
I cannot run /version as the server is not coming up.
1.21.11 build #74
Other
The server from the official Minecraft Server Download link (which is currently hosted at piston-data.mojang.com) can be downloaded just fine as it does have an IPv6 address, it's just the .jar itself that doesn't seem to like that.
More and more providers (both internet providers and Cloud/VPS providers) charge non-negligeable amounts of money for an IPv4 address, and most Cloud platforms don't provide free NAT either.
Paper does not even show where it's downloading the server from, and it does not show where it expects the server to be. Ideally, I would like to be able to disallow any outgoing/un-established internet connections for better security.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing io.papermc.paperclip.DownloadContext.download and Paperclip.setupClasspath, which appear in the stack trace, to identify the download endpoint and connection behavior. Reproduce the startup path on an IPv6-only server and verify that the required mojang_1.21.11.jar downloads and the server starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100