[SOLVED] Apps freezing for several seconds in stretch

If none of the more specific forums is the right place to ask

[SOLVED] Apps freezing for several seconds in stretch

Postby Faroe » 2017-04-15 12:59

Hello!

There's a problem that has been occurring in my Debian testing system for about two months now. Some apps such as Mirage, Thunar and Audacity tend to freeze occasionally. The freeze usually lasts for about 5 to 10 seconds, during which time the frozen window won't refresh or respond to mouse or keyboard input.

One test case that seems to reproduce the problem rather predictably goes like this:
1. Open some directory in Thunar that contains a lot of image files, like more than 100.
2. Open one of the images in Mirage.
3. Launch Gimp and open some image there. It doesn't have to be from the same directory.
4. Start browsing the images in Mirage by stepping forward one image at a time (pressing the down arrow key).
5. At some point, Mirage freezes, and wakes up after five to ten seconds. Any further keypresses get buffered, so that when the freeze is over, Mirage jumps forward several images.

I haven't been able to verify if Gimp always becomes similarly unresponsive at the same time as Mirage, but I've seen it happen at least on some occasions. When Gimp is not running, Mirage seems to work without any problem.

The issue is much worse in Audacity, where the freezing is more frequent and is not affected by Gimp. One symptom in Audacity is that the playback of four track audio stops suddenly and resumes a couple of seconds later with the tracks playing out of sync. However, I have no idea if this is even caused by the same problem.

My system:
- OS: dual booting Debian stretch (Linux 4.9.0-2-amd64) and Windows 7 Professional
- CPU: Intel Core i5-6400 2.70GHz
- GPU: Asus GeForce GTX750Ti 2GB (running the proprietary nvidia driver)
- RAM: Kingston 8GB 2400MHz DDR4
- Motherboard: ASUS H170M-PLUS LGA1151
- Hard drives: one 250GB SSD + one 250GB HDD

Now, I know I need to narrow this down, but I don't really know where to look. Things I have tried:
1. If I run Mirage and Gimp from a terminal, neither of them output any error messages when the freeze occurs.
2. I thought there might be something wrong with my WM or DE (Xfce), so I installed jwm and tried Mirage + Gimp there. The same freeze happened.
3. It seemed that the problem had first appeared after the Linux kernel was upgraded from 4.8.0 to 4.9.0 in late January, so I booted 4.8.0, but that made no difference either. I haven't tried any earlier kernel version, because I'm fairly certain that at least Audacity worked perfectly in early January, when running the 4.8.0 kernel.

There must be some log somewhere that I could look at, but I don't know where. I've tried `journalctl -b --no-pager`, `dmesg` and even `dbus-monitor --session`, but nothing comes up. I have also installed mcelog and it is running as a daemon, but `/var/log/mcelog` stays empty. There's nothing in `/var/log/Xorg.0.log` or `~/.xsession-errors` either.

I'm worried this could be a hardware issue. I have seen Thunar sometimes freeze in a similar fashion when navigating to another directory, but this is very difficult to reproduce. I bought the PC in early 2016 and it used to run both Debian and Windows flawlessly for a year. I've got an SSD and and an HDD, and they both contain ext4 partitions as well as NTFS partitions. Debian's root and Windows are on the SSD; my /home is on the HDD. I have run `fsck` on the ext4 partitions and checked the NTFS partitions using ScanDisk (or whatever it's called) from Windows, and found no errors.

There's also a strange crashing problem in Windows 7 that I think may have started happening around the same time the first of these freezes occurred in Debian. Windows just reboots the machine without warning, out of the blue, when I'm not even running any particularly demanding software. This has happened maybe four or five times. Debian never completely crashes on me, so I'm not sure this is related. Anyway, I think I should run memtest86+ as my next step.

Is there anything else I could do to locate the source of the freezes? Please let me know what other information I could provide. I'm sorry this post is rather long, but I didn't want to sound like "Debian keeps freezing. Please help me fix it."

Thank you for your help and patience!
Last edited by Faroe on 2017-06-02 17:47, edited 1 time in total.
Faroe
 
