Closed GoogleCodeExporter closed 9 years ago
Well this looks like the database got corrupted somehow: there is a wifi table
entry which doesn't have a corresponding entry in the position table.
r26f3429381ca adds another check before saving wifis. If no valid location is
available saving is aborted now.
Nevertheless let's keep an eye on this: you mentioned 'logging in the
background'. Let's make sure that the root issue isn't related to background
scanning
Original comment by wish7code
on 16 Sep 2013 at 9:47
Hmmm... I pulled the db from the device and ran
SELECT * FROM wifis WHERE (request_pos_id NOT IN (SELECT _id FROM positions))
OR (last_pos_id NOT IN (SELECT _id FROM positions));
and it returned 0 rows.
Could that be a race condition somewhere in the code? E.g. scan has just
returned but export starts before a new position is received, so the export
code does not see a valid last_pos_id?
In that case, code like the following might help:
stopLogging() {
if (isScanRunning()) waitForEndOfScan();
if (!hasLastPosID(lastScan)) {
waitForPos(timeout);
}
}
export() {
stopLogging();
//export code here
}
That is: before exporting, stop logging. Make sure the last wifi scan has
returned and that it has a valid "last position". If not, wait for it, but
implement a timeout (else the app will hang if GPS is lost just during the
scan).
Original comment by mich...@vonglasow.com
on 19 Sep 2013 at 9:27
After looking at the log file again, I suddendly realized that the bug was
fixed without explicit intention :-)
In the stack trace you see that, the crash is caused by the
SessionMapObjectsLoader (responsible for drawing current session's wifis on the
map)
...
09-16 10:16:02.914 E/AndroidRuntime( 9229): at
org.openbmap.utils.SessionMapObjectsLoader.doInBackground(SessionMapObjectsLoade
r.java:95)
...
Older versions (< rb7ae478d4fea) had a problematic call to
dbHelper.loadActiveSession().getId(), which caused a NPE as the session was
actually closed before exporting.
This behaviour was changed when switching to mapsforge 0.4.0 at rb7ae478d4fea .
At the time I was changing that line of code, I wasn't aware that it's related
to this issue..
Original comment by wish7code
on 19 Sep 2013 at 12:40
Original issue reported on code.google.com by
mich...@vonglasow.com
on 16 Sep 2013 at 9:01Attachments: