following is test program:
------------------------------------------------
package main

import (
  "fmt"
  "os"
  "os/exec"
  "syscall"
)

func main() {
  fmt.Printf("Args: %v\n", os.Args)

  for {
    f1, _ := os.OpenFile("/tmp/aa", os.O_RDWR|os.O_CREATE, 0755)
    f2, _ := os.OpenFile("/tmp/bb", os.O_RDWR|os.O_CREATE, 0755)
    f3, _ := os.OpenFile("/tmp/cc", os.O_RDWR|os.O_CREATE, 0755)

    syscall.CloseOnExec(int(f1.Fd()))
    syscall.CloseOnExec(int(f2.Fd()))
    syscall.CloseOnExec(int(f3.Fd()))

    go func() {
      f1.Close()
      f2.Close()
      f3.Close()
    }()
    cmd := exec.Command(os.Args[1], os.Args[2:]...)
    err := cmd.Start()
    if err == nil {
      cmd.Wait()
    } else {
      fmt.Println(err)
    }
  }
}
------------------------------------
The program run about 1 hour,will:
10月 26 11:14:03 kylin-2321321 kernel: CPU: 2 PID: 3970 Comm: test Tainted: 
G      D    OE   4.4.58-20180615.kylin.server.YUN+-generic #kylin
10月 26 11:14:03 kylin-2321321 kernel: Hardware name: wewqewqewq 2321321/, 
BIOS FT-1.0.000 2017-2-24/17:08:23
10月 26 11:14:03 kylin-2321321 kernel: task: ffffffc1d6a88000 ti: 
ffffffc768700000 task.ti: ffffffc768700000
10月 26 11:14:03 kylin-2321321 kernel: PC is at filp_close+0x94/0x118
10月 26 11:14:03 kylin-2321321 kernel: LR is at filp_close+0x78/0x118
10月 26 11:14:03 kylin-2321321 kernel: pc : [<ffffffc00024c324>] lr : 
[<ffffffc00024c308>] pstate: 00000145
10月 26 11:14:03 kylin-2321321 kernel: sp : ffffffc768703c00
10月 26 11:14:03 kylin-2321321 kernel: x29: ffffffc768703c00 x28: 
ffffffc7b9a1e000
10月 26 11:14:03 kylin-2321321 kernel: x27: 0000000000000000 x26: 
0000000000000000
10月 26 11:14:03 kylin-2321321 kernel: x25: ffffffc8da470680 x24: 
0000000000000000
10月 26 11:14:03 kylin-2321321 kernel: x23: ffffffc8da470600 x22: 
0000000000000000
10月 26 11:14:03 kylin-2321321 kernel: x21: 0000000000000001 x20: 
ffffffc8da470600
10月 26 11:14:03 kylin-2321321 kernel: x19: ffffffc1d519dd00 x18: 
0000000000000000
10月 26 11:14:03 kylin-2321321 kernel: x17: 69622f3a6e696273 x16: 
ffffffc000257598
10月 26 11:14:03 kylin-2321321 kernel: x15: 752f3a6e6962732f x14: 
00000000000003f0
10月 26 11:14:03 kylin-2321321 kernel: x13: 00000000000003f0 x12: 
000000000002cc10
10月 26 11:14:03 kylin-2321321 kernel: x11: 000000000002cc10 x10: 
000000000001cc10
10月 26 11:14:03 kylin-2321321 kernel: x9 : 0000000000000000 x8 : 
ffffffc1d6a88bc0
10月 26 11:14:03 kylin-2321321 kernel: x7 : 0000000000000000 x6 : 
0000000000000407
10月 26 11:14:03 kylin-2321321 kernel: x5 : ffffffc8da470690 x4 : 
ffffffc8da470628
10月 26 11:14:03 kylin-2321321 kernel: x3 : 0000000000000000 x2 : 
ffffffc1d519dd38
10月 26 11:14:03 kylin-2321321 kernel: x1 : 0000000000000000 x0 : 
0000000000000000
10月 26 11:14:03 kylin-2321321 kernel:
10月 26 11:14:03 kylin-2321321 kernel: Process test (pid: 3970, stack limit 
= 0xffffffc768700020)
10月 26 11:14:04 kylin-2321321 kernel: Stack: (0xffffffc768703c00 to 
0xffffffc768704000)
10月 26 11:14:04 kylin-2321321 kernel: 3c00: ffffffc768703c30 
ffffffc00026f7e4 0000000000000001 000000000000000a
10月 26 11:14:04 kylin-2321321 kernel: 3c20: ffffffc8da470628 
ffffffc1d519dd00 ffffffc768703c90 ffffffc00025600c
10月 26 11:14:04 kylin-2321321 kernel: 3c40: ffffffc8d7625b00 
ffffffc1d6a88000 ffffffc8d7000680 ffffffc8d7625b00
10月 26 11:14:04 kylin-2321321 kernel: 3c60: ffffffc1d6a88690 
ffffffc7bac6da00 ffffffc1d6a88400 ffffffc1b9f17a80
10月 26 11:14:04 kylin-2321321 kernel: 3c80: ffffffc7bac6da00 
ffffffc000255fe4 ffffffc768703d00 ffffffc0002b0fb8
10月 26 11:14:05 kylin-2321321 kernel: 3ca0: 00000000ffffffb0 
ffffffc768700000 ffffffc1b9f17580 ffffffc7bac6db00
10月 26 11:14:05 kylin-2321321 kernel: 3cc0: 0000000000000001 
ffffffc7bac6da00 ffffffc193ea1600 ffffffc768700000
10月 26 11:14:05 kylin-2321321 kernel: 3ce0: ffffffc1b9f17580 
ffffffc7bac6db00 0000000000000001 0000000000000040
10月 26 11:14:05 kylin-2321321 kernel: 3d00: ffffffc768703dd0 
ffffffc00025642c ffffffc7bac6da00 ffffffc001ce1528
10月 26 11:14:05 kylin-2321321 kernel: 3d20: ffffffc001e46ba0 
ffffffc001cd49a8 ffffffc001e46000 ffffffc001cd4000
10月 26 11:14:05 kylin-2321321 kernel: 3d40: 00000000fffffff8 
0000000000000000 ffffffc7bac6da00 ffffffc00025599c
10月 26 11:14:06 kylin-2321321 kernel: 3d60: 000000000000085f 
0000000000000000 0000000000000000 0000000000000000
10月 26 11:14:06 kylin-2321321 kernel: 3d80: ffffffc768703da0 
ffffffc00038ef50 ffffffc001cf0c88 0000000000001000
10月 26 11:14:06 kylin-2321321 kernel: 3da0: ffffffc768703dd0 
ffffffc0002563fc ffffffc7bac6da00 ffffffc001ce1528
10月 26 11:14:06 kylin-2321321 kernel: 3dc0: ffffffc7bac6da00 
ffffffc193ea3c00 ffffffc768703e20 ffffffc000257138
10月 26 11:14:06 kylin-2321321 kernel: 3de0: ffffffc07b917000 
ffffffc1d6a88000 0000000000000000 0000000000000f82
10月 26 11:14:06 kylin-2321321 kernel: 3e00: 0000000000000f82 
0000000000000000 00000040005cb6c0 ffffffbdcc8588c0
10月 26 11:14:06 kylin-2321321 kernel: 3e20: ffffffc768703ea0 
ffffffc0002575e4 0000004000486468 00000040005cb6c0
10月 26 11:14:07 kylin-2321321 kernel: 3e40: 00000040002a2df0 
00000000000903c0 0000000020000000 0000000000000015
10月 26 11:14:07 kylin-2321321 kernel: 3e60: 000000000000011d 
00000000000000dd ffffffc000a2a000 ffffffc768700000
10月 26 11:14:07 kylin-2321321 kernel: 3e80: ffffffc768703ea0 
ffffffc8d70006e8 0000004000486468 0000000000000000
10月 26 11:14:07 kylin-2321321 kernel: 3ea0: 0000004000104878 
ffffffc000085470 0000000000000000 0000004000104ac0
10月 26 11:14:07 kylin-2321321 kernel: 3ec0: ffffffffffffffff 
00000000000903c0 00000040002a2df0 0000004000486468
10月 26 11:14:07 kylin-2321321 kernel: 3ee0: 00000040005cb6c0 
0000000000000000 0000000000000000 0000000000000000

