Skip to content

Commit 9fbb531

Browse files
authored
runner: allow coredump collection (#931)
Fixes #784 I didn't find a way to set ulimit globally, as our init system doesn't call `/etc/initscript` --------- Signed-off-by: Oleg Vasilev <[email protected]>
1 parent 3b08db3 commit 9fbb531

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

neonvm/runner/main.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,14 @@ func run(logger *zap.Logger) error {
676676
}
677677

678678
// create iso9660 disk with runtime options (command, args, envs, mounts)
679-
sysctl := []string{}
679+
sysctl := []string{
680+
"kernel.core_pattern=core",
681+
"kernel.core_uses_pid=1",
682+
}
680683
var shmSize *resource.Quantity
681684
var swapInfo *vmv1.SwapInfo
682685
if vmSpec.Guest.Settings != nil {
683-
sysctl = vmSpec.Guest.Settings.Sysctl
686+
sysctl = append(sysctl, vmSpec.Guest.Settings.Sysctl...)
684687
swapInfo, err = vmSpec.Guest.Settings.GetSwapInfo()
685688
if err != nil {
686689
return fmt.Errorf("failed to get SwapInfo from VirtualMachine object: %w", err)

neonvm/tools/vm-builder/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func main() {
236236
tmplArgs.ShutdownHook = strings.ReplaceAll(spec.ShutdownHook, "\n", "\n\t")
237237

238238
for _, c := range spec.Commands {
239+
// Allow core dumps for all inittab targets
240+
c.Shell = fmt.Sprintf("ulimit -c unlimited; %s", c.Shell)
239241
tmplArgs.InittabCommands = append(tmplArgs.InittabCommands, inittabCommand{
240242
SysvInitAction: c.SysvInitAction,
241243
CommandUser: c.User,

0 commit comments

Comments
 (0)