#10269 closed defect (fixed)
Null deref in GpxLayer.java:755
| Reported by: | glebius | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | 14.07 |
| Component: | Core | Version: | |
| Keywords: | Cc: |
Description
Under certain circumstances trkPnt.customColoring is Null. To reproduce the problem, the following is required:
1) draw.rawgps.large=1
2) LiveGPSPlugin enabled and connected to gpsd. Hint: use gpsfake from gpsd package to reproduce on a computer without GPS receiver.
I haven't yet investigated the problem very good, but my current guess is the following: there is a race between GpxLayer.paint() and the LiveGPSPlugin adding new points to the GPX.
In line 552 there is cycle
for (Collection<WayPoint> segment : data.getLinesIterable(null))
, that adds customColoring to every trackpoint.
Later in line 631 we have same iterator that fills in visibleSegments linked list. And later in that list in line 755 we encounter a trackpoint without customColoring initialized. So, I guess, that between iterator in line 552 and iterator in line 631 the "data" is modified with new points.
Attachments (0)
Change History (17)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
What's the operational impact? An exception, an absence of track coloring?
comment:3 by , 11 years ago
Exception, LiveGPSPlugin is unusable. A workaround is draw.rawgps.large=0.
comment:4 by , 11 years ago
comment:5 by , 11 years ago
| Milestone: | → 14.07 |
|---|
comment:6 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → needinfo |
comment:8 by , 11 years ago
A new instant failure in GpxLayer with LiveGPS (josm 7337, modules updated):
java.lang.NullPointerException
at org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.drawPoints(GpxDrawHelper.java:459)
at org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.drawAll(GpxDrawHelper.java:204)
at org.openstreetmap.josm.gui.layer.GpxLayer.paint(GpxLayer.java:285)
at livegps.LiveGpsLayer.paint(LiveGpsLayer.java:108)
at org.openstreetmap.josm.gui.MapView.paintLayer(MapView.java:536)
at org.openstreetmap.josm.gui.MapView.paint(MapView.java:631)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1047)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5219)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1529)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1452)
at javax.swing.RepaintManager.paint(RepaintManager.java:1249)
at javax.swing.JComponent._paintImmediately(JComponent.java:5167)
at javax.swing.JComponent.paintImmediately(JComponent.java:4978)
at javax.swing.RepaintManager$3.run(RepaintManager.java:808)
at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
at javax.swing.RepaintManager.access$1100(RepaintManager.java:62)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Several large GPX points are drawn before exception, thus I suppose, that original problem is fixed. Sorry, ENOTIME for more detailed analysis. Should I open new ticket or can we continue in this one?
comment:9 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | needinfo → new |
it's ok to keep this one, thanks.
comment:11 by , 11 years ago
The NPE is fixed but the root cause is probably at another place. akks, can you please have a look at it tomorrow? If I manage to fix the two other points on my TODO list, we could release the tested version on Tuesday morning I think :)
comment:12 by , 11 years ago
Tested 7340. The crash is fixed, thanks!
However, now the GPX layer produced by LiveGPS plugin has a bug. Unless the entire GPS trace fits the mapping window, the trace blinks and is colored white. If the mapping window is zoomed to a larger area and the entire trace is visible, then problem goes away.
comment:13 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Thanks for the feedback.
I prefer to close this ticket now, can you please create a new one for remaining bugs? Thanks.
comment:15 by , 11 years ago
Had not a chance to fix it in time... After looging to the code: the source of problem should be in LiveGPS - it creates new WayPoint objects with customColoring=null and the color cache is not updated every time (elsewhere it would be too slow). This gives coloring problems and previous NPEs.
I have no GPSd with emulated tracks and can not debug the plugin, unfortunately.
The last commit may help a little with strange color effects.
comment:16 by , 11 years ago
New ticket with instructions to reproduce #10321. Let's continue discussion there.



Another possibility is that computeCacheInSync is true while should be false. This may lead to trackpoint w/o customColoring initialized.