10月 26 11:14:09 kylin-2321321 kernel: 3fa0: 00000000000d2818 
00000000001a8d8a 0000004000000340 0000004000104878
10月 26 11:14:09 kylin-2321321 kernel: 3fc0: 000000000008da60 
0000004000104880 00000000000903c0 0000000020000000
10月 26 11:14:09 kylin-2321321 kernel: 3fe0: 00000040002a2df0 
00000000000000dd 77732f7665642f22 336963702d6d7363
10月 26 11:14:09 kylin-2321321 kernel: Call trace:
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc00024c324>] 
filp_close+0x94/0x118
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc00026f7e4>] 
do_close_on_exec+0xac/0x110
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc00025600c>] 
flush_old_exec+0x45c/0x640
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc0002b0fb8>] 
load_elf_binary+0x228/0xd10
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc00025642c>] 
search_binary_handler+0xa4/0x2c0
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc000257138>] 
do_execveat_common.isra.15+0x580/0x728
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc0002575e4>] 
SyS_execve+0x4c/0x60
10月 26 11:14:09 kylin-2321321 kernel: [<ffffffc000085470>] 
el0_svc_naked+0x24/0x28
10月 26 11:14:09 kylin-2321321 kernel: Code: b9404260 f240041f 540000c0 
f9400e60 (b9400001)
10月 26 11:14:09 kylin-2321321 kernel: ---[ end trace 928dde36b78ef3d6 ]---


I am not sure, this is bug of golang  or bug of the test program ?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2cb357bc-4d15-4242-a5c2-eb5eb59d2c8an%40googlegroups.com.

Reply via email to