zim crashed with ValueError in select_page(): invalid tree path

Bug #915037 reported by Scott Lewin
122
This bug affects 26 people
Affects Status Importance Assigned to Milestone
Zim
Fix Released
Undecided
Fabian Stanke
Fedora
Fix Released
Undecided
zim (Ubuntu)
In Progress
Medium
Unassigned

Bug Description

I recieved this crash error while deleting items in the index.

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: zim 0.54-1 [modified: usr/share/applications/zim.desktop]
ProcVersionSignature: Ubuntu 3.2.0-8.14-generic 3.2.0
Uname: Linux 3.2.0-8-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 1.90-0ubuntu1
Architecture: amd64
CrashCounter: 1
Date: Wed Jan 11 16:04:55 2012
ExecutablePath: /usr/bin/zim
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20111129.1)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/zim --list
ProcEnviron:
 LANGUAGE=en_CA:en
 PATH=(custom, user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/zim', '--list']
SourcePackage: zim
Title: zim crashed with ValueError in select_page(): invalid tree path
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Related branches

Revision history for this message
Scott Lewin (sclewin) wrote :
visibility: private → public
tags: removed: need-duplicate-check
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in zim (Ubuntu):
status: New → Confirmed
Revision history for this message
Jane Atkinson (irihapeti) wrote :

Same error occurred in 32-bit Ubuntu 12.04.

Revision history for this message
Sutram (sutram) wrote :

Same error occurred in 32-bit Xubuntu 12.04.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Could not reproduce this error, but cleaned up a bit based on code review - hope this is not returning in version 0.55

Changed in zim (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Jane Atkinson (irihapeti) wrote :

Still having this error in 32-bit Ubuntu.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 915037] Re: zim crashed with ValueError in select_page(): invalid tree path

On Tue, Mar 20, 2012 at 2:48 AM, Jane Atkinson
<email address hidden> wrote:
> Still having this error in 32-bit Ubuntu.

Do you have a way to reproduce it ?

-- Jaap

Revision history for this message
Jane Atkinson (irihapeti) wrote :

Jaap:

No, I don't seem to be able to reproduce this error.

I had used Zim wiki to write a draft version of a short document (about 400 words). When I'd copied the text to the final document, I deleted the draft subpage and that's when the crash happened.

There was nothing fancy about the page. No formatting, links, images, attached files or anything like that.

I tried creating and then deleting similar pages a few minutes ago, but nothing untoward happened.

Sorry I can't be more helpful.

Revision history for this message
Dan Smith (dansmith) wrote :

Same error on 64-bit Precise, but I don't seem to see any ill effects of it, other than the Ubuntu complaint that a bug occurred...

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Dan, Jane,

What version are we talking about ? Original report is about 0.54 but I believe behavior of 0.55 should differ. If you still see it under 0.55 please post the error trace for that version.

Regards,

Jaap

Revision history for this message
Jane Atkinson (irihapeti) wrote :

I've had no problems with Zim for some time now, so whatever was causing the problem seems to have been fixed.

Revision history for this message
Scott Lewin (sclewin) wrote : Re: [Bug 915037] Re: zim crashed with ValueError in select_page(): invalid tree path

I have not used zim in a while so I can not verify if this is still a problem.

------Original Message------
From: Jane Atkinson
Sender: <email address hidden>
To: Scott Lewin
ReplyTo: Bug 915037
Subject: [Bug 915037] Re: zim crashed with ValueError in select_page(): invalid tree path
Sent: 7 Apr 2012 3:36 AM

I've had no problems with Zim for some time now, so whatever was causing
the problem seems to have been fixed.

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/915037

Title:
  zim crashed with ValueError in select_page(): invalid tree path

To manage notifications about this bug go to:
https://bugs.launchpad.net/zim/+bug/915037/+subscriptions

Your friend,
Scott
Sent from my BlackBerry Curve.

Revision history for this message
Frank Kafka (drw-frank-52b) wrote :

I got this when deleting an empty file, one that is grayed out and italicized in the list and was made by the auto-link function. Further no ill effects whatsoever.

Revision history for this message
Favio D'Ercole (fndercole) wrote :

I had problem with zim running on Ubuntu Precise. I tried with the latest version (0.54) in the ubuntu official repository. The same problem occur in the latest stable version 0.56.

Trayicon plugin causes crash too.

Fabian Stanke (fmos)
Changed in zim:
status: New → In Progress
Revision history for this message
Fabian Stanke (fmos) wrote :

My bugfixes branch at lp:~fmos/zim/bugfixes contains a unit test to reproduce this bug (revision <=279) and the (obvious) fix (revision 280) - to be confirmed.

Changed in zim:
assignee: nobody → Fabian Moser (fmos)
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 915037] Re: zim crashed with ValueError in select_page(): invalid tree path

