Bug 258606 - Infinite loop when horizontal and vertical scrollbars battle
Summary: Infinite loop when horizontal and vertical scrollbars battle
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmail
Classification: Applications
Component: messageviewer (show other bugs)
Version: 1.13.5
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 20:33 UTC by Matt Whitlock
Modified: 2012-08-19 11:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screen shot of a problematic message (145.04 KB, image/png)
2010-12-02 20:33 UTC, Matt Whitlock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2010-12-02 20:33:46 UTC
Created attachment 54004 [details]
screen shot of a problematic message

Version:           1.13.5 (using KDE 4.5.3) 
OS:                Linux

The conditions that cause this bug to manifest are extremely rare, but I've had it happen on more than one email message (spanning many months, if not years), and it's 100% reproducible on a message where it happens.  When it happens, I have to kill the KMail process because it's locked hard in an infinite loop (using 100% of one CPU core).

This happens when the text of a message has certain pathological dimensions and line breaking characteristics.  I think I've only ever seen it happen on Facebook wall post notifications, but I don't believe it's specific to anything in the message.

I will attempt to characterize the conditions that cause the problem as exactly as I can.  Reproducing this bug may be very difficult for someone else, as resizing the message viewer just a few pixels suppresses the bug (on this message, but probably causes it for another).

Reproducible: Always

Steps to Reproduce:
1. The message fits in the viewer with no scroll bars.  However, one line of the message contains no breaking whitespace and runs into the region where the vertical scroll bar would be if it were visible.
2. If the vertical scroll bar were then to be shown, it would force the long line to break onto a new line, thus increasing the height of the message.
3. The increased height now causes the message to run into the region where the horizontal scroll bar would be if it were visible.
4. If the horizontal scroll bar were then to be shown, it would no longer be necessary to break the long line, in which case the message would become short enough vertically to eliminate the vertical scroll bar.
5. Eliminating the vertical scroll bar means the entire message can now fit in the viewer with no horizontal scroll bar.
6. Return to step 1.

Actual Results:  
KMail hangs in an infinite loop.

Expected Results:  
Message is displayed with no scroll bars, as none are needed.

Interestingly, if I reposition the horizontal splitter in the inbox window and then select the problematic message, I can then move the splitter back to its original position without causing the hang.  However, if I then select a different message and then re-select the problematic message, KMail hangs.
Comment 1 Jan 2010-12-20 02:54:20 UTC
I had the same problem with a message with no body but with a JPEG base64-encoded JPEG.  KMail was adding and removing the vertical scrollbar in an infinite loop.  I could save the attachment after having removed the preview panel.  Slightly resizing the window made the problem go away.
Comment 2 Jan 2010-12-20 03:02:25 UTC
I meant JPEG attachment.
Comment 3 Christophe Marin 2011-02-14 15:25:41 UTC
Jan, is the issue you see reproducible with any picture ?

If I understand correctly the initial report, a way to reproduce would be:
- Open a message with a very long string/link that fits the whole width,
- Resize eg the message list to make scrollbars appear 

Then the issue is visible ? 

Can one of you test please.

Would be interesting if you could attach gdb to the KMail process when this happens:

gdb -p `pidof kmail`
(wait until the debug symbols are loaded)
thread apply all bt

then exit once you reach the end of the backtrace.
Comment 4 Jan 2011-02-15 02:07:03 UTC
> Jan, is the issue you see reproducible with any picture ?

Definitely not.  It's quite rare; I only had it once so far.  Since the size of 
a picture changes with the size of the KMail window, it is impossible to 
reproduce at will.  As Matt indicates, you'd have to get the exact window 
size, then exit KMail, then hope it happens when re-opening KMail.  Guessing 
that size with a picture is probably not doable.

> Would be interesting if you could attach gdb to the KMail process when this
> happens

If it happens, I certainly will.  In the mean time, probably Matt stands a 
better chance of catching it than I.
Comment 5 Matt Whitlock 2011-02-15 02:29:14 UTC
(In reply to comment #4)
> If it happens, I certainly will.  In the mean time, probably Matt stands a 
> better chance of catching it than I.

I'll see if I can create a message having the pathological conditions, make KMail hang with it, and get a stack dump with gdb. I compile my system (x86_64 Gentoo) with '-O3 -ggdb', so my stack traces will be of intermediate usefulness. I can recompile stuff without optimization if really necessary.
Comment 6 Myriam Schweingruber 2012-08-19 11:00:06 UTC
Thank you for your report. Kmail1 is currently unmaintained and the code has changed sufficiently in Kmail2 so the backtraces are not really useful anymore. Should you experience the same crash in Kmail 4.8.5 or later, please open a new report for Kmail2. Thank you for your understanding