Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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 Changed 9 years ago by glebius

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

comment:2 Changed 9 years ago by Don-vip

What's the operational impact? An exception, an absence of track coloring?

comment:3 Changed 9 years ago by anonymous

Exception, LiveGPSPlugin is unusable. A workaround is draw.rawgps.large=0.

comment:4 Changed 9 years ago by akks

Got and fixed this exception while refactoring GpxLayer (thought I introduced it but according to this ticket it was already here)

Should be fixed in 7319/josm, see #5662 (fixing regressions now).
Could you please try it again and close the ticket if fixed?

comment:5 Changed 9 years ago by Don-vip

Milestone: 14.07

comment:6 Changed 9 years ago by Don-vip

Owner: changed from team to glebius
Status: newneedinfo

comment:7 Changed 9 years ago by Don-vip

glebius can you please tell us if we can close this ticket? Thanks.

comment:8 Changed 9 years ago by glebius

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?

Last edited 9 years ago by Don-vip (previous) (diff)

comment:9 Changed 9 years ago by Don-vip

Owner: changed from glebius to team
Status: needinfonew

it's ok to keep this one, thanks.

comment:10 Changed 9 years ago by Don-vip

In 7340/josm:

see #10269 - fix NPE (robustness. trkPnt.customColoring should probably not be null)

comment:11 Changed 9 years ago by Don-vip

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 Changed 9 years ago by glebius

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 Changed 9 years ago by Don-vip

Resolution: fixed
Status: newclosed

Thanks for the feedback.
I prefer to close this ticket now, can you please create a new one for remaining bugs? Thanks.

comment:14 Changed 9 years ago by akks

In 7345/josm:

see #10269: avoid null color values in GpxLayer for sure

comment:15 Changed 9 years ago by akks

Had not a chance to fix it in time... After looking 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.

Last edited 9 years ago by akks (previous) (diff)

comment:16 Changed 9 years ago by glebius

New ticket with instructions to reproduce #10321. Let's continue discussion there.

comment:17 Changed 9 years ago by glebius

The last commit did help. Thanks, akks! Will close #10321.

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.