Bug 327444 - Marble crashes on start [BookmarkManager::updateBookmarkFile, GeoWriter::writeElement]
Summary: Marble crashes on start [BookmarkManager::updateBookmarkFile, GeoWriter::writ...
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: 1.7 (KDE 4.12)
Platform: Compiled Sources Linux
: HI crash
Target Milestone: 1.7 (KDE 4.12)
Assignee: Dennis Nienhüser
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2013-11-11 11:52 UTC by Jonathan Marten
Modified: 2013-11-30 08:55 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2013-11-11 11:52:25 UTC
Application: marble (1.6.80 (1.7 Beta1))
KDE Platform Version: 4.11.60 (Compiled from sources)
Qt Version: 4.8.6
Operating System: Linux 3.8.13-gentoo i686
Distribution: "Gentoo Base System release 2.2"

-- Information about the crash:
- What I was doing when the application crashed:

Started up Marble without the file ~/.local/share/marble/bookmarks/bookmarks.kml previously existing.
The application crashes either immediately or after a few seconds delay.

With --debug-info, the following is printed on stderr just before the crash:

bool Marble::BookmarkManager::loadFile(const QString&) Loading Bookmark File: "/home/jjm/.local/share/marble/bookmarks/bookmarks.kml" 
Could not open/parse file "/home/jjm/.local/share/marble/bookmarks/bookmarks.kml" 
Could not parse file "/home/jjm/.local/share/marble/bookmarks/bookmarks.kml" 
This could be caused by a previous broken bookmark file. Trying to recover. 
Null pointer in call to GeoDataTreeModel::addFeature (parent  0x8561bfc  - feature 0x0 ) 
KCrash: crashing... crashRecursionCounter = 2

After the crash, the file ~/.local/share/marble/bookmarks/bookmarks.kml exists but is zero size.
The same happens if Marble is restarted with this zero size file existing.

Using Git bisection, this appears to be a consequence of commit:

commit 931d37d87df1d200dacdd9bf8f823dce575ba492
Author: Dennis Nienhüser <earthwings@gentoo.org>
Date:   Tue Oct 29 19:15:37 2013 +0100

    Refactoring.
    
    Make Route-/Bookmark-SyncManager classes part of CloudSyncManager.
    Remove CloudSyncManager instance from MarbleModel.
    Implement (partly) initial bookmark sync.

The crash can be reproduced every time.

-- Backtrace:
Application: Marble Virtual Globe (marble), signal: Segmentation fault
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xaf045740 (LWP 21696))]

