Bug 289427

Summary: plasma-desktop freezes when selecting fixed-size fonts in the clock widget
Product: [Unmaintained] plasma4 Reporter: Fabian Henze <flyser42>
Component: widget-clockAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: adaptee, annma, chaofeng111, diego.viola, johan162, maris.kde, rshah0385
Priority: NOR    
Version: 4.9-git   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.0
Sentry Crash Report:
Attachments: strace of the freeze in plasmoid-viewer
plasmoidviewer-digitalclock.txt.gz
Fix the bug by break from the endless loop if max font size reached

Description Fabian Henze 2011-12-20 13:05:53 UTC
Version:           unspecified (using KDE 4.7.3) 
OS:                Linux

When setting "weird" fonts (I guess it's related to fixed size fonts) in the clock widget settings, plasma-desktop and X start to consume 100% CPU time and plasma-desktop freezes.
I can reproduce that reliably with the "Fixed" font.


Reproducible: Always

Steps to Reproduce:
1. Configure the clock widget to use "Fixed" font
2. Apply settings


Expected Results:  
Either the clock widget should work with fixed-size fonts or refuse to use these fonts.
Comment 1 Anne-Marie Mahfouf 2011-12-20 13:42:05 UTC
I cannot reproduce (I set the font to "misc fixed")
Is it the digital clock in panel? Does it also happen if the widget is on desktop? And for the analog clock? and other widgets? please elaborate on what exactly happens
Comment 2 Fabian Henze 2011-12-20 21:12:10 UTC
Created attachment 66958 [details]
strace of the freeze in plasmoid-viewer

relevant (repeating endlessly) is the following part:

writev(7, [{".\21\2\0AO\200\t\224\24\r\0@O\200\t\1\0\0\0003\0\0\0\4\0\6\0\377\377\6\0"..., 924}, {"-*-Cure-*-*-*-*-*-*-*-*-*-*-*-*", 31}, {"\0", 1}], 3) = 956
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1\0?\f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"1\21\n\0\377\377\37\0", 8}, {"-*-Cure-*-*-*-*-*-*-*-*-*-*-*-*", 31}, {"\0", 1}], 3) = 40
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1\0@\f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096) = 32
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"1\21\t\0\377\377\34\0", 8}, {"-*-*-*-*-*-*-*-*-*-*-*-*-*-*", 28}, {"", 0}], 3) = 36
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1\0A\f\376\217\1\0z\31\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
read(7, "ed-bold-r-normal--15-140-75-75-c"..., 405528) = 123904
read(7, 0x1ff7920, 281624)              = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "new century schoolbook-bold-r-no"..., 281624) = 128000
read(7, "er-bold-r-normal--10-100-75-75-m"..., 153624) = 128000
read(7, "5-75-p-0-iso8859-2K-adobe-new ce"..., 25624) = 25624
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"-\21\25\0CO\200\tF\0\r\0-bitstream-Bitstream"..., 92}, {NULL, 0}, {"", 0}], 3) = 92
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1\0C\fA\3\0\0\370\377\0\0\24\0\353\377\270\377\350\200\0\0\0\0\31\0l\0w\0r\0"..., 4096) = 3364
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"\21\21\2\0\265\4\0\0", 8}, {NULL, 0}, {"", 0}], 3) = 8
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1\0D\f\24\0\0\0M\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 112
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x13883f4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
Comment 3 Fabian Henze 2011-12-20 21:20:08 UTC
(In reply to comment #1)
> I cannot reproduce (I set the font to "misc fixed")
I don't have "misc fixed" on my system, can you try other random fixed-size/bitmap fonts?

> Is it the digital clock in panel? Does it also happen if the widget is on
> desktop?
both (and in plasmoid viewer as well, see comment #2)

> And for the analog clock? and other widgets? please elaborate on what
> exactly happens
It's not possible to change the font of the analog clock, so no. I don't know if it happens in other plasmoids, too.
I checked the Notes plasmoid and that seems to work fine with fixed size fonts.
Comment 4 Anne-Marie Mahfouf 2011-12-21 10:46:33 UTC
Tried several fixed fonts and cannot reproduce. The strace seems to say it can't access the font. 

The code for the font is specific to the Digital Clock though but I can't investigate further without reproducing.
Comment 5 Anne-Marie Mahfouf 2011-12-21 10:47:47 UTC
Comment on attachment 66958 [details]
strace of the freeze in plasmoid-viewer

can't read the attachment!
Comment 6 Fabian Henze 2011-12-21 11:01:09 UTC
Created attachment 66969 [details]
plasmoidviewer-digitalclock.txt.gz

Thats weird, the attachment opens fine in kwrite on my system ...
I reuploaded it as a gzip compressed file
Comment 7 Reza 2011-12-22 03:57:55 UTC
I tried on 4.7.4. After several try, i managed to get plasma freeze.
I have two screen, at other screen i put digital clock at desktop.
I'm not sure if screen setup has relation or not.

I tried changing the font to 'Fixed' , 'Nil', 'unifont.pcf', and after several tries, after i click Apply button, the dialog won't disappear.
Comment 8 Reza 2011-12-22 14:26:56 UTC
*** Bug 279323 has been marked as a duplicate of this bug. ***
Comment 9 Reza 2012-07-11 13:27:26 UTC
I can reproduce this, but not easy in master.
Changed some fonts from fixed size to normal size or from fixed to fixed.
I managed to freeze plasma after changing fonts several time.

Steps:
- right click digital clock plasmoid at panel
- open digital clock settings
- select fixed font
- click OK
- repeat
Comment 10 Johan 2012-10-05 18:52:43 UTC
I can reproduce this not only with fixed with fonts but almost any font (fro example Adobe New Century Schoolbook). I''m using the RPM pre-built KDE for OpenSuSE 12.2

This can be repeated in both 4.8.x as well as in bleeding edge 4.9.2 release. The desktop freezes but window manager seems to be responding. All widgets and panels are frozen though.

This is 100% repeatable for me. If someone can give me some hints on providing useful debug information about the hang I'll be glad to help. I'm a developer but not with KDE (or Qt) so I'm not that familiar with KDE on an architectural level.
Comment 11 Myriam Schweingruber 2012-10-11 13:04:33 UTC
Settings status to confirmed
Comment 12 Diego Viola 2012-12-26 14:18:36 UTC
I think I have this problem too, I couldn't understand why plasma-desktop would freeze with 99% of CPU usage on a fresh install of KDE 4.9.4.

The problem was gone when I installed ttf-dejavu.

My system is archlinux x86_64, KDE 4.9.4.
Comment 13 Chao Feng 2012-12-31 13:01:25 UTC
Created attachment 76114 [details]
Fix the bug by break from the endless loop if max font size reached

I find where the problem is. In the Clock::expandFontToMax function, there is a do...while loop. If max size of font is smaller than the while condition, the loop will never end. The attached patch fix the problem by check whether the width and height can be extended.
Comment 14 Diego Viola 2013-01-02 17:33:37 UTC
Is this problem still present in KDE 4.9.5 or 4.10?

Thanks.
Comment 15 Jekyll Wu 2013-01-08 12:49:39 UTC
@rainofchaos@gmail.com, you should  use https://bugs.kde.org/enter_bug.cgi?product=sysadmin&format=guided to request the permission of editing bugs. Otherwise, your commit hook won't work .