Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 620938

Summary: Improve feedback of emerge after being killed because of oom
Product: Portage Development Reporter: Kalle Richter <krichter>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: kensington, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Kalle Richter 2017-06-05 16:50:14 UTC
After `emerge` is killed because of out-of-memory (oom) by the kernel, the output is in the form of (e.g. for `sys-kernel/gentoo-sources`)

```
>>> Installing (1 of 1) sys-kernel/gentoo-sources-4.9.16::gentoo

>>> Failed to install sys-kernel/gentoo-sources-4.9.16, Log file:

>>>  '/var/tmp/portage/sys-kernel/gentoo-sources-4.9.16/temp/build.log'

 * GNU info directory index is up-to-date.

 * IMPORTANT: 8 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
```

The referenced log file doesn't contain different information. The user can't figure out why the merging failed easily. Only `dmesg` reveals

```
[15712.020923] Out of memory: Kill process 27569 (emerge) score 570 or sacrifice child
[15712.020932] Killed process 27569 (emerge) total-vm:163840kB, anon-rss:148724kB, file-rss:72kB
```

It'd be nice if `emerge` would inform the user that it was killed by OOM if that's possible or if it would otherwise consider the possibility in the failure output.
Comment 1 Zac Medico gentoo-dev 2017-06-10 20:02:08 UTC
We can check which signal it was killed by, and SIGKILL usually means the OOM killer did it.
Comment 2 Fabian Groffen gentoo-dev 2017-06-10 20:08:32 UTC
SIGKILL is never received by the application, is it?
Comment 3 Zac Medico gentoo-dev 2017-06-10 20:12:57 UTC
The parent process can use WTERMSIG to see if the child process got killed by SIGKILL.