Opened 17 years ago
Closed 14 years ago
#2439 closed defect (invalid)
JOSM crashed after long time work with WMS.
| Reported by: | fatbozz | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core imagery | Version: | latest |
| Keywords: | WMS, message box, crash | Cc: |
Description
JOSM display some warning box, which i cant read, because is transparent. I cant close it too. Enter is call more exceptions ( 2nd ex ). Message box is stealing focus. Only way is minimize and maximize programs from ?? task bar ?? (line beside start :) )
I suspect WMS plugin, because lot of time x many WMS tiles can cause crash. I have set -Xmx to 1350M and JAVA is now consuming 1G in Swap.
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.SwingUtilities.computeIntersection(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at wmsplugin.WMSLayer.downloadAndPaintVisible(WMSLayer.java:171)
at wmsplugin.WMSLayer.paint(WMSLayer.java:156)
at org.openstreetmap.josm.gui.MapView.paint(MapView.java:275)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
at wmsplugin.WMSLayer.downloadAndPaintVisible(WMSLayer.java:171)
at wmsplugin.WMSLayer.paint(WMSLayer.java:156)
at org.openstreetmap.josm.gui.MapView.paint(MapView.java:275)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.SwingUtilities.computeIntersection(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Attachments (1)
Change History (13)
by , 17 years ago
comment:1 by , 17 years ago
Message box isnt movable, when i want to move from center, everytime is returned into center position
comment:2 by , 16 years ago
seems this code is not reentrant...:
| (bmaxy - bminy > day)){ |
165 JOptionPane.showMessageDialog(Main.parent, tr("The requested area is too big. Please zoom in a little, or change resolution"));
166 return;
167 }
add this at the top of the class:
protected boolean inDownloadAndPaintVisible = false;
then this between line 164, 165 and 166:
| (bmaxy - bminy > day)){ |
if (inDownloadAndPaintVisible) {
return;
}
inDownloadAndPaintVisible = true;
165 JOptionPane.showMessageDialog(...
inDownloadAndPaintVisible = false;
166 return;
167 }
However, it may even be wise to do this at the beginning of paint() instead...
protected boolean inPaint = false;
...
@Override public void paint(Graphics g, final MapView mv) {
_if (inPaint) {
return;
_}
_inPaint = true;
_try {
...
_} finally {
inPaint = false;
_}
}
comment:3 by , 16 years ago
(fixed linefeeds)
protected boolean inDownloadAndPaintVisible = false;
| (bmaxy - bminy > day)){ |
if (inDownloadAndPaintVisible) {
return;
}
inDownloadAndPaintVisible = true;
165 JOptionPane.showMessageDialog(...
inDownloadAndPaintVisible = false;
166 return;
167 }
*
protected boolean inPaint = false;
...
@Override public void paint(Graphics g, final MapView mv) {
_if (inPaint) {
return;
_}
_inPaint = true;
_try {
...
_} finally {
inPaint = false;
_}
}
comment:4 by , 16 years ago
I've played a bit with the source. The above code is not enough to fix the problem. The following will fix the endless loop:
private boolean stopdownloadAndPaintVisible = false;
...
if((bmaxx - bminx > dax) (bmaxy - bminy > day)){
if (stopdownloadAndPaintVisible) {
return;
}
stopdownloadAndPaintVisible = true;
JOptionPane.showMessageDialog(Main.parent, tr("The requested area is too big. Please
zoom in a little, or change resolution. (This WMS layer will stay disabled until you do so.)"));
return;
} else {
stopdownloadAndPaintVisible = false;
}
However, the result is a null pointer exception---but that one is cought an you can save your work...
java.lang.NullPointerException
at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(Unknown Source)
at javax.swing.BufferStrategyPaintManager.endPaint(Unknown Source)
at javax.swing.RepaintManager.endPaint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
at javax.swing.SwingUtilities.computeIntersection(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Now I'm playing with the values for dax and day. Increasing them will increase the required memory, but will also allow to zoom out more. The current values limit the displayed map to 5000x5000 pixels. If you got a big screen resolution (like 3360x1050), you can not zoom out very much before reaching that limit...
Somehow there must be another thing I cannot understand. With increased dax and day values, the error message will not be displayed at all while auto-loading. Only when forcing a manual loading ("Download visible tiles"), and even then without the NPE. Is there some code that does not expect dax and day to be as low as 10?
comment:5 by , 16 years ago
PS: I have worked for the last couple of hours with above patch and dax=40, day=30. No crash, although I would have run out of memory on a 32bit system (Memory Usage: 4148 MB / 7281 MB)... ;)
comment:6 by , 16 years ago
If I understand right, the call of JOptionPane.showMessageDialog() is causing some problems. Wouldn't it be the beast solution then to replace it e.g. by directly rendering the message text onto the layer?
comment:7 by , 16 years ago
I'm not sure if the MessageDialog really is a problem. I've been working for more than 20 hours with increased dax/day values. I zoomed out far beyond the available grid size (loading of tiles stopped), I zoomed in again (loading of tiles started again), I exhausted my RAM with tiles, but: I NEVER got that dialog from the automatic tile loading. I ONLY get the dialog when I manually select "Download visible tiles" while I'm zoomed out to much. (And then it's no problem then because it is displayed only once.)
So I really think there is some logic error with the dax/day values of 10. It may be this line that doesn't do what it should:
| (pixelPerDegree / getPPD() > minZoom) ){ don't download when it's too outzoomed |
BTW: In my opinion the fixed array (protected GeorefImage[][] images = new GeorefImage[dax][day];) is the wrong way to store the tiles in memory. Some dynamic structure that can offload images to disc that are not currently on screen whould be the better way to go---much more nice to memory...
comment:8 by , 16 years ago
I am of the same opinion about the two-dimensional array. I have implemented something similar for caching the tiles of JMapViewer/SlippyMapChooser using a Hashtable.
Nowadays I probably would give WeakHashMap a try as this container has the advantage that it solves the out of memory problem because all referenced images can be deleted by the GarbageCollector if necessary (see class WeakReference).
comment:9 by , 16 years ago
| Component: | Core → Core imagery |
|---|
comment:10 by , 16 years ago
| Keywords: | crash added |
|---|
comment:11 by , 16 years ago
| Priority: | critical → normal |
|---|
comment:12 by , 14 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Plugin WMS is not required anymore (und I suppose rarely used, if at all) since JOSM has built-in WMS functionality since r3715.
So I consider this bug obsolete. Objections?



Message box, that cause this problem