09-27-2018, 08:13 AM | #1 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Reports crashes in 0.9.10
This has happened suddenly. My most recent activity (other than some minor changes to some content) was a number of changes in my CSS file. But this passes the CSS tests.
I click on Reports, see the progress bar start to run in its dialog, and then a dialog pops up that says "Sigil has encountered a problem. Sigil may need to close." Show Details reveals: Error info: Unknown exception Sigil version: 0.9.10 Runtime Qt: 5.6.2 Compiled Qt: 5.6.2 Platform: Windows Sysinfo ID 192 This also happens on 0.9.9. I'm running Win 10 Professional (64 bit). |
09-27-2018, 08:59 AM | #2 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Try to get a small, non-copyrighted* epub sample that crashes consistently which you can share.
(NOTE: Free <> non-copyrighted. Mobileread has strict rules against uploading copyrighted material) Last edited by DiapDealer; 09-27-2018 at 09:10 AM. |
Advert | |
|
09-27-2018, 09:59 AM | #3 | |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
Quote:
I'm willing to put some time into helping debug this and producing a small test case -- if one exists. But my situation is one where I don't want to stop book development and devote excessive time to that exercise. I'm sure you understand. The report function is very convenient for me (largely because it gives me a word count), but it's not essential. Unless, of course, this turns out to be a symptom of a more fundamental error, either in the book files themselves (undiagnosed other than by Reports crashing) or in some part of Sigil code outside of Reports. It does look like something's throwing an exception and it's just not being caught at an informative place. I'll put a day into attempting to isolate the problem. (I've got about 30 years of software design/development behind me, and if there's a simple test case to be found, I should be able to find it in that time.) I also have a slightly earlier version that doesn't exhibit the problem, but I suspect that's of little value. If there's any way for me to run this under a debugger, I'd be happy to do that. But I'm really no longer set up to do development myself. Otherwise, stand by, and I should be able to get you a test case by tomorrow with any luck. |
|
09-27-2018, 10:30 AM | #4 | |||
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Quote:
Quote:
|
|||
09-27-2018, 11:00 AM | #5 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
It's not associated with your "Reports dialog open" bugs. That's some good news.
The other good news is that it's largely my fault -- partly for trying to be too clever within certain confines of CSS/HTML/XML. It turns out that one of my HTML files in the book is something I've been using as a "template" for creating a Chapter file for the book. I recently cleaned up and improved all the CSS (yuck!) for that since I use it to auto-generate chapter and section numbering -- but that's largely irrelevant. Except that when I did that I added a highly visible line in a <style> section in that HTML "template" file -- intentionally ill-formed CSS -- to remind me (if I missed it) that I had to set the chapter counter at that point in the HTML file. Sigil, in general, doesn't seem to care about this much, and just in Book View displays the red "This page contains the following errors" box -- which was precisely my goal to avoid overlooking setting that counter. But apparently this drives reports CRAZY!. It throws an exception (I guess, who can blame it). So I think that I can say I found the problem and it is I. I guess you might want to catch that exception a little better. Otherwise, Sigil just crashes if you have an error in one of your content files and run Reports on it. You can't really ignore it in Reports since it's an error in the HTML file. But probably not a real high priority. |
Advert | |
|
09-27-2018, 11:11 AM | #6 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yes, thanks. We will certainly want to fix the crash regardless.
But with regard to malformed xhtml, the Reports feature is not the only Sigil feature that could be adversely affected by intentionally leaving things not-well-formed (though they may warn rather than ungracefully crashing). Can you share an example snippet of a style section in an xhtml file that will make Reports barf on its own shoes? Or are you saying that any invalid style section causes the crash? Never mind. I've tested myself, that nearly any non-well-formed xhtml will cause a crash when Tools->Reports is initiated. Last edited by DiapDealer; 09-27-2018 at 11:20 AM. |
09-27-2018, 11:25 AM | #7 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
That's what I'd expect.
|
09-27-2018, 11:30 AM | #8 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
That should not be the case. If gumbo detects not well formed xhtml, the well formed checks should prevent Reports from being launched at all. If you launch Reports and then create broken xhtml and try to refresh it may crash.
|
09-27-2018, 11:34 AM | #9 |
Connoisseur
Posts: 72
Karma: 10
Join Date: Mar 2017
Location: Central NC
Device: Various
|
A possibly useful feature would be to flag each file in the Book Browser with some indicator that there is an error in it. That way the user wouldn't have to depend on actually looking at the file directly to see that there's a problem with it. But I know that this is just "one more feature" to add.
And in all honesty, I WAS intentionally ignoring the error in the file. Perhaps if I stash it in the Misc folder rather than the Text folder, things will work better. One pays for being sloppy. |
09-27-2018, 11:40 AM | #10 | |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I'm using a custom version of Sigil that's more recent that 0.9.10, but it sounds like the OP had been experiencing it in 0.9.9, as well. At least on Windows 10 (which is where I just tested it), anyway. I'll test on Linux when I get home (which often mirrors Windows crashes). |
|
09-27-2018, 02:43 PM | #11 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
I will try the same thing in my Mac when I get home.
|
09-27-2018, 03:11 PM | #12 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
It crashes for me too. That said if I try the same test with a div tag (a tag that html5 parsing rules do not allow to be unclosed) instead of a p tag, the non-well formed code is properly detected.
So the problem is gumbo is really a self-recovering html5 parser (like browsers use) and not a strict xml parser but the Reports tool uses Qt's overly strict pure xml parser. So according to gumbo an unclosed p tag is okay because the gumbo parser will "fix" it and technically is allowed in html5 according to those parsing rules. The well-formed check F7 properly detects the unclosed p tag but it is python-based and therefore slower than gumbo which can be used in a multithreaded manner safely. So either I need to teach gumbo to be more picky and throw more "errors", or we need to rewrite the Reports code to use the gumbo parser instead of the overly strict Qt xml parser. I think the way forward is to use the gumbo parser to generate the Reports and let Mend handle fixing things when the user wants which should make Reports much less crash prone in general. What do you think? |
09-27-2018, 04:15 PM | #13 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Alternatively, we could replace the more lenient gumbo well-formed check with a check using the QXmlStreamReader itself and catch exceptions and only allow strickly valid xhtml to be used by Reports.
... |
09-27-2018, 04:45 PM | #14 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Regardless of the method (to which I would defer to your expertise), I would personally prefer the outcome you described in the latter post: namely the Reports feature only running when all xhtml is strictly valid. That would (or should) avoid both the crashing and the potential for the modification of underlying code merely to be able to run the reports.
Have said that, however: I'm not one who really uses the Reports feature. We should probably get the opinions of some who use it regularly. Massage invalid code (invalid by strict xhtml rules) to allow Reports to run without crashing, or not allow Reports to be run when there's strictly invalid xhtml present. Assuming I've interpreted the gist of your propositions accurately, of course. Last edited by DiapDealer; 09-27-2018 at 05:03 PM. |
09-27-2018, 06:38 PM | #15 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
After looking, I think we should add a method to the HtmlResource object so that it will use the QXMLStreamReader itself to check itself for xml well-formedness and we can invoke those checks before launching the Reports. That will be easier than either trying to teach gumbo to be less lenient or trying to rewrite all of the Reports pieces to use gumbo.
I will try to get something working and pushed by tomorrow evening. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"date" reports correct time zone and time; UI reports a time several hours off | Synthead | Kindle Developer's Corner | 17 | 01-05-2015 05:10 AM |
Calibre crashes on dupes reports page after importing new books | juneloon | Library Management | 0 | 03-09-2014 12:14 AM |
Problem with reports on 0.7.4 | JimmyG | Sigil | 4 | 11-01-2013 12:55 PM |
Calibre reports? | calvin-c | Calibre | 1 | 02-25-2013 09:04 PM |
CES Reports | daffy4u | News | 0 | 01-08-2010 10:23 AM |