Skip to content

runtime: unable to use SIGSTOP to background #4391

Closed
@gopherbot

Description

@gopherbot
If I try to SIGSTOP the current process, that seems to only block one thread, while
other threads continue. I also tried signaling the session leader, same results.

This reproduces the problem:

$ cat sigstop.go
package main

import (
    "syscall"
    "fmt"
)

func main() {
    fmt.Println("one")
    pid := syscall.Getpid()
    err := syscall.Kill(pid, syscall.SIGSTOP)
    if err != nil {
        panic("bleh")
    }
    fmt.Println("two")
}

$ go build sigstop.go
$ ./sigstop
one
two

What is the expected output?

Compare to

$ cat sigstop.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>

int main(void) {
  pid_t pid;

  printf("one\n");
  pid = getpid();
  kill(pid, SIGSTOP);
  printf("two\n");
}

$ gcc sigstop.c
$ ./a.out 
one

[1]+  Stopped                 ./a.out
$ fg
./a.out
two
$ 

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g via "go build"

Which operating system are you using?

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:    12.04
Codename:   precise

Which version are you using?  (run 'go version')

$ go version
go version go1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions