# [Solved] Unexpected reboot when cache memory increase

## Stopi

Hi everyone,

when the cached memory increase too much, my system suddenly reboots without warning, nor kernel panic.

I can reproduce this every time by copying some files from one dir to another (even with nfs).

Looking for a solution on various forums, I discovered I can prevent the reboot by clearing the cache with :

```
sync; echo 1 > /proc/sys/vm/drop_caches
```

So if I want to copy 12Gb of files, I need to copy 4Gb, then clear cache, then 4Gb, then clear cache, etc.

If I don't do this : REBOOT !

That's quite annoying because I have to constantly check the memory (even if some widgets helps with that).

My computer have 16Gb of RAM and that's why I compute many things in memory (like emerging new packages).

Here is a piece of my /etc/fstab.

```
tmpfs                   /tmp              tmpfs           size=13G,noatime                0 0

tmpfs                   /var/tmp          tmpfs           size=13G,noatime                0 0

tmpfs                   /var/lock         tmpfs           size=1G,noatime                 0 0

```

I have replicated this configuration on 2 other computers (one laptop with 8Gb and one desktop with 32Gb).

On both those machine, no issue at all, the memory is perfectly handled by kernel.

All 3 computers are running Gentoo profile default/linux/amd64/13.0/desktop/plasma and kernel 4.4.6-64bits from sys-kernel/gentoo-sources.

At this point I have no clue about what to do, what to seek, maybe I missed a kernel option, maybe someone have an idea.

Let me know if I can post some command output or pastebin my kernel config.Last edited by Stopi on Tue Aug 09, 2016 3:30 pm; edited 1 time in total

----------

## Syl20

Did you make a memtest ? That smells a faulty memory module.

----------

## frostschutz

How much stuff is in those tmpfs of yours? (df -h)

16G RAM and 27G of tmpfs, if you ever try to use it the machine will die. Stuff used tmpfs can not be freed automatically by OOM killer. At best it can be swapped out but even that is questionable.

You should limit your tmpfs so all tmpfs instances combined are not larger than 50% of your RAM. Or take some other steps to make sure it's never overused.

----------

## Stopi

@Syl20 : good idea, I'll try this in next days (so busy now...)

@frostschutz : my tmpfs is not the problem here. I obviously checked it, and it not seems to be related.

As a matter of act, I use this same configuration (like I said) on other computers since several years now.

I can't use only 8G of tmpfs for /var/tmp, cause if I do so I will not be able to compile big stuff like LibreOffice or Firefox any more.

Actually, when I want to compile those big packages on the laptop (which has only 8GB of RAM), I need to extend the memory with a swap file (created with dd).

With the laptop, for example, the folder /var/tmp isn't growing forever, because portage is good enough to handle the disk space correctly (if you don't ccache).

I never had the reboot issue with the laptop, and in its fstab I've allocated 8GB of tmpfs for /tmp and /var/tmp (plus /var/log and /var/lock also since the laptop has a SSD hard drive and is just a dev machine).

I've never had the problem on the other desktop either, and believe me, I've made big copies, when I backup 2 TB from one hard drive to another, I usually use rsync, but sometimes I go with a regular cp and never had this unexpected reboot.

The size given in fstab is just a limit so I get a "disk out of space" warning instead of a big slow down when it becomes full.

In first place limit was set at 16GB (using exact RAM amount like I've done for the others) but since I had the reboot issue I tried to lower it.

I'm afraid Syl20 is probably right and that would explain a lot.

By the way, if you never tried to use portage on RAM, you should. LibreOffice can be compiled from scratch in 25min with enough RAM and an i7.

----------

## msst

 *Quote:*   

> Did you make a memtest ? That smells a faulty memory module.

 

I second that. Had something very similar. Normally all ok. Including compile jobs. But I got reproducible hangups on copying huge files. Memtest revealed the lower 16 GB were ok, but a module in the upper 16GB was faulty. Triggering these troubles only upon huge file copies.

And I needed to run memtest for a while to see this! So run memtest at least overnight before you exclude this as a potential reason.

----------

## Stopi

Hi guys,

I finally had some time to do this.

I've check with memtest all my 4 x 4Gb slots, one at a turn.

Two of them did cause the computer to reboot during test.

I've remove those faulty ones and add a new one.

So with my new 12Gb machine I tried to copy a big bunch of files (20Gb) from a place to another, while using Firefox (260 tabs opened) and a heavy Java soft.

No reboot, success !

Thank you all for your time and your reactivity.

PS: happy gentoo user since 2006, for the first time in 10 years I had to create an account and ask for something I couldn't find in this forum.

This sounds to me like the documentation in Gentoo universe is really good !

----------