Thread 9 (Thread 0xac3deb40 (LWP 21697)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb274ef8b in poll () from /lib/libc.so.6
#2  0xb1b11ceb in g_poll () from /usr/lib/libglib-2.0.so.0
#3  0x00000002 in ?? ()
#4  0xffffffff in ?? ()
#5  0xb1bc3ff4 in ?? () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 8 (Thread 0xab950b40 (LWP 21698)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb274ef8b in poll () from /lib/libc.so.6
#2  0xb1b11ceb in g_poll () from /usr/lib/libglib-2.0.so.0
#3  0x00000002 in ?? ()
#4  0xffffffff in ?? ()
#5  0xb1bc3ff4 in ?? () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 7 (Thread 0xaa8a1b40 (LWP 21699)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb621d7dc in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb58f29d2 in ?? () from /usr/kde4/lib/libQtWebKit.so.4
#3  0xb58f2a0f in ?? () from /usr/kde4/lib/libQtWebKit.so.4
#4  0xb6219017 in start_thread () from /lib/libpthread.so.0
#5  0xb2759c7e in clone () from /lib/libc.so.6

Thread 6 (Thread 0xa9f78b40 (LWP 21700)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb621d7dc in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5924973 in WTF::ThreadCondition::wait(WTF::Mutex&) () from /usr/kde4/lib/libQtWebKit.so.4
#3  0xb5608e84 in ?? () from /usr/kde4/lib/libQtWebKit.so.4
#4  0xb5907a62 in ?? () from /usr/kde4/lib/libQtWebKit.so.4
#5  0xb59242ce in ?? () from /usr/kde4/lib/libQtWebKit.so.4
#6  0xb6219017 in start_thread () from /lib/libpthread.so.0
#7  0xb2759c7e in clone () from /lib/libc.so.6

Thread 5 (Thread 0xa67ffb40 (LWP 21706)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb621db84 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb29a9701 in wait (time=30000, this=0x8fb3888) at thread/qwaitcondition_unix.cpp:84
#3  QWaitCondition::wait (this=0x8faf598, mutex=0x8faf594, time=30000) at thread/qwaitcondition_unix.cpp:158
#4  0xb299b90b in QThreadPoolThread::run (this=0xa68023e0) at concurrent/qthreadpool.cpp:141
#5  0xb29a9136 in QThreadPrivate::start (arg=0xa68023e0) at thread/qthread_unix.cpp:349
#6  0xb6219017 in start_thread () from /lib/libpthread.so.0
#7  0xb2759c7e in clone () from /lib/libc.so.6

Thread 4 (Thread 0xa79fcb40 (LWP 21707)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb621db84 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb29a9701 in wait (time=30000, this=0x8fb3888) at thread/qwaitcondition_unix.cpp:84
#3  QWaitCondition::wait (this=0x8faf598, mutex=0x8faf594, time=30000) at thread/qwaitcondition_unix.cpp:158
#4  0xb299b90b in QThreadPoolThread::run (this=0xa6802c38) at concurrent/qthreadpool.cpp:141
#5  0xb29a9136 in QThreadPrivate::start (arg=0xa6802c38) at thread/qthread_unix.cpp:349
#6  0xb6219017 in start_thread () from /lib/libpthread.so.0
#7  0xb2759c7e in clone () from /lib/libc.so.6

Thread 3 (Thread 0xa71fbb40 (LWP 21708)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb274ef8b in poll () from /lib/libc.so.6
#2  0xb1b11ceb in g_poll () from /usr/lib/libglib-2.0.so.0
#3  0x00000001 in ?? ()
#4  0x0000270f in ?? ()
#5  0xb1bc3ff4 in ?? () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xa91ffb40 (LWP 21709)):
#0  0xb76f2424 in __kernel_vsyscall ()
#1  0xb274ef8b in poll () from /lib/libc.so.6
#2  0xb1b11ceb in g_poll () from /usr/lib/libglib-2.0.so.0
#3  0x00000001 in ?? ()
#4  0x00020f56 in ?? ()
#5  0xb1bc3ff4 in ?? () from /usr/lib/libglib-2.0.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 0xaf045740 (LWP 21696)):
[KCrash Handler]
#7  0xb70fbd5e in Marble::GeoWriter::writeElement (this=0xbff3f198, object=0x0) at /ws/trunk/kdeedu/marble/src/lib/geodata/writer/GeoWriter.cpp:62
#8  0xb70fbf53 in Marble::GeoWriter::write (this=0xbff3f198, device=0xbff3f1a0, feature=0x0) at /ws/trunk/kdeedu/marble/src/lib/geodata/writer/GeoWriter.cpp:49
#9  0xb73958c3 in Marble::BookmarkManager::updateBookmarkFile (this=0x911492c) at /ws/trunk/kdeedu/marble/src/lib/BookmarkManager.cpp:235
#10 0xb7395d89 in Marble::BookmarkManager::loadFile (this=0x911492c, relativeFilePath=...) at /ws/trunk/kdeedu/marble/src/lib/BookmarkManager.cpp:117
#11 0xb73ef8ee in Marble::BookmarkSyncManager::Private::copyLocalToCache (this=0x9538880) at /ws/trunk/kdeedu/marble/src/lib/cloudsync/BookmarkSyncManager.cpp:709
#12 0xb73efcd7 in Marble::BookmarkSyncManager::Private::saveDownloadedToCache (this=0x9538880, kml=...) at /ws/trunk/kdeedu/marble/src/lib/cloudsync/BookmarkSyncManager.cpp:687
#13 0xb73f2618 in Marble::BookmarkSyncManager::Private::completeSynchronization (this=0x9538880) at /ws/trunk/kdeedu/marble/src/lib/cloudsync/BookmarkSyncManager.cpp:757
#14 0xb73f2873 in Marble::BookmarkSyncManager::qt_static_metacall (_o=0x9538710, _c=QMetaObject::InvokeMetaMethod, _id=11, _a=0xbff3f460) at /ws/BUILD.keelhaul/kdeedu-marble--trunk-BUILD/src/lib/BookmarkSyncManager.moc:91
#15 0xb2aea5e9 in QMetaObject::activate (sender=0x984c968, m=0xb41422e4 <QNetworkReply::staticMetaObject>, local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3547
#16 0xb40e5955 in QNetworkReply::finished (this=0x984c968) at .moc/debug-shared/moc_qnetworkreply.cpp:165
#17 0xb405dc14 in QNetworkReplyImplPrivate::finished (this=0x984d760) at access/qnetworkreplyimpl.cpp:795
#18 0xb403ae7e in QNetworkAccessBackend::finished (this=0x984d4f0) at access/qnetworkaccessbackend.cpp:324
#19 0xb4041ee1 in QNetworkAccessHttpBackend::replyFinished (this=0x984d4f0) at access/qnetworkaccesshttpbackend.cpp:753
#20 0xb40e5030 in QNetworkAccessHttpBackend::qt_static_metacall (_o=0x984d4f0, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x9526440) at .moc/debug-shared/moc_qnetworkaccesshttpbackend_p.cpp:95
#21 0xb2ae583b in QMetaCallEvent::placeMetaCall (this=0x95a06e0, object=0x984d4f0) at kernel/qobject.cpp:524
#22 0xb2aeffcb in QObject::event (this=0x984d4f0, e=0x95a06e0) at kernel/qobject.cpp:1194
#23 0xb315d614 in notify_helper (e=0x95a06e0, receiver=0x984d4f0, this=0x8fb0470) at kernel/qapplication.cpp:4562
#24 QApplicationPrivate::notify_helper (this=0x8fb0470, receiver=0x984d4f0, e=0x95a06e0) at kernel/qapplication.cpp:4534
#25 0xb316365d in QApplication::notify (this=0x8fb0470, receiver=0x984d4f0, e=0x95a06e0) at kernel/qapplication.cpp:4423
#26 0xb677f6d0 in KApplication::notify (this=0xbff3fe58, receiver=0x984d4f0, event=0x95a06e0) at /ws/trunk/kdelibs/kdeui/kernel/kapplication.cpp:311
#27 0xb2ad2775 in QCoreApplication::notifyInternal (this=0xbff3fe58, receiver=0x984d4f0, event=0x95a06e0) at kernel/qcoreapplication.cpp:949
#28 0xb2ad64d6 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8f469e8) at kernel/qcoreapplication.cpp:1573
#30 0xb2ad688c in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1466
#31 0xb2b088ee in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#32 postEventSourceDispatch (s=0x8fb03b8) at kernel/qeventdispatcher_glib.cpp:280
#33 0xb1b026cd in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#34 0x08f97f38 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Reported using DrKonqi
Comment 1 Dennis Nienhüser 2013-11-13 18:02:50 UTC
Git commit 1c0fa695cd6ec7884dcfef1f0d27e58b1cb9c7cf by Dennis Nienhüser.
Committed on 13/11/2013 at 17:49.
Pushed by nienhueser into branch 'master'.

Respect general sync activation status

M  +4    -4    src/lib/marble/cloudsync/BookmarkSyncManager.cpp
M  +1    -1    src/lib/marble/cloudsync/RouteSyncManager.cpp

http://commits.kde.org/marble/1c0fa695cd6ec7884dcfef1f0d27e58b1cb9c7cf
Comment 2 Dennis Nienhüser 2013-11-13 18:18:30 UTC
Note that the commit above just fixes the trigger of the crash, not the cause.
Comment 3 Dennis Nienhüser 2013-11-13 18:34:17 UTC
Git commit ef4e3fd9d667f82471cd8555408fc492619c5626 by Dennis Nienhüser.
Committed on 13/11/2013 at 17:49.
Pushed by nienhueser into branch 'KDE/4.12'.

Respect general sync activation status
(cherry picked from commit 1c0fa695cd6ec7884dcfef1f0d27e58b1cb9c7cf)

M  +4    -4    src/lib/marble/cloudsync/BookmarkSyncManager.cpp
M  +1    -1    src/lib/marble/cloudsync/RouteSyncManager.cpp

http://commits.kde.org/marble/ef4e3fd9d667f82471cd8555408fc492619c5626
Comment 4 Dennis Nienhüser 2013-11-13 18:34:17 UTC
Git commit 7603ee9e386ed7a6e638bdf5cf7a450b04a752b4 by Dennis Nienhüser.
Committed on 13/11/2013 at 18:19.
Pushed by nienhueser into branch 'KDE/4.12'.

Fix regression introduced in 9e630ca

Parsing a broken/non-existing KML document returns a null
GeoDocument, so we need to recreate a bookmark document in order
to prevent crashes later on.

M  +4    -2    src/lib/marble/BookmarkManager.cpp

http://commits.kde.org/marble/7603ee9e386ed7a6e638bdf5cf7a450b04a752b4
Comment 5 Dennis Nienhüser 2013-11-13 18:42:04 UTC
Git commit eafac1612e17b9935b1d6dfc533ad155e3a06069 by Dennis Nienhüser.
Committed on 13/11/2013 at 18:19.
Pushed by nienhueser into branch 'master'.

Fix regression introduced in 9e630ca

Parsing a broken/non-existing KML document returns a null
GeoDocument, so we need to recreate a bookmark document in order
to prevent crashes later on.
(cherry picked from commit 7603ee9e386ed7a6e638bdf5cf7a450b04a752b4)

M  +4    -2    src/lib/marble/BookmarkManager.cpp

http://commits.kde.org/marble/eafac1612e17b9935b1d6dfc533ad155e3a06069
Comment 6 Jonathan Marten 2013-11-13 20:53:15 UTC
Confirmed fixed with current trunk master branch, with the bookmarks file not existing at startup.  No crash, Marble works as expected.  Many thanks for the quick fix!
Comment 7 Dennis Nienhüser 2013-11-30 08:55:12 UTC
Git commit e9e94dfd95cdf96a49b351cf60707d042da56d7e by Dennis Nienhüser.
Committed on 13/11/2013 at 18:19.
Pushed by nienhueser into branch 'KDE/4.11'.

Fix regression introduced in 9e630ca

Parsing a broken/non-existing KML document returns a null
GeoDocument, so we need to recreate a bookmark document in order
to prevent crashes later on.
Related: bug 328221
FIXED-IN: 4.11.5
(cherry picked from commit 7603ee9e386ed7a6e638bdf5cf7a450b04a752b4)

M  +4    -2    src/lib/BookmarkManager.cpp

http://commits.kde.org/marble/e9e94dfd95cdf96a49b351cf60707d042da56d7e