#22680 closed defect (fixed)
[PATCH] Unexpected exception downloading from Overpass query
Reported by: | watmildon | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 23.02 |
Component: | Core | Version: | |
Keywords: | template_report | Cc: |
Description (last modified by )
What steps will reproduce the problem?
- Have some data in a layer (attached osm file)
- I was downloading this query with a bounding box of 23.8858377;-129.375;52.4827802;-62.2265625
[out:json][timeout:25]; // gather results ( // query for all cases where the various synonyms for gnis id's match nwr["tiger:PLACENS"]; ); // print results out body; >;
What is the expected result?
Data downloads and is rendered
What happens instead?
Apparently this exception!
Please provide any additional information below. Attach a screenshot if possible.
Revision:18622 Build-Date:2023-01-04 12:54:08 Identification: JOSM/1.5 (18622 en) Windows 10 64-Bit OS Build number: Windows 10 Pro 2009 (19045) Memory Usage: 3816 MB / 4088 MB (2223 MB allocated, but free) Java version: 17.0.5+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1440×2560 (scaling 1.00×1.00) \Display1 3840×2160 (scaling 1.50×1.50) Maximum Screen Size: 3840×2560 Best cursor sizes: 16×16→48×48, 32×32→48×48 System property file.encoding: Cp1252 System property sun.jnu.encoding: Cp1252 Locale info: en_US Numbers with default locale: 1234567890 -> 1234567890 VM arguments: [-Djpackage.app-version=1.5.18622, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe] Dataset consistency test: No problems found Plugins: + FastDraw (35978) + FixAddresses (36011) + apache-commons (36034) + apache-http (35924) + buildings_tools (36011) + conflation (0.6.9) + continuosDownload (105) + contourmerge (v0.1.9) + ejml (35924) + geotools (36028) + gridify (1606242219) + imagery_offset_db (35978) + jackson (36034) + jaxb (35952) + jna (36005) + jts (36004) + mapwithai (v1.10.3) + opendata (36025) + tageditor (36011) + terracer (35978) + todo (30306) + turnrestrictions (36011) + utilsplugin2 (36011) + wikipedia (605) Map paint styles: + https://josm.openstreetmap.de/josmfile?page=Styles/TigerReviewedNo&zip=1 - %UserProfile%\Address Tags Validator - Highlight unaddressed - https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/AddressValidator&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1 Last errors/warnings: - 126865.716 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=500, Error Body=<<!DOCTYPE html> - 126865.723 E: Internal Server Error - <html>The OSM server<br>'https://api.openstreetmap.org/api/0.6/'<br>reported an internal server error.<br>This is most likely a temporary problem. Please try again later.</html> - 159429.493 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=400, Error Header=<line 5: parse error: ) expected - ; found.>, Error Body=<<?xml version="1.0" encoding="UTF-8"?> - 159429.501 E: Bad Request - <html>The OSM server 'overpass-api.de' reported a bad request.<br><br>Error message(untranslated): line 5: parse error: ) expected - ; found. </html> - 159463.004 E: org.openstreetmap.josm.io.OsmApiException: ResponseCode=400, Error Header=<line 5: parse error: ) expected - ; found.>, Error Body=<<?xml version="1.0" encoding="UTF-8"?> - 159463.010 E: Bad Request - <html>The OSM server 'overpass-api.de' reported a bad request.<br><br>Error message(untranslated): line 5: parse error: ) expected - ; found. </html> - 191671.327 W: java.net.SocketException: Socket closed. Cause: java.net.SocketException: Socket closed - 191671.328 E: java.net.SocketException: Socket closed. Cause: java.net.SocketException: Socket closed - 196955.672 E: Handled by bug report queue: javax.json.JsonException: I/O error while parsing JSON. Cause: java.net.SocketTimeoutException: Read timed out - 202395.093 E: Handled by bug report queue: javax.json.JsonException: I/O error while parsing JSON. Cause: java.net.SocketTimeoutException: Read timed out === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (23) of main javax.json.JsonException: I/O error while parsing JSON at org.glassfish.json.JsonTokenizer.peek(JsonTokenizer.java:461) at org.glassfish.json.JsonTokenizer.hasNextToken(JsonTokenizer.java:443) at org.glassfish.json.JsonParserImpl.hasNext(JsonParserImpl.java:364) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:334) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getArray(JsonParserImpl.java:328) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:180) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:182) at org.glassfish.json.JsonParserImpl.getArray(JsonParserImpl.java:328) at org.glassfish.json.JsonParserImpl.getValue(JsonParserImpl.java:180) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:341) at org.glassfish.json.JsonParserImpl.getObject(JsonParserImpl.java:173) at org.openstreetmap.josm.io.OsmJsonReader.parse(OsmJsonReader.java:57) at org.openstreetmap.josm.io.OsmJsonReader.lambda$doParseDataSet$6(OsmJsonReader.java:183) at org.openstreetmap.josm.io.AbstractReader.doParseDataSet(AbstractReader.java:300) at org.openstreetmap.josm.io.OsmJsonReader.doParseDataSet(OsmJsonReader.java:181) at org.openstreetmap.josm.io.OverpassDownloadReader.parseDataSet(OverpassDownloadReader.java:394) at org.openstreetmap.josm.io.BoundingBoxDownloader.parseOsm(BoundingBoxDownloader.java:215) at org.openstreetmap.josm.io.OverpassDownloadReader.parseOsm(OverpassDownloadReader.java:400) at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.parseDataSet(DownloadOsmTask.java:469) at org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask$DownloadTask.realRun(DownloadOsmTask.java:477) 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.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.net.SocketTimeoutException: Read timed out at java.base/sun.nio.ch.NioSocketImpl.timedRead(Unknown Source) at java.base/sun.nio.ch.NioSocketImpl.implRead(Unknown Source) at java.base/sun.nio.ch.NioSocketImpl.read(Unknown Source) at java.base/sun.nio.ch.NioSocketImpl$1.read(Unknown Source) at java.base/java.net.Socket$SocketInputStream.read(Unknown Source) at java.base/sun.security.ssl.SSLSocketInputRecord.read(Unknown Source) at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(Unknown Source) at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(Unknown Source) at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(Unknown Source) at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(Unknown Source) at java.base/java.io.BufferedInputStream.fill(Unknown Source) at java.base/java.io.BufferedInputStream.read1(Unknown Source) at java.base/java.io.BufferedInputStream.read(Unknown Source) at java.base/sun.net.www.http.ChunkedInputStream.readAheadBlocking(Unknown Source) at java.base/sun.net.www.http.ChunkedInputStream.readAhead(Unknown Source) at java.base/sun.net.www.http.ChunkedInputStream.read(Unknown Source) at java.base/java.io.FilterInputStream.read(Unknown Source) at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source) at org.openstreetmap.josm.io.ProgressInputStream.read(ProgressInputStream.java:49) at java.base/java.util.zip.InflaterInputStream.fill(Unknown Source) at java.base/java.util.zip.InflaterInputStream.read(Unknown Source) at java.base/java.util.zip.GZIPInputStream.read(Unknown Source) at java.base/java.io.FilterInputStream.read(Unknown Source) at java.base/java.io.PushbackInputStream.read(Unknown Source) at java.base/sun.nio.cs.StreamDecoder.readBytes(Unknown Source) at java.base/sun.nio.cs.StreamDecoder.implRead(Unknown Source) at java.base/sun.nio.cs.StreamDecoder.read(Unknown Source) at java.base/java.io.InputStreamReader.read(Unknown Source) at org.glassfish.json.JsonTokenizer.fillBuf(JsonTokenizer.java:519) at org.glassfish.json.JsonTokenizer.peek(JsonTokenizer.java:451) ... 28 more
Attachments (2)
Change History (10)
by , 22 months ago
Attachment: | unexpectedException.zip added |
---|
comment:1 by , 22 months ago
Description: | modified (diff) |
---|
comment:2 by , 22 months ago
javax.json.JsonException: I/O error while parsing JSON
[...snip...]
Caused by: java.net.SocketTimeoutException: Read timed out
It looks like this was either due to a network issue, or the server didn't respond in time. Probably the latter, but if you have flaky internet, it could have been the former.
Anyway, it looks like we started to read the JSON, then something came along and interrupted the stream from the server, which caused a JsonException, which, since it is a runtime exception, caused us to show the bug report window.
In order to fix this, we'd probably want to do something like
-
src/org/openstreetmap/josm/io/OsmJsonReader.java
diff --git a/src/org/openstreetmap/josm/io/OsmJsonReader.java b/src/org/openstreetmap/josm/io/OsmJsonReader.java
a b 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.util.Collection; 8 9 import java.util.Map.Entry; 9 10 10 11 import javax.json.Json; 11 12 import javax.json.JsonArray; 13 import javax.json.JsonException; 12 14 import javax.json.JsonNumber; 13 15 import javax.json.JsonObject; 14 16 import javax.json.JsonString; … … 178 180 179 181 @Override 180 182 protected DataSet doParseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException { 181 return doParseDataSet(source, progressMonitor, ir -> { 182 setParser(Json.createParser(ir)); 183 parse(); 184 }); 183 try { 184 return doParseDataSet(source, progressMonitor, ir -> { 185 setParser(Json.createParser(ir)); 186 parse(); 187 }); 188 } catch (JsonException exception) { 189 if (exception.getCause() instanceof IOException) { 190 IllegalDataException ide = new IllegalDataException(exception.getCause()); 191 ide.addSuppressed(exception); 192 throw ide; 193 } else { 194 throw exception; 195 } 196 } 185 197 } 186 198 187 199 /**
I'd prefer to throw the SocketException
, since that will give a better description of what happened, but I don't have a good place to put the catch, as I am limited by the IllegalDataException
constraint. I could change the signature of the method so that it can throw an IOException
, but I don't know how many plugins that would affect.
If we do go with something like what I wrote, we might just wrap the entire JsonException
in an IllegalDataException
. Not great, since our current utils for explaining exceptions will probably just tell the user that there was a json exception, not that there was a socket exception. So the catch block would just look like throw new IllegalDataException(exception)
.
by , 22 months ago
Attachment: | 22680.patch added |
---|
comment:3 by , 22 months ago
Milestone: | → 23.02 |
---|---|
Summary: | Unexpected exception downloading from Overpass query → [PATCH] Unexpected exception downloading from Overpass query |
follow-up: 5 comment:4 by , 22 months ago
I leave it to your infinite wisdom. It was completely reproducible last night (3 times) and I can't get it to repro this morning. Thanks for taking a look!
comment:5 by , 22 months ago
Replying to watmildon:
It was completely reproducible last night (3 times) and I can't get it to repro this morning.
That isn't surprising. Either it was a connection issue for you, or other people didn't file a bug report. In any case, I was able to reproduce it in tests by have a stream that returned a character, and then errored out.
TBH, I was kind of surprised to see that JsonException
was a runtime exception. I would have expected it to be a checked exception.
Thanks for taking a look!
No problem. Thanks for reporting the ticket. I didn't see any duplicates for this either, which is surprising. I would have expected it or something like it to have been reported at least once.
comment:6 by , 22 months ago
I was doing a lot of work against the public overpass last night.. maybe it was cutting me off and this is how it gets bubbled up? hmmm.
data layer from OSM already in JOSM