Keyboard input stalls occasionally.

Asked by Charles Pergiel

Typing in Firefox, on blogger, gmail, and even in Launchpad, keyboard input will occasionally stall. For instance, it stalled right after the first word in this description when I realized I had made an error, and tried to backspace to correct it. It locked up for maybe ten seconds. Since then it has been fine, even when I make mistakes and have to use the backspace key, so I don't think that has anything to do with it. Basically, all this typing here is just to see if it locks up again, and it hasn't. The only thing I have running right now is Firefox with four tabs open, but no video, all pages are quiescent.

Ubuntu Version 11, all updates installed this afternoon. Nvidia's special drivers.

Question information

English Edit question
Ubuntu firefox Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Chris (fabricator4) said :

Yep, Firefox can need a lot of resources, especially on a single core machine with less than 1Gb of RAM. You could try Chromium or Google Chrome as an alternative to Firefox. I've found it quite useful on my EeePC and on this machine which is my beta test machine - a Celeron 2.8 GHz with 1 Gb RAM. Although Google Chrome needs more RAM, it seems to behave better.

A couple of things you can look at:

* Run top in a terminal window to see if something is eating CPU - sometimes Ubuntu will be indexing the installed applications against the repositories. While this is supposed to happen in the background and cause no problems, on a single core machine it can cause a noticeable lag. There are other background processes that can also be misbehaving. If you thing that Firefox is the only thing running, having a look at top might be an eye-opener.

* Run free in a terminal window and see if the swap partition is in heavy use (and make sure you actually have one). If things are being swapped in and out of memory it can cause a noticeable lag.

What's your CPU, and how much RAM? Once I moved my main Ubuntu install to my dual core machine most of these problems because non-existent.


Revision history for this message
Eliah Kagan (degeneracypressure) said :

Besides Chromium as Chris suggested (which is the browser I use most, both on slow and not-so-slow machines), you might consider Midori as an alternative browser. You can get Chromium on Ubuntu by installing the package called chromium-browser (the package called chromium is something totally different), and you can get Midori on Ubuntu by installing the package called midori. You can install these packages in the Software Center.