@fabian: if the branch is ready for merge, please flag it as such in
launchpad (or let me know by email), and I'll merge in the main tree

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Branch merged. Definitely will not hurt. However if I disable the fix
the test passes as well, so still not sure about the underlying root
cause. But sure hope this fixes the issue.

Thanks for looking into it!

Jaap

Revision history for this message
Fabian Stanke (fmos) wrote :
Download full text (3.4 KiB)

Hi Jaap,

Thanks for the feedback!

I spent half a day to understand it (the continued reports and confirmations on Fedora's Bugzilla on the corresponding bug drove me mad :D ), so - despite the one-line diff, this was a bit complicated, especially me not having hacked in Python for quiet some time...

The test passes, because the exception that triggers Ubuntu's and Fedora's crash report tools unfortunately doesn't interrupt the test run. I played around with G_DEBUG=fatal_warnings in the environment and this may be necessary for the exception to be raised (otherwise Python is blind anyway). But even the exception being raised obviously doesn't crash the test hard enough, presumeably because it happens in an async event handler (the async tree view update). That's why I empty the GTK message queue in the test.

Maybe - for testing purposes - making the treeview update in the main thread would make the test fail, but I didn't have the time to check if this is (easily) possible. -> TODO ?!

btw.: to reproduce the reported problem "live", one has to move the last child of any sub-tree and that child must be displayed (and selected in the treeview) before being moved. Then the treepath (the tuple of ints) becomes invalid and crashes the treeview update when it tries to get an iter for the invalid tuple. When another child is used, the treepath remains valid (it just refers to the wrong page, which isn't noticed). When the moved page isn't displayed, the critical treeview line isn't touched in the problematic update.

Hope this explains a bit.

Cheers, Fabian

----------------ursprüngliche Nachricht-----------------
Von: "Jaap Karssenberg" <email address hidden>
An: <email address hidden>
Datum: Fri, 18 May 2012 08:08:36 -0000
-------------------------------------------------

> Branch merged. Definitely will not hurt. However if I disable the fix
> the test passes as well, so still not sure about the underlying root
> cause. But sure hope this fixes the issue.
>
> Thanks for looking into it!
>
> Jaap
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/915037
>
> Title:
> zim crashed with ValueError in select_page(): invalid tree path
>
> Status in Zim desktop wiki:
> In Progress
> Status in “zim” package in Ubuntu:
> In Progress
>
> Bug description:
> I recieved this crash error while deleting items in the index.
>
> ProblemType: Crash
> DistroRelease: Ubuntu 12.04
> Package: zim 0.54-1 [modified: usr/share/applications/zim.desktop]
> ProcVersionSignature: Ubuntu 3.2.0-8.14-generic 3.2.0
> Uname: Linux 3.2.0-8-generic x86_64
> NonfreeKernelModules: fglrx
> ApportVersion: 1.90-0ubuntu1
> Architecture: amd64
> CrashCounter: 1
> Date: Wed Jan 11 16:04:55 2012
> ExecutablePath: /usr/bin/zim
> InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64
> (20111129.1)
> InterpreterPath: /usr/bin/python2.7
> PackageArchitecture: all
> ProcCmdline: /usr/bin/python /usr/bin/zim --list
> ProcEnviron:
> LANGUAGE=en_CA:en
> PATH=(custom, user)
> LANG=en_CA.UTF-8
> SHELL=/bin/bash
> PythonArgs: ['/usr/bin/zim', '--list']
> SourcePackage: zim
> Title: zim crashed w...

Read more...

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

On Fri, May 18, 2012 at 11:28 AM, Fabian Moser
<email address hidden> wrote:
> btw.: to reproduce the reported problem "live", one has to move the last
> child of any sub-tree and that child must be displayed (and selected in
> the treeview) before being moved. Then the treepath (the tuple of ints)
> becomes invalid and crashes the treeview update when it tries to get an
> iter for the invalid tuple. When another child is used, the treepath
> remains valid (it just refers to the wrong page, which isn't noticed).
> When the moved page isn't displayed, the critical treeview line isn't
> touched in the problematic update.

OK, the fact that it needs to be the last page in a sub-tree is
probably the reason why I was not able to reproduce before.

May need a deeper fix by tracing where the wrong index comes from.
Either the "select_page" should not happen for a non-existing page, or
at least it should not find a treepath for this page...

Your patch at least will stop the exceptions and resulting bug reports :)

-- Jaap

Revision history for this message
Fabian Stanke (fmos) wrote :

> May need a deeper fix by tracing where the wrong index comes from.
> Either the "select_page" should not happen for a non-existing page, or
> at least it should not find a treepath for this page...

You want deeper tracing? I can tell you where the wrong index comes from. :D

1. select_page should happen:

After a move, open_page is called on the new page location (good!) and again triggers select_page (good!) to update the TreeView. select_page (obviously) is designed with a page *switch* in mind and wants to notify the previously selected TreeView item (that it's not selected anymore) - which is why it caches the paths in the first place - and the newly selected item (that it's now selected). Of course in the present situation, the previously selected item doesn't exist anymore, while its path is still cached in self.selected_page.

My fix effectivly just skips the notification of the previously selected path, which is what I assumed acceptable behaviour.

2. it should find a treepath

There is a reason, why I call ui.open_page with an IndexPath in the unit test *evil grin* : the IndexPath instance contains/stores the (later invalid) index. get_treepath when called with an IndexPath skips the lookup_path and heads right to the loop calling get_page_index. get_page_index builds the index entires by querying pages with the same parent and *lower* sortkey or basename. It doesn't care whether the RHS of the comparison (the path for which it is called) exists!

Why didn't I fix get_page_index? - Well I tried to and even had a revision in my branch that let it check the input path for existance first. The problem here is, that get_page_index for some reason must work the way it does and return sane results for yet uncached pages. That's the point where I stopped digging. Also having in mind that you're doing some refactoring on the backend stuff which might replace this anyway at some point...

Hence, I reckoned letting get_iter crash in a controlled way (hence my fix) is not the worst thing to do, for now at least. ;)

Cheers, Fabian

--

Fabian Stanke (fmos)
Changed in zim:
status: In Progress → Fix Committed
Changed in zim (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Bruce Pieterse (octoquad) wrote :

Crashed in Quantal. I have attached a strace log after this crash. I have noticed some strange behaviour when deleting a parent node with 2 or more child nodes. If I try to delete the parent item with 4 child nodes the last child node would be the only one that gets deleted. Then if I try delete the parent again, the last child node re-appears empty. If I continue doing this, then it slowly works itself up the tree but it requires a few deletes of the parent node. The only way to successfully delete a child node is one at a time.

The time of deletions in the log file was at 11:17 & 11:20.

I'm not sure if this the reason for the crash, but i'm posting the strace just in case it actually relates to this bug.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

@bruce: afraid the strace log is to low level for me. If you have the python stack trace, that would be much more readable to understand what is going on. B.t.w. why do you think this is the same bug as parent? From the description, it sounds like it might be something different. In that case please open a new report instead of commenting here.

Revision history for this message
Robin Lee (cheeselee) wrote :

There is again a new report of this error, against a version already having fmos' patch:
https://bugzilla.redhat.com/show_bug.cgi?id=863219

Changed in zim:
status: Fix Committed → New
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

@Robin: the report in
https://bugzilla.redhat.com/show_bug.cgi?id=863219 is not quite the same as the original issue in this report, so will close this one, but feel free to open a new one for tracking https://bugzilla.redhat.com/show_bug.cgi?id=863219

I have seen that one before in my own testing, but disappeared after re-indexing the notebook. Have put an additional catch in the code to report it.

Changed in zim:
status: New → Fix Released
Revision history for this message
lootsy (lootsy) wrote :

FYI

in Zim 0.54 (of 'standard' universe repository for 12.04) this bug affected me.
in Zim 0.59 (of 'PPA' for 12.04) I couldn't reproduce this behaviour (probably fixed?).

Revision history for this message
Sylvain Viart (sylvain-viart) wrote :

Happened on zim 0.60

see attached crash report collected by apport, which claims this is a duplicate of this one.

Title: zim crashed with error in meth(): [Errno 2] No such file or directory

Changed in fedora:
importance: Unknown → Undecided
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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