Posts: 14
Joined: 2013-06-04 19:26

Re: Apps freezing for several seconds in stretch

Postby pylkko » 2017-04-15 15:00

Just to be sure, you could do a memtest. You could also try and see if some hard stressing (like with package stress or other similar) causes these freezes. Also, smart test. What i/o-scheduler are you using?
User avatar
pylkko
 
Posts: 1213
Joined: 2014-11-06 19:02

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-15 16:28

Is it overheating? Check CPU and GPU temperatures.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Apps freezing for several seconds in stretch

Postby Faroe » 2017-04-15 17:08

pylkko wrote:What i/o-scheduler are you using?


I wouldn't have been able to answer that, but I investigated a bit. The commands `cat /sys/block/sda/queue/scheduler` and `cat /sys/block/sdb/queue/scheduler` both give this output:
Code: Select all
noop deadline [cfq]


Is this what you meant? I assume these are the defaults. I wasn't even aware of different I/O schedulers until today. Thanks for the tip!

My SSD is /dev/sda and the HDD is /dev/sdb. Should I be using a different scheduler with either or both, and if so, how would I do that?

I launched memtest86+ 5.01 and pressed F2 to use multi-threaded mode. It froze completely after 90 seconds and I had to reboot. Then I restarted it in fail-safe mode and kept it running for three hours, during which time it went through two and a half passes and found no errors. I'm going to leave it running overnight to get a better picture.

phenest wrote:Is it overheating? Check CPU and GPU temperatures.


At the moment I don't seem to have any means of checking those in Debian, but I'll experiment a little with the lm-sensors, hddtemp and xfce4-sensors-plugin packages and report back later. Thank you!
Faroe
 
Posts: 14
Joined: 2013-06-04 19:26

Re: Apps freezing for several seconds in stretch

Postby Faroe » 2017-04-16 15:42

A quick update. So far this doesn't seem to be a case of faulty memory or overheating.

1. I left memtest86+ running for 14 hours (no multi-thread mode or fail-safe mode). It went through ten passes and found no errors.
2. According to psensor, the temperature of all four CPU cores stays between ~16°C and ~20°C while Mirage is running and even when it freezes. The CPU's "physical" sensor reports 25°C (+/-1).
3. psensor and nvidia-settings both report a steady 29-30°C GPU temperature before and during a freeze.
4. I performed the "short" self-test on both the SSD and the HDD via GSmartControl and no errors were found. The "extended" test would take 2 hours on the SSD and 90 minutes on the HDD, so I'll try them later.

I haven't tried changing the I/O scheduler yet. Is it always a good idea to use "deadline" with an SSD, as suggested in the Debian Wiki (https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler)? Are there any caveats? Shouldn't it be the default?

One thing I only found out about today is the "discard/TRIM" problem that many SSD's seem to suffer from. I'll have to look into it to see if that could be relevant here.
Faroe
 
Posts: 14
Joined: 2013-06-04 19:26

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-16 15:55

Faroe wrote:2. According to psensor, the temperature of all four CPU cores stays between ~16°C and ~20°C

This seems rather cool. What CPU cooler are you using? Liquid cooling? I would've expected a temperature twice that.
Faroe wrote:One thing I only found out about today is the "discard/TRIM" problem that many SSD's seem to suffer from. I'll have to look into it to see if that could be relevant here.

I doubt it's relevant. If the program has loaded into memory and then freezes, then it's not the hard drive. If the hard drive was at fault or something like TRIM/discard was an issue, then I would expect the whole OS to be struggling.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Apps freezing for several seconds in stretch

Postby pylkko » 2017-04-16 20:26

Yeah, the only reason I thought about I/O-scheduler related issues was because you were saying that you were loading massive amounts of images or something from a traditional HDD, so I thought that perhaps the I/O load is "blocking". With simple schedulers that do not prioritize workloads it is possible that there is contention for available I/O bandwidth from other applications. Also maybe you could have been using one of the newer experiemntal ones or something But you are using CFQ. The Debian wiki, by the way, states that one should use Low-Latency I/O-Scheduler for SSD drives because:
https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler wrote:The default I/O scheduler queues data to minimize seeks on HDDs, which is not necessary for SSDs. Thus, use the "deadline" scheduler that just ensures bulk transactions won't slow down small transactions

