Kile crashes when it is closing

Bug #994498 reported by Helder on 2012-05-04
This bug affects 20 people
Affects Status Importance Assigned to Milestone
Fix Released
kile (Ubuntu)

Bug Description

SRU information:
The bug affects Kile users that use project files (since Kile makes managing a group of LaTeX files easier, I suppose the "project" functionality is often used, thus, the number of users that experience the problem is not small).

[Test case]
1) Open the old version of Kile.
2) Create a project file by clicking on Project->New Project and choosing a project title, a folder and a name for the main file (choose "Yes" if the program prompts you to add the .tex extension automatically).
3) Close Kile through File->Quit - the program should crash. The segfault's stack trace should show a call to "QUrl::isEmpty()" at the top, in one of the threads.
4) Install the updated package.
5) Perform steps 1), 2) and 3) as above, Kile should not crash anymore and should exit normally instead.

[Regression potential]
As the patch changes only the code related to the "Close All Projects" menu (and as the called "projectClose" function stays untouched), there should be little regression potential (the only possibility is that the code does not work in every case, thus making Kile continue to crash or possibly preventing the application from closing).

Close the project manually (via Project->Close Project) before quitting Kile.
Original description:

When I close the application it shows this error message:
Executável: kile PID: 4969 Sinal: Segmentation fault (11)

When I try to install the debugging packages it says "Could not find debug symbol packages for this application", but here is the backtrace:
Application: Kile (kile), signal: Segmentation fault
Using host libthread_db library "/lib/i386-linux-gnu/".
[Current thread is 1 (Thread 0xb3ec6740 (LWP 4969))]

Thread 5 (Thread 0xb1b74b40 (LWP 4971)):
#0 0xb775d424 in __kernel_vsyscall ()
#1 0xb55a4380 in poll () from /lib/i386-linux-gnu/
#2 0xb4856a3b in g_poll () from /lib/i386-linux-gnu/
#3 0xb484906e in ?? () from /lib/i386-linux-gnu/
#4 0xb484952b in g_main_loop_run () from /lib/i386-linux-gnu/
#5 0xb1b79134 in ?? () from /usr/lib/i386-linux-gnu/gio/modules/
#6 0xb486c673 in ?? () from /lib/i386-linux-gnu/
#7 0xb4915d4c in start_thread () from /lib/i386-linux-gnu/
#8 0xb55b2ace in clone () from /lib/i386-linux-gnu/

Thread 4 (Thread 0xb11ffb40 (LWP 4972)):
#0 0xb4918c64 in __pthread_mutex_unlock_usercnt () from /lib/i386-linux-gnu/
#1 0xb55c0634 in pthread_mutex_unlock () from /lib/i386-linux-gnu/
#2 0xb48883d0 in g_mutex_unlock () from /lib/i386-linux-gnu/
#3 0xb48482a7 in g_main_context_release () from /lib/i386-linux-gnu/
#4 0xb4849018 in ?? () from /lib/i386-linux-gnu/
#5 0xb484952b in g_main_loop_run () from /lib/i386-linux-gnu/
#6 0xb264b0ea in ?? () from /usr/lib/i386-linux-gnu/
#7 0xb486c673 in ?? () from /lib/i386-linux-gnu/
#8 0xb4915d4c in start_thread () from /lib/i386-linux-gnu/
#9 0xb55b2ace in clone () from /lib/i386-linux-gnu/

Thread 3 (Thread 0xaed70b40 (LWP 4974)):
#0 0xb48ffdcd in clock_gettime () from /lib/i386-linux-gnu/
#1 0xb638a315 in do_gettime (frac=0xaed6ffb0, sec=0xaed6ffa8) at tools/qelapsedtimer_unix.cpp:123
#2 qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3 0xb6474226 in QTimerInfoList::updateCurrentTime (this=0x8e24644) at kernel/qeventdispatcher_unix.cpp:343
#4 0xb647457a in QTimerInfoList::timerWait (this=0x8e24644, tm=...) at kernel/qeventdispatcher_unix.cpp:450
#5 0xb6472e23 in timerSourcePrepareHelper (src=<optimized out>, timeout=0xaed700bc) at kernel/qeventdispatcher_glib.cpp:136
#6 0xb6472ebd in timerSourcePrepare (source=0x8e24610, timeout=<optimized out>) at kernel/qeventdispatcher_glib.cpp:169
#7 0xb4848762 in g_main_context_prepare () from /lib/i386-linux-gnu/
#8 0xb4848f6f in ?? () from /lib/i386-linux-gnu/
#9 0xb48491c1 in g_main_context_iteration () from /lib/i386-linux-gnu/
#10 0xb64738e7 in QEventDispatcherGlib::processEvents (this=0x8e4c5d8, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#11 0xb643f50d in QEventLoop::processEvents (this=0xaed70240, flags=...) at kernel/qeventloop.cpp:149
#12 0xb643f7a9 in QEventLoop::exec (this=0xaed70240, flags=...) at kernel/qeventloop.cpp:204
#13 0xb632894c in QThread::exec (this=0x8e4d128) at thread/qthread.cpp:501
#14 0xb641cb5d in QInotifyFileSystemWatcherEngine::run (this=0x8e4d128) at io/qfilesystemwatcher_inotify.cpp:248
#15 0xb632bde0 in QThreadPrivate::start (arg=0x8e4d128) at thread/qthread_unix.cpp:298
#16 0xb4915d4c in start_thread () from /lib/i386-linux-gnu/
#17 0xb55b2ace in clone () from /lib/i386-linux-gnu/

Thread 2 (Thread 0xad76eb40 (LWP 5035)):
#0 0xb775d424 in __kernel_vsyscall ()
#1 0xb491996b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i386-linux-gnu/
#2 0xb55c03dc in pthread_cond_wait () from /lib/i386-linux-gnu/
#3 0xb4f05029 in ?? () from /usr/lib/i386-linux-gnu/
#4 0xb4f0506f in ?? () from /usr/lib/i386-linux-gnu/
#5 0xb4915d4c in start_thread () from /lib/i386-linux-gnu/
#6 0xb55b2ace in clone () from /lib/i386-linux-gnu/

Thread 1 (Thread 0xb3ec6740 (LWP 4969)):
[KCrash Handler]
#7 0xb63edd64 in QUrl::isEmpty (this=0x62004a) at io/qurl.cpp:4278
#8 0x081fd6d0 in ?? ()
#9 0x081fdbd3 in ?? ()
#10 0x0811f60b in _start ()

Related branches

Created attachment 66957
fix for Manager::projectCloseAll()

Version: trunk-kde4 (using Devel)
OS: Linux

If more than 2 projects are opened in Kile then during closing it crashes.

Maybe this has started after upgrading Qt to 4.8, but I'm not sure.

The problem is caused by removing items from collection during itearation in Manager::projectCloseAll() (iteration) and Manager::projectClose(const Kurl&) (removing).

Reproducible: Always

Steps to Reproduce:
1. Open 3 or more projects in Kile
2. Exit Kile

Actual Results:
Kile crashes

Expected Results:
Kile exits normally

Trivial patch is attached

Thanks for the patch! I've committed it now

(unfortunately with the wrong bug number)

As I cannot reproduce the crash here, please close this bug if it is fixed for you now.

Thanks! I have chacked it before submission with local builds and it works.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in kile (Ubuntu):
status: New → Confirmed
der_vegi (m-may) wrote :

Same here, kile crashes when closing. This just started after my upgrade from 11.10 to 12.04, so this bug might have been introduced by the upgrade from kile version 2.1.0-1ubuntu1 to 2.1.0-1ubuntu2.

I don't know if this is maybe related to this bug: When I start kile, it directly opens the previous project. After the upgrade to 12.04, I suddenly get the error "The file [...].bib/.tex was opened and contained too long lines (more than 1 024 characters). Too long lines were wrapped and the document is set to read-only mode, as saving will modify its content." This error appears for the main .tex file as well as my .bib file.

der_vegi (m-may) wrote :

Okay, this seems to be related to project files. Creating a normal file without project does not invoke the bug. To do this, you just have to create a kile-project, add a .tex file and then close kile. => Crash.

