Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11409 closed defect (fixed)

josm on with ipv6 enabled system only opens remote control ports on ipv6

Reported by: flohoff Owned by: team
Priority: normal Milestone: 15.05
Component: Core remotecontrol Version:
Keywords: template_report remote control ipv6 regression Cc: Don-vip, bastiK

Description

What steps will reproduce the problem?

Yesterday i upgraded to the latest josm and since then my remote control does not work anymore.

flo@p2:~$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Josm also says on startup that it opens ipv6 sockets:

INFO: RemoteControl::Accepting connections on localhost/0:0:0:0:0:0:0:1:8111
INFO: RemoteControl::Accepting secure connections on localhost/0:0:0:0:0:0:0:1:8112

I can confirm that it only listens on an ipv6 socket:

flo@p2:~$ sudo netstat -tlnp | egrep "8111|8112"
tcp6 0 0 ::1:8111 :::* LISTEN 22674/java
tcp6 0 0 ::1:8112 :::* LISTEN 22674/java

telnet confirms the binding:

flo@p2:~$ telnet localhost 8111
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
flo@p2:~$ telnet ::1 8111
Trying ::1...
Connected to ::1.
Escape character is ']'.
]close

telnet> close
Connection closed.

Please provide any additional information below. Attach a screenshot if possible.

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2015-05-04 21:53:02
Last Changed Author: Don-vip
Revision: 8327
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Relative URL: ^/trunk
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2015-05-04 23:48:52 +0200 (Mon, 04 May 2015)
Last Changed Rev: 8327

Identification: JOSM/1.5 (8327 en) Linux Debian GNU/Linux 7.8 (wheezy)
Memory Usage: 397 MB / 910 MB (290 MB allocated, but free)
Java version: 1.7.0_65, Oracle Corporation, OpenJDK 64-Bit Server VM
Java package: openjdk-7-jre:amd64-7u71-2.5.3-2~deb7u1

Plugins:
- RoadSigns (30977)
- Tracer2 (30984)
- buildings_tools (31100)
- kendzi3d-jogl (37)
- kendzi3d_Improved_by_Andrei (1.0.179-SNAPSHOT)
- log4j (30892)
- measurement (30892)
- reverter (30990)
- terracer (30892)
- turnlanes (30892)
- turnrestrictions (31034)
- utilsplugin2 (31072)

Attachments (0)

Change History (16)

comment:1 Changed 5 years ago by stoecker

Cc: Don-vip bastiK added

There are two issues here:

Please answer the first one:

  • Why is this a problem? Are there services directly referencing 127.0.0.1? If yes, contact them and tell them to use "localhost" instead.

Second for developers:

  • Why does Java only listen to the IPv6 address? It seems it sets IPV6_V6ONLY=1 option, which normally should be 0 under Linux (even if that is not true for Windows anyway).

Java IPv6 is a pain in the ass.

You can disable this behaviour with "prefer.ipv6=false" in expert settings.

comment:2 Changed 5 years ago by stoecker

Resolution: fixed
Status: newclosed

In 8337/josm:

remotecontrol listens on IPv4 and IPv6 separately, fix #11409

comment:3 Changed 5 years ago by stoecker

Please check if it works. Also don't forget point one, if someone uses 127.0.0.1 in web pages it must be fixed.

comment:4 Changed 5 years ago by stoecker

Milestone: 15.05
Resolution: fixed
Status: closedreopened

Sorry, does not really work. access() blocks, so we need individual threads for each socket. Don't have time for this now, Anyone else?

comment:5 Changed 5 years ago by flohoff

On a default Debian/Wheezy localhost does not resolv to anything ipv6ish - localhost resolves to 127.0.0.1 ONLY.

flo@p2:~$ grep localhost /etc/hosts
127.0.0.1 localhost
::1 ip6-localhost ip6-loopback

So replacing 127.0.0.1 to localhost on ANY user of the remote control won't solve this problem. Josm needs to make the remote control ports be true dual stack.

I solved it by setting remotecontrol.host.name or something to localhost which i only found by looking through the code. As localhost only resolves to a ipv4 address the socket will be ipv4.

Flo

comment:6 Changed 5 years ago by Don-vip

We know for quite some time now that ipv6 support in openjdk7 is poor, I think we should not try to make it work before switching to openjdk8. Not a guarantee that it will work better, but at least we'll have a single implementation to understand.

comment:7 Changed 5 years ago by Don-vip

Ticket #11410 has been marked as a duplicate of this ticket.

comment:8 Changed 5 years ago by Don-vip

Keywords: ipv6 regression added

comment:9 in reply to:  1 ; Changed 5 years ago by Don-vip

Replying to stoecker:

  • Why does Java only listen to the IPv6 address? It seems it sets IPV6_V6ONLY=1 option, which normally should be 0 under Linux (even if that is not true for Windows anyway).

http://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/index.html

The Java networking stack first checks whether IPv6 is supported on the underlying OS. If IPv6 is supported, it tries to use the IPv6 stack. More specifically, on dual-stack systems, it creates an IPv6 socket. On separate-stack systems things are much more complicated. The Java runtime creates two sockets, one for IPv4 and one for IPv6 communication. For client-side TCP applications, once the socket is connected, the Internet-protocol family type is fixed, and the extra socket can be closed. For server-side TCP applications, because there is no way to tell from which IP family type the next client request will come, two sockets need to be maintained.

JOSM is by default run with a JVM in client mode, thus it would explain this behaviour. It would be interesting to test it in server mode (java -server -jar josm.jar) to check it.

comment:10 Changed 5 years ago by bastiK

What can we do to get this ready for a tested version in, like, a day or two? Which changeset has caused the regression (if it is one)?

comment:11 Changed 5 years ago by stoecker

Ticket #11412 has been marked as a duplicate of this ticket.

comment:12 in reply to:  10 Changed 5 years ago by stoecker

Replying to bastiK:

What can we do to get this ready for a tested version in, like, a day or two? Which changeset has caused the regression (if it is one)?

I'll try to fix it this evening.

comment:13 in reply to:  9 Changed 5 years ago by stoecker

Replying to Don-vip:

Replying to stoecker:

  • Why does Java only listen to the IPv6 address? It seems it sets IPV6_V6ONLY=1 option, which normally should be 0 under Linux (even if that is not true for Windows anyway).

http://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/index.html

I don't see or believe Java 8 has any real improvements. It's still broken by design as long as they stick to their strange understanding of downwards compatibility.

comment:14 Changed 5 years ago by stoecker

Resolution: fixed
Status: reopenedclosed

In 8339/josm:

fix #11409 - Remotecontrol on IPv6 and IPv4

comment:15 Changed 5 years ago by stoecker

Please report results.

comment:16 Changed 5 years ago by stoecker

In 8340/josm:

#see #11409 - small design improvement

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.