One thing you might check is what programs are taking up high CPU resources. The processor is just one resource, and it is not necessarily the limiting factor in your slowdowns (for example, perhaps the delay represents Firefox swapping data between RAM and disk). But sometimes, a plugin can monopolize lots of CPU. This especially happens with the proprietary Flash plugin from Adobe. The name of the program for this, when you look it it in top ( or the System Monitor (a GUI tool, which you might prefer), is npviewer.bin. If this is taking up lots of CPU or terminating it temporarily stops your slowdowns (until it is automatically launched again for later Flash content), then it is likely responsible.

Revision history for this message
Charles Pergiel (c-pergiel-c) said :

You guys beat me to the punch. After I posted my question I remembered that there is a Revolver Map on my blog which uses an abode flash thing. Adobe's plug-in-container.exe is causing a lot of trouble on my Windows machine. It will start hammering on the disk and just won't quit. Killing it using task manager has become a standard part of my life. But that is Windows, so when I saw your statement, it confirmed my opinion of Adobe:

But sometimes, a plugin can monopolize lots of CPU. This especially happens with the proprietary Flash plugin from Adobe.

Except, when I started typing this reply, the keyboad hung up for a couple of seconds. Besides Firefox the only application I have running is a terminal window and it is just sitting there.

I have two tabs open on Firefox: Gmail and launchpad. I don't think there are any Adobe things on a Gmail page. I ran top and didn't see any.

The mouse hangs up sometimes as well. Sometimes it is understandable (six browser tabs all with video ads on them), but still really stinky.

The Zbox has a Dual-Core Intel Atom cpu and 2 gigs of RAM. At least that is what it is supposed to have.

My view is that the highest priority task of a PERSONAL computer should be responding to user input. I don't care how important those other tasks think they are. If I type something, I want to see that key on the screen, now, not whenever you get around to it.

The keyboard spaced out three times while I was writing this. The last time I kept typing to see if it was dropping characters, or just being slow on putting them on the screen. I typed about ten characters before it came back to life, and it had dropped all of them. I don't know how fast I type, but I am thinking something like 3 or 4 characters per second.

Revision history for this message
Chris (fabricator4) said :

It's not normal to drop characters. When my Celeron DE grinds to a halt it seems to buffer the keystrokes just fine. If there's no flash stuff running that doesn't really happen anyway. Bit hard to get away from some of the advertising on some sites however... If flash is not a big deal for you, remove the flash plugin completely and enjoy the extra speed and hardly any animated ads.

Unfortunately the atom processor is designed for very low power consumption, not performance. My understanding is that a 1.8GHz Atom processor performs about the equivalent of a 1 GHz Celeron. This was based on a comparison I saw somewhere, for netbook CPUs - not a bad trade-off for the extra battery life. I've never seen anything on the Diamondville dual core, but I know it's clocked at 1.8 GHz. You'd expect it to perform very favourably compared to the single core, but if your CPU is hitting close to 100% it's a fair indication that you've met the performance limits somewhere.

There's a couple of things you need to check. Is the clock in fact running at the frequency it is supposed to? The Linux Kernel has problems controlling some BIOSs in this area - scalable clock speeds (it only runs the CPU as hard as it needs to) that won't run at higher rates and that sort of thing. I've also heard of the opposite problem - disabling ACPI (acpi=off in /etc/default/grub) causing overclocking and CPU overheating.

You need to get some monitoring software up and running until you find out exactly what the problem is. Personally, I use Gkrellm which might be able to report both clock speed and core temperature. There's panel indicators in 10.04 LTS for core temperature and other things but I don't know if it's possible to implement them in 11.04 - configurability of app indicators is one thing we lost with the last release. If you type 'sudo lshw' on the command line you'll get a list of hardware including the CPUs and what clock speed they are running at

Lastly, consider (as I did for my EeePC) if Lubuntu is a better option on your machine. It has a very light DE with Chromium as the default browser, and runs very well on any machine I've tried it on. If you don't want to go that far, you could try the classic interface instead of Unity. If there's a conflict with the built in GPU running Unity it should make things much nicer.


Revision history for this message
Charles Pergiel (c-pergiel-c) said :

I seriously doubt whether this is a performance issue. I have Roku box which is the size of a paperback book, has no fan and can stream high quality video from Netflix without a hiccup. At least it doesn't hiccup very often.

I suspect that the problem here is that somebody is blocking keyboard interrupts when they shouldn't.

[begin vent] We have DMA controllers to perform bulk transfers of data, a GPU to arrange stuff for the screen. There's really no excuse for this kind of behavior. Even when Adobe's plug-in-container is going wild on Windows, all the action is on the disk. CPU usage is hardly impacted. The slowdown the user sees on Windows should be blamed on Windows' neolithic task management, or lack thereof. Linux should be better in this area, shouldn't it? Or do we have some rock hounds engaging in primitive hand shake rituals that capture the CPU's complete attention until they are done? [end vent]

Revision history for this message
Charles Pergiel (c-pergiel-c) said :

I probably should have mentioned this before. I am using an IOGEAR wireless keyboard.

I didn't mention it earlier because I suspected it might be the reason I wasn't able to get into the BIOS on this Zotab ZBOX. I bought a cheap, wired, UBS keyboard to try and get into the BIOS. It didn't help. The only reason I couldn't get into the BIOS is that I was waiting for something to show on the screen. However in this case, once that happens, it is too late. You have to hit the delete key BEFORE anything shows up on the screen.

Since the wireless keyboard was not at fault in that problem, it couldn't be at fault in this, could it?

Meanwhile, I have noticed another keyboard mouse problem.

At power on, or waking up from sleep, the mouse (trackball) won't move until a key is pressed.

Revision history for this message
Chris (fabricator4) said :

I agree with you about the performance issues. I was fairly shocked when I discovered how poorly 11.04 ran on my EeePC 901 and other Celeron. However, Ubuntu has never claimed or tried to be the lightest distribution available. Earlier releases were suitable for use on older hardware, but I think I'm having to re-think that recommendation now.

This is why I recommended Lubuntu to you. It's one of the lightest (and therefore very fast) distributions while still being withing the Ubuntu family and all that comes with it. I hope that Lubuntu gains official status soon.

Regarding the wireless keyboard: Since it is not hardwired, it's not using the usual hardware interrupt so that might be why keypresses are not being buffered. a little wrinkle I hadn't considered.

On your mouse problem - not waking up until a button is pressed, it could actually be a bug. It might be better to open another question regarding this, and search the launchpad bugs to see if there are any already logged. You can add your data to the existing bug report which is much better than opening another.


Revision history for this message
Charles Pergiel (c-pergiel-c) said :

True, the wireless keyboard is not hardwired to the computer, but, the dongle is. I don't think that makes any difference however. I don't think one of the four wires in a USB connector is a dedicated wake up line. I imagine there is some timer driven routine running that periodically checks the USB system for any requests.

This is NOT a performance issue. It might be a scheduling problem, or a problem with critical regions. It might even be a problem with the wireless keyboard, though I kind of doubt that since I wasn't able to find any reports about this keyboard dropping characters.

On the other hand, why isn't any one else complaining about it? I am beginning to suspect that it just my particular combination of hardware and software that is not working.

What's worse is that it comes and goes. I have been working on this message for some minutes now and I haven't had any problem. Earlier though, on another page, it was giving me fits.

Maybe it's a network problem? If these web page message box editors are sending every character back to the server over the net, and then waiting for a response to display the character, well . . .

So that's my new question. Are these web page message box editors acting locally, or is the editor program running on the server? And how can you tell?

Revision history for this message
Launchpad Janitor (janitor) said :

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Eliah Kagan (degeneracypressure) said :

I'd recommend reporting a bug for this (make sure to read carefully first, and then report the bug by invoking ubuntu-bug with the PID of the running firefox process shortly after you have noticed the lag, without restarting the browser in between--you can use apport-cli instead of ubuntu-bug if you'd prefer to author the bug report on another machine or in a non-default browser, to avoid experiencing the lag while composing it).