I will report the issue with the "too long lines" in a different bug.

arnuschky (abrutschy) wrote :

Can confirm on 12.04 64bit.
Crashes occur only when project file was loaded/created.

Alessandro Menti (elgaton) wrote :

It seems that the new upstream version (2.1.2) solves the problem (according to <> and personal experience), although no mention of a fix has been written into the ChangeLog.

I'll made it available shortly in a PPA and bisect the SVN tree as appropriate.

Jonas T. (jo-t) wrote :

Can confirm after fresh install of 12.04 on two machines - 64 bit and 32 bit.
Happens everytime when closing with an open project file. When I close the project before quitting, it will close just fine.

Christian Mertes (cmertes) wrote :

Does someone know where to vote for the related bug that kile will fire up the Crash Reporting Assistant which will complain of missing debug packages but refuse to report the bug at all because it's "not helpful enough"? Good way to reduce the number of bug reports, bad way to improve the quality of software. This -dbg package seems to be missing since 2009 at least since I found complaints that are that old.

lucacerone (lucacerone) wrote :

I can confirm the bug on my fresh Ubuntu 12.04 64 bit. The software has a segmentation fault when exiting having a project open.
The issue doesn't occur if you close the project before exiting.

This is also happening on my machine, the segmentation fault prevents kile from updating ~/.kde/share/config/kilerc ; so the project settings, preferences, etc. are not remembered. I've worked around this by editing the kilerc file manually, but it is a pain. I've tried removing kilerc completely, but the problem persisted even when kilerc was not present / newly rebuilt.

Robin Lovelace (rob00x-k) wrote :

Same problem here: anyone know of a solution?

Christian Mertes (cmertes) wrote :

You should be able to close the project without any problems. Not an ideal workaround but better than editing the kilerc by hand.

Alessandro Menti (elgaton) wrote :

Sorry for being late, I had several university exams to prepare and haven't had much free time lately.

Anyway, I've found the bug in the KDE bug tracker and have backported the patch to the version in Ubuntu Precise - I'm currently building a test package just to make sure everything is OK.

(Temporarily assigning the bug to me so that others are aware).

Changed in kile (Ubuntu):
assignee: nobody → Alessandro Menti (alessandro-menti)
Changed in kile:
importance: Unknown → High
status: Unknown → Fix Released
Alessandro Menti (elgaton) wrote :

The upstream patch that fixes the problem is in the linked branch.

Updating the description and asking the Ubuntu sponsors team to sponsor the patch for Precise, as the bug is already fixed in Quantal (newer upstream version present).

Changed in kile (Ubuntu):
assignee: Alessandro Menti (alessandro-menti) → nobody
description: updated
description: updated
TJ (tj) on 2012-08-10
Changed in kile (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Low
milestone: none → ubuntu-12.04.1
Alessandro Menti (elgaton) wrote :

I have published a temporary package in my PPA, in case anyone wants to run a bug-free version until the patch is officially merged in the Ubuntu repositories:

(Please note that the package will be removed from my PPA as soon as the official update is produced).

Changed in kile (Ubuntu Precise):
status: New → Confirmed
Changed in kile (Ubuntu Quantal):
status: Triaged → Fix Released
milestone: ubuntu-12.04.1 → none
Marc Deslauriers (mdeslaur) wrote :

Thanks for the merge request. ACK. I've uploaded the package to precise-proposed for processing by the SRU team, with a minor ajustment to the version number and the pocket.


Hello H2G, or anyone else affected,

Accepted into precise-proposed. The package will build now and be available in a few hours in the -proposed repository.

Please help us by testing this new package. See for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in kile (Ubuntu Precise):
status: Confirmed → Fix Committed
tags: added: verification-needed
Alessandro Menti (elgaton) wrote :

Works for me.

tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kile - 1:2.1.0-1ubuntu2.1

kile (1:2.1.0-1ubuntu2.1) precise-proposed; urgency=low

  * Fixed segfault on close when a project is open (LP: #994498). Patch by
    Eugene Shalygin.
 -- Alessandro Menti <email address hidden> Tue, 07 Aug 2012 19:52:40 +0200

Changed in kile (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.