<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sat Jan 11 07:14:25 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[BDS-526] BDS failed to bind sockets on machines with ipv6 disabled</title>
                <link>https://bugs.mojang.com/browse/BDS-526</link>
                <project id="11700" key="BDS">Bedrock Dedicated Server</project>
                    <description>&lt;p&gt;The issue is the one reported in &lt;a href=&quot;https://bugs.mojang.com/browse/BDS-178&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://bugs.mojang.com/browse/BDS-178&lt;/a&gt;, I&apos;m adding more details here and a complement steps for reproducing it.&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;Symptoms&quot;&gt;&lt;/a&gt;Symptoms&lt;/h2&gt;

&lt;p&gt;The server starts with logs:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[2019-02-12 07:02:23 INFO] IPv4 supported, port: 0
[2019-02-12 07:02:23 INFO] IPv6 supported, port: 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;netstat -lunp
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;shows the BDS is not listening on any port.&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;StepstoReproduce&quot;&gt;&lt;/a&gt;Steps to Reproduce&lt;/h2&gt;

&lt;p&gt;I&apos;m running a Ubuntu Server 16.04 box with Parallels Desktop virtual machine on a mac. I believe the versions of all these runtime environments have no impact on this issue.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Fresh install Ubuntu box with docker installed &lt;tt&gt;apt install docker.io&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;run: &lt;tt&gt;sudo docker run -it --rm -p 19132:19132/udp roemer/bedrock-server&lt;/tt&gt; , so far everything goes fine&lt;/li&gt;
	&lt;li&gt;add &lt;tt&gt;GRUB_CMDLINE_LINUX_DEFAULT=&quot;ipv6.disable=1&quot;&lt;/tt&gt; in &lt;tt&gt;/etc/default/grub&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;run &lt;tt&gt;sudo update-grub&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;reboot&lt;/li&gt;
	&lt;li&gt;re-run &lt;tt&gt;sudo docker run -it --rm -p 19132:19132/udp roemer/bedrock-server&lt;/tt&gt; and the issue appears&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;&lt;a name=&quot;SomeClues&quot;&gt;&lt;/a&gt;Some Clues&lt;/h3&gt;

&lt;p&gt;The difference after disable ipv6 from GRUB is, the &lt;tt&gt;socket&lt;/tt&gt; system call no longer recognizes &lt;tt&gt;AF_INET6&lt;/tt&gt; any more:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ nc -6 -u -l :: 12345
nc: Address family not supported by protocol
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I did a &lt;tt&gt;strace -o trace.log -s 100 ./bedrock_server&lt;/tt&gt; and found it probably a bug in the code:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;# partial trace back on machine with ipv6 ENABLED:
socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = 8
bind(8, {sa_family=AF_INET6, sin6_port=htons(19133), inet_pton(AF_INET6, &quot;::&quot;, &amp;amp;sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = 0
...
getsockname(8, {sa_family=AF_INET6, sin6_port=htons(19133), inet_pton(AF_INET6, &quot;::&quot;, &amp;amp;sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [128-&amp;gt;28]) = 0
sendto(8, &quot;\0\0\0\0&quot;, 4, 0, {sa_family=AF_INET6, sin6_port=htons(19133), inet_pton(AF_INET6, &quot;::1&quot;, &amp;amp;sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
close(8)                                = 0
close(7)                                = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) = 7
bind(7, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr(&quot;0.0.0.0&quot;)}, 16) = 0

# partial trace back on machine with ipv6 DISABLED:
socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
...
close(7)                                = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) = 7
bind(7, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr(&quot;0.0.0.0&quot;)}, 16) = 0
... # the following traceback shows weird behavior:
socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
close(7)                                = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) = 7
bind(7, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr(&quot;0.0.0.0&quot;)}, 16) = 0
setsockopt(7, SOL_SOCKET, SO_RCVBUF, [262144], 4) = 0
setsockopt(7, SOL_SOCKET, SO_LINGER, {l_onoff=0, l_linger=0}, 8) = 0
setsockopt(7, SOL_SOCKET, SO_SNDBUF, [16384], 4) = 0
setsockopt(7, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
getsockname(7, {sa_family=AF_INET, sin_port=htons(39782), sin_addr=inet_addr(&quot;0.0.0.0&quot;)}, [128-&amp;gt;16]) = 0
setsockopt(7, SOL_IP, IP_HDRINCL, [0], 4) = -1 ENOPROTOOPT (Protocol not available)
getsockname(7, {sa_family=AF_INET, sin_port=htons(39782), sin_addr=inet_addr(&quot;0.0.0.0&quot;)}, [128-&amp;gt;16]) = 0
sendto(7, &quot;\0\0\0\0&quot;, 4, 0, {sa_family=AF_INET, sin_port=htons(39782), sin_addr=inet_addr(&quot;127.0.0.1&quot;)}, 16) = 4
socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
close(7)                                = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Looks like it&apos;s a reused variable holding the socket fd and assigned ipv4 socket fd by mistake in case of ipv6 socket is failed to be created.&lt;/p&gt;</description>
                <environment></environment>
        <key id="227571">BDS-526</key>
            <summary>BDS failed to bind sockets on machines with ipv6 disabled</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="5" iconUrl="https://bugs.mojang.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="7">Invalid</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="BananaWanted">Inactivate</reporter>
                        <labels>
                    </labels>
                <created>Tue, 12 Feb 2019 08:31:08 +0100</created>
                <updated>Mon, 10 Feb 2020 14:02:08 +0100</updated>
                            <resolved>Mon, 10 Feb 2020 11:56:08 +0100</resolved>
                                    <version>1.9.0.15</version>
                                                            <votes>1</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="631977" author="ionicecko" created="Mon, 10 Feb 2020 14:02:08 +0100"  >&lt;p&gt;Awesome Banana, thanks for confirming.&lt;/p&gt;

&lt;p&gt;It looks like this one got closed without linking to the master issue, I&apos;ll get that sorted tomorrow.&lt;/p&gt;

&lt;p&gt;Thanks again!&lt;/p&gt;</comment>
                            <comment id="631969" author="bananawanted" created="Mon, 10 Feb 2020 13:36:00 +0100"  >&lt;p&gt;Hey @IonicEcko&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I can confirm the issue still exists on the latest build, and can be reproduced with the exactly same steps described above.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I also noticed the error message printed to the console has changed to &apos;Network port occupied&apos; following the &apos;port: 0&apos; messages in the latest build. You&apos;ll be able to find a lot of similar bug reports whiches probably share the same root cause with this one.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="631811" author="ionicecko" created="Mon, 10 Feb 2020 06:11:44 +0100"  >&lt;p&gt;Hi Bananawanted,&lt;/p&gt;

&lt;p&gt;If you&apos;re experiencing the same issue as a previous bug report please up-vote the existing report and add any contributing evidence in the comments. Having multiple reports makes it hard to consolidate the information and dilutes the effectiveness of the bug tracker.&lt;/p&gt;

&lt;p&gt;Ionic&lt;/p&gt;

&lt;p&gt;Could a mod please link to &lt;a href=&quot;https://bugs.mojang.com/browse/BDS-178&quot; title=&quot; IPv4 supported,  But  port = 0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;BDS-178&quot;&gt;&lt;del&gt;BDS-178&lt;/del&gt;&lt;/a&gt; and close this issue.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="198539" name="trace_failed.log" size="667950" author="BananaWanted" created="Tue, 12 Feb 2019 08:32:04 +0100"/>
                            <attachment id="198538" name="trace_ok.log" size="688329" author="BananaWanted" created="Tue, 12 Feb 2019 08:32:04 +0100"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0xatz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>