Opened 4 years ago

Last modified 4 years ago

#22062 closed defect

JOSM OAuth fails: OAuthCommunicationException: Communication with the service provider failed: stream is closed. — at Version 1

Reported by: sladen Owned by: sladen
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description (last modified by taylor.smock)

Sometimes JOSM will fail to obtain and login using OAuth; JOSM appears to manage to fetch a token using OAuth, but then not succeed in using the token.

Observed here with JOSM (Debian backports) build (r17428). Any suggestions for debugging this; have seen similar things before where the GUI provides no useful information, and the stacktrace only is only marginally more enlightening:

2022-05-10 10:54:38.479 INFO: GET https://www.openstreetmap.org/oauth/request_token -> HTTP/1.1 200 (198 ms; 124 B)
2022-05-10 10:54:38.732 INFO: GET https://www.openstreetmap.org/login?cookie_test=true -> HTTP/1.1 200 (151 ms; 4.83 kB)
2022-05-10 10:54:38.755 INFO: POST https://www.openstreetmap.org/login (164 B) ...
2022-05-10 10:54:39.421 INFO: POST https://www.openstreetmap.org/login -> HTTP/1.1 302 (663 ms)
2022-05-10 10:54:39.504 INFO: GET https://www.openstreetmap.org/oauth/authorize?oauth_token=XxXxXxXxX -> HTTP/1.1 200 (81 ms; 4.15 kB)
2022-05-10 10:54:39.524 INFO: POST https://www.openstreetmap.org/oauth/authorize (318 B) ...
2022-05-10 10:54:39.608 INFO: POST https://www.openstreetmap.org/oauth/authorize -> HTTP/1.1 200 (80 ms; 3.51 kB)
2022-05-10 10:54:39.748 INFO: GET https://www.openstreetmap.org/logout -> HTTP/1.1 200 (139 ms; 3.69 kB)
2022-05-10 10:54:39.873 INFO: GET https://www.openstreetmap.org/oauth/access_token -> HTTP/1.1 401 (123 ms)
2022-05-10 10:54:39.977 SEVERE: org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed. Cause: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed. Cause: java.io.IOException: stream is closed
org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getAccessToken(OsmOAuthAuthorizationClient.java:148)
	at org.openstreetmap.josm.gui.oauth.FullyAutomaticAuthorizationUI$FullyAutomaticAuthorisationTask.realRun(FullyAutomaticAuthorizationUI.java:498)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: stream is closed
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:218)
	at oauth.signpost.AbstractOAuthProvider.retrieveAccessToken(AbstractOAuthProvider.java:108)
	at org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClient.getAccessToken(OsmOAuthAuthorizationClient.java:143)
	... 3 more
Caused by: java.io.IOException: stream is closed
	at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.ensureOpen(HttpURLConnection.java:3483)
	at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3508)
	at org.openstreetmap.josm.io.ProgressInputStream.read(ProgressInputStream.java:49)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:181)
	at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:326)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:392)
	at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:235)
	at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193)
	... 5 more

2022-05-10 10:54:40.001 SEVERE: OAuth authorisation failed - <html>The automatic process for retrieving an OAuth Access Token<br>from the OSM server failed.<br><br>Please try again or choose another kind of authorisation process,<br>i.e. semi-automatic or manual authorisation.</html>
2022-05-10 10:57:16.565 SEVERE: org.openstreetmap.josm.io.MissingOAuthAccessTokenException
org.openstreetmap.josm.io.MissingOAuthAccessTokenException
	at org.openstreetmap.josm.io.OsmConnection.addOAuthAuthorizationHeader(OsmConnection.java:149)
	at org.openstreetmap.josm.io.OsmConnection.addAuth(OsmConnection.java:184)
	at org.openstreetmap.josm.io.OsmApi.sendRequest(OsmApi.java:680)
	at org.openstreetmap.josm.io.OsmApi.sendRequest(OsmApi.java:639)
	at org.openstreetmap.josm.io.OsmApi.openChangeset(OsmApi.java:460)
	at org.openstreetmap.josm.io.OsmServerWriter.uploadOsm(OsmServerWriter.java:202)
	at org.openstreetmap.josm.gui.io.UploadPrimitivesTask.realRun(UploadPrimitivesTask.java:261)
	at org.openstreetmap.josm.gui.io.AsynchronousUploadPrimitivesTask.realRun(AsynchronousUploadPrimitivesTask.java:129)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(PleaseWaitRunnable.java:94)
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.run(PleaseWaitRunnable.java:142)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

2022-05-10 10:57:16.574 SEVERE: Authentication failed - <html>Failed to authenticate at the OSM server 'https://api.openstreetmap.org/api'.<br>You are using OAuth to authenticate but currently there is no<br>OAuth Access Token configured.<br>Please open the Preferences dialogue and generate or enter an Access Token.</html>

Change History (1)

comment:1 by taylor.smock, 4 years ago

Description: modified (diff)
Owner: changed from team to sladen
Status: newneedinfo

Can you try using the repository for Ubuntu ( wiki:Download#Ubuntu )? I'm told it works with Debian-based distributions (including Debian). This will also get you a much more up-to-date version of JOSM (r17428 (2020-12-28) -> r18427 (2022-04-04))

Whether or not it fixes your problem, can you please come back and let us know? For reference, I'm inclined to close this, since it seems to be a duplicate of #21065, which was fixed in r17972 (2021-07-09).

Note: See TracTickets for help on using tickets.