linux - Why does computer hangs everyday?

06
2014-04
  • glebiuskv

    My Linux computer hangs every day (sometimes twice a day). It also hangs my home network until the Ethernet cable is unplugged or I reset it. I can`t find any severe exceptions in log. This computer works in 24/7 mode. It holds torrent downloads, tomcat for my work and also play an HTPC role. How would I go about troubleshooting this issue?

    Update1.

    I use Gentoo.

    UPDATE2.

    Hangs happen at random time, mostly when nobody is using the computer. It shows the last image before freezing (screensaver, browser or whatever else), I can't do anything, and doesn't respond without a restart. smartctl shows that temperature gradually increased for 4-5°C in 5-10 minutes before it dies. I have 16GB of RAM and 32GB of swap (I planned to use suspend on disc function when make partition). Normally it holds smb shared folder, runs squid, deluge,tomcat and audio-video players in xfce environment.

  • Answers
  • Matthew Williams

    If you wish to run through some default troubleshooting steps and see if you get anywhere give these a try.

    Once again I have no idea what system you are running, so this might not be exact, but it's a start.


  • Related Question

    troubleshooting - Why does restarting a computer fix things?
  • RSolberg

    The title say sit all, but why does restarting a computer tend to fix things? It seems like IT folks always ask, "Have you restarted your PC?" But Why?


  • Related Answers
  • tjrobinson

    Basically because anything that's got in a mess gets the chance to start over. Imagine you're making toast and you burn it. Throwing it away and starting again is one way to fix that problem and will always work out better than scraping the burnt bits of toast off.

  • kinokijuf

    One of the major reasons your computer slows down is that its Random Access Memory (RAM) is being used. The operating system, as well as the programs you're running, all use RAM. However, there's only so much of it, and it can only be accessed so fast. If your computer is trying to use a lot of RAM (often more than is availablee), it slows down. It needs to create files extra swap files on the hard drive to act as extra, but less efficient, "RAM". This, among other things, makes your computer slow down.

    Closing some programs should free up RAM space, but memory leaks may have occurred. That means that the program may have accidentally taken up RAM that it didn't/couldn't free up when it closed. "Ahhh" you say, "it's going to eat up all my RAM!" Nope. If you restart the computer, all the RAM is cleared out. You've got more avaliable RAM, so your computer can run faster.

    There are other problems that could be fixed by a restart, too. For example, if a program somehow begins to use a huge amount of processor cycles (each cycle consists of a calculation, and all of these calculations make your computer "compute", aka work). When the computer is restarted, the control of the processor is unconditionally given to the bootloader, and then it's handed off to the OS, which can start from scratch. It's no longer being dominated by the greedy program.

    Yet another possibility is that the computer was overheating. Overheating, simply put, isn't good for the computer. Turning a the machine off and leaving it to cool for a few minutes couldn't hurt. In fact, some (if not all) computers are set to shut down if they reach a certain internal temperature.

    In summary, a restart puts the computer into a state where the right software is controlling the right (possibly cooler) hardware, in a state this is already known to work right.

  • David Hayes

    Good question! The short answer is "it depends"

    The longer answer is that Windows has limited resources for applications to use (Memory, Window Handles, File Handles etc.) if a badly written application doesn't give these resources back to Windows when it's finished you Windows run out of resources. This causes problems with other applications. Obviously the same applies to all other operating systems too

  • jerryjvl

    Two reasons:

    • The OS and software gets to start with a clean slate
    • Any OS / driver updates or installs that have occurred since the latest reboot may need a chance to be part of the boot sequence
  • Zac B

    I know this is an ancient thread, but I feel like this post by a Microsoft developer explains why:

    1. Restarts are often necessary after software upgrades/changes.
    2. This is by design.
    3. This is the way it should be.
    4. This is better than the alternative (and how the alternative works).

    Gradual slowness and other restart-needing issues can often be chalked up to memory leaks. Contrary to @user2630's comments, this is still a very real problem in modern Windows. Either from services/system components that stay running, preventing their memory being reclaimed on quit, or just from a plurality of running applications that a user started, leaks occur all the time--sometimes severely. In the latter case of running applications, it's often just simpler for an IT guy to say "just restart it", instead of "close all of your apps, check the task tray to make sure they're really gone, make sure they're not running any background processes or services..." you get the idea.

    As was mentioned elsewhere here, a lot of other restart-needing problems are from plain old bad/broken software (hung services, infinite waiting on shared resources, etc etc.). I think that leaks and pending library changes explain the majority of the boilerplate-restart-troubleshooting out there, though.

  • Ash

    Have you ever watched "The IT Crowd?"

    IT support people use "Try restarting it" as the first response because:

    1. It often will make the problem go away, at least temporarily.
    2. They don't need to exert any further effort.
    3. They don't need to have face to face contact a human being.
  • Drake

    To clean the RAM probably