Since you have fairly extensively tested the RAM, the drive, the CPU is not overheating (although those numbers look suspicious to me too, standard room temp is 22 °C. cpu temp should no be less than that in normal setups), there are no log errors, it is starting to seem like there might be some software problem. Either bugs in testing of some kind or perhaps you have some kind of configuration problem. One thing that comes to mind at this moment is if you disabled swap entirely or made swappiness zero and then had some memory leaking process that could lead to "out of RAM". But then again this is happening on Windows also. On that information alone I would have suspected RAM or a bad sector in some part of the disk that holds Windows system files. It might be that the SSD is going bad, or perhaps it is not tolerating some powersave property. Is this a SATA drive? SSD's can just one day die without any preceding smart warnings.
User avatar
pylkko
 
Posts: 1213
Joined: 2014-11-06 19:02

Re: Apps freezing for several seconds in stretch

Postby Faroe » 2017-04-17 11:23

phenest wrote:
Faroe wrote:2. According to psensor, the temperature of all four CPU cores stays between ~16°C and ~20°C

This seems rather cool. What CPU cooler are you using? Liquid cooling? I would've expected a temperature twice that.


No liquid, but instead a Cooler Master Hyper 212 EVO fan. Some cores do momentarily peak at 30-35°C when launching programs such as Gimp, but they cool down again right after. Mind you, I haven't really watched the temperatures while putting the machine under a heavy load. I guess I should try out the stress and stress-ng packages.

Some new observations:
1. I changed the I/O scheduler of the SSD to "deadline" but that didn't stop the freezing.
2. I copied a total of ~560 photos from a DVD to two partitions on my HDD (one ext4, the other NTFS) using Thunar. The copy operation itself went smoothly, but Thunar became unresponsive immediately after that and stayed frozen for at least ten seconds. This kind of thing has happened a several times during the past two months. I thought it worth mentioning in case it helps locate a possible cause of the problem.
3. I did some image manipulation work in Gimp and it kept freezing every couple of minutes, for about five seconds at a time. I wasn't looking at the temperatures at the time, but I checked the graphs in psensor later and it seemed like the CPU had stayed between 20°C and 30°C.
4. I ran the extensive self-tests on both hard drives in GSmartControl and there were no errors. There was a warning that the Samsung SSD didn't report the correct checksum for the self-test log, but apparently that's nothing to worry about.

pylkko wrote:Is this a SATA drive?