Reporting the bug may help to determine if others are experiencing it--this will give anyone else who is experiencing it the opportunity to indicate that they are.

"Are these web page message box editors acting locally, or is the editor program running on the server?"

What do you mean by "the editor program"? Your web browser provides the text box and various controls, and it submits data to the server, which runs a database that accepts the data and performs various actions based on it (changing the appearance of the web page to include it, sending out email notifications to subscribed users, and so forth). Like everything on the web, it is some combination of the two.

If you are asking if accessing Launchpad it like running a Flash or Java applet that accesses the server through its own application-layer protocol and uses the web only as a coarse container, the answer is no.

Revision history for this message
Charles Pergiel (c-pergiel-c) said :

By "the editor program" I mean the code that is taking your keyboard inputs and deciding what characters should be displayed on the screen.

If you are using a text editor program like Gedit, it is a local program. If you are using a web browser, there is no telling where those keystrokes are going. It could be a part of the browser or a plug-in, or it could be sending each and every character back to the mothership and waiting for instructions to come back before it puts anything on the screen. How would you know? To me it wouldn't make sense to send every character over the internet, back to the server, but as fast as the net is, and the limited functionality of html, maybe that's the way everyone is doing it these days.

Revision history for this message
Eliah Kagan (degeneracypressure) said :

Though with contemporary web technologies it would be possible to send information about each keystroke to the web server and display characters only as told to do so by the server, that is indeed not the way that any website I have ever examined has worked. Launchpad certainly does not work that way. On Launchpad and most other sites, typing into a textbox that is embedded in a web page works like typing into a text box that is part of a text editor program like gedit. The web browser is the program providing the text box, in the sense that you are asking.