Yes. Here is a snippet of the output from smartctl regarding the SSD:
Code: Select all
=== START OF INFORMATION SECTION ===
Model Family:     Samsung based SSDs
Device Model:     Samsung SSD 850 EVO 250GB
Serial Number:    S21PNXCG956720H
LU WWN Device Id: 5 002538 d4059bf26
Firmware Version: EMT01B6Q
User Capacity:    250,059,350,016 bytes [250 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4c
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon Apr 17 14:41:03 2017 EEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


For what it's worth, this is what it says about the HDD. I don't know why no SATA version is reported.
Code: Select all
=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar SE Serial ATA
Device Model:     WDC WD2500JS-55NCB1
Serial Number:    WD-WCANK7837050
Firmware Version: 10.02E01
User Capacity:    250,059,350,016 bytes [250 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7 (minor revision not indicated)
Local Time is:    Mon Apr 17 14:39:55 2017 EEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


pylkko wrote:it is starting to seem like there might be some software problem.


I hope so too. I'd hate to have to start replacing my hardware, especially considering it's not very old yet. I wonder what the problematic software could be, however. A probable cause would seem to be some library that all these apps depend on, or more likely, somewhere higher up the dependency chain.

For a while it seemed like all programs affected by this were GTK+ 2 apps (Mirage, Gimp, Audacity, Thunar, Libreoffice), and that most often more than one would freeze simultaneously, while GTK+ 3 programs (Xfce4 Terminal, Psensor, Galculator) would keep running without problems. However, there's Firefox, which I think also depends on GTK+ 2 and has been running nicely even while those other apps freeze. On top of that, even Psensor froze up on me for a short while today.

One thing I haven't tried yet is running `fstrim` manually. At this point I don't know if any trimming of my SSD has ever taken place. Doesn't Windows take care of that? I'll have to study `fstrim` some more to determine if it's even safe.

Thanks for all your help so far. The quest continues.
Faroe
 
Posts: 14
Joined: 2013-06-04 19:26

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-17 11:56

Before you wear out your SSD doing extensive tests, you need to stand back and look at this objectively.

To start with, what are your start up and shutdown times like? If they are "normal", that is no freezing/pausing, then I don't think your SSD's nor the filing system is at fault. No amount of tweaking in that area is going to fix it if it's not the entire system that has issues.

I think you need to make a list of "affected" programs and look for common factors. Are all programs affected? Is it only ones with high CPU usage? Or high RAM usage? Or high hard drive usage? Or a combination?

Faroe wrote:
phenest wrote:
Faroe wrote:2. According to psensor, the temperature of all four CPU cores stays between ~16°C and ~20°C

This seems rather cool. What CPU cooler are you using? Liquid cooling? I would've expected a temperature twice that.


No liquid, but instead a Cooler Master Hyper 212 EVO fan. Some cores do momentarily peak at 30-35°C when launching programs such as Gimp, but they cool down again right after. Mind you, I haven't really watched the temperatures while putting the machine under a heavy load. I guess I should try out the stress and stress-ng packages.

Those temperatures still seem too cool. What temperatures does the BIOS report? I wouldn't stress test the CPU in case those reported temperatures are wrong. When was the last time the thermal paste was changed?
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Apps freezing for several seconds in stretch

Postby acewiza » 2017-04-17 13:32

Try using a FM other than Thunar and see what happens.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.
User avatar
acewiza
 
Posts: 272
Joined: 2013-05-28 12:38
Location: Out West

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-17 14:14

I just noticed you dual boot with Windows 7. Does that still work ok? Install CoreTemp in Windows and compare CPU temperatures. Do some similar work in Windows to see if that freezes. Do tests to compare Windows with Debian. That way you can eliminate a lot of hardware, or find a common factor.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Apps freezing for several seconds in stretch

Postby acewiza » 2017-04-17 16:14

phenest wrote:I just noticed you dual boot with Windows 7. Does that still work ok? Install CoreTemp in Windows and compare CPU temperatures. Do some similar work in Windows to see if that freezes. Do tests to compare Windows with Debian. That way you can eliminate a lot of hardware, or find a common factor.

Rather than wasting time playing with temperature experiments, the guilty piece of software might be discovered by a simple process of elimination. Thunar is well-know for freeze issues.
Nobody would ever ask questions If everyone possessed encyclopedic knowledge of the man pages.
User avatar
acewiza
 
Posts: 272
Joined: 2013-05-28 12:38
Location: Out West

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-17 17:26

Except that it's not just Thunar. The OP said GIMP did it, amongst others. It doesn't hurt to check hardware too. We'll leave it to the OP to decide.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Apps freezing for several seconds in stretch

Postby pylkko » 2017-04-17 17:30

the OP said it occurs in Windows also
User avatar
pylkko
 
Posts: 1213
Joined: 2014-11-06 19:02

Re: Apps freezing for several seconds in stretch

Postby phenest » 2017-04-17 18:41

That eliminates a software problem.
NEC Spirit 550 P4 3.8GHz HT - 2GB RAM - nVidia 7600GT - Pioneer BDR-209DBK
ASUS Sabertooth P67 i7 3770K - 32GB RAM - 2x nVidia 660GTX SLI'd
User avatar
phenest
 
Posts: 1571
Joined: 2010-03-09 09:38
Location: The Matrix

Next

Return to General Questions

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable