程序终止不会返回bash

时间:2016-07-09 20:22:18

标签: linux bash process

最近,我提出了一个问题,但由于人们认为不清楚而得到了投票。但是,我发现了一个需要挖掘的提示......

有一个名为fluent的命令行程序。问题是在Rocks中,当我在前端运行并输入exit时,它将返回到命令提示符。

    5991 nodes, binary.
    5991 node flags, binary.
Done.

> exit
mahmood@cluster:~$

但是,当我通过/export/在计算节点上运行相同的命令(应用程序位于ssh,它是 NFS 驱动器)时,它不会返回到命令提示符。

    5991 nodes, binary.
    5991 node flags, binary.
Done.

> exit
^C^C^Z
[1]+  Stopped                 /share/apps/fluent/bin/fluent 3d -g -t4 -i elbow.journal
mahmood@compute-0-3:~$ pkill fluent*
mahmood@compute-0-3:~$ fg
/share/apps/fluent/bin/fluent 3d -g -t4 -i elbow.journal
Terminated

正如所建议的那样,我尝试使用strace并将应用程序在多核上运行多次附加到进程。在一次尝试中,应用程序返回到终端。我注意到在strace的最后一行中,futex的结果存在差异。

在正确执行中,我看到:

    socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 12
    setsockopt(12, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    setsockopt(12, SOL_TCP, TCP_NODELAY, [1], 4) = 0
    setsockopt(12, SOL_SOCKET, SO_SNDBUF, [65536], 4) = 0
    setsockopt(12, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
    fcntl(12, F_GETFL)                      = 0x2 (flags O_RDWR)
    fcntl(12, F_SETFL, O_RDWR)              = 0
    connect(12, {sa_family=AF_INET, sin_port=htons(45470), sin_addr=inet_addr("10.10.10.251")}, 16) = 0
    write(12, "12345\0", 6)                 = 6
    write(12, "15  NORMAL_EXITING\0", 19)   = 19
    read(12, "\0", 1)                       = 1
    close(12)                               = 0
    futex(0x2b66afe5d9d0, FUTEX_WAIT, 12432, NULL) = 0
    futex(0x2b66afc5c9d0, FUTEX_WAIT, 12427, NULL) = 0
    close(6)                                = 0
    close(7)                                = 0
    close(8)                                = 0
    close(9)                                = 0
    close(10)                               = 0
    shmdt(0x2b66af7d8000)                   = 0
    shmdt(0x2b66b0018000)                   = 0
    shmdt(0x2b66af3a8000)                   = 0
    shmdt(0x2b66af638000)                   = 0
    shmdt(0x2b66af758000)                   = 0
    shmdt(0x2b66aff78000)                   = 0
    shmdt(0x2b66af6d8000)                   = 0
    shmdt(0x2b66afed8000)                   = 0
    close(4)                                = 0
    close(5)                                = 0
    exit_group(0)                           = ?
    Process 12420 detached

在越野跑中,我看到了:

    socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 9
    setsockopt(9, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    setsockopt(9, SOL_TCP, TCP_NODELAY, [1], 4) = 0
    setsockopt(9, SOL_SOCKET, SO_SNDBUF, [65536], 4) = 0
    setsockopt(9, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
    fcntl(9, F_GETFL)                       = 0x2 (flags O_RDWR)
    fcntl(9, F_SETFL, O_RDWR)               = 0
    connect(9, {sa_family=AF_INET, sin_port=htons(50825), sin_addr=inet_addr("10.10.10.251")}, 16) = 0
    write(9, "12345\0", 6)                  = 6
    write(9, "15  NORMAL_EXITING\0", 19)    = 19
    read(9, "\0", 1)                        = 1
    close(9)                                = 0
    futex(0x2b74f03659d0, FUTEX_WAIT, 13135, NULL) = -1 EAGAIN (Resource temporarily unavailable)
    futex(0x2b74f01649d0, FUTEX_WAIT, 13132, NULL) = 0
    close(6)                                = 0
    close(7)                                = 0
    shmdt(0x2b74efce0000)                   = 0
    shmdt(0x2b74f03e0000)                   = 0
    shmdt(0x2b74efbe0000)                   = 0
    shmdt(0x2b74f0480000)                   = 0
    shmdt(0x2b74ef8b0000)                   = 0
    shmdt(0x2b74efb40000)                   = 0
    shmdt(0x2b74efc60000)                   = 0
    shmdt(0x2b74f0520000)                   = 0
    close(4)                                = 0
    close(5)                                = 0
    exit_group(0)                           = ?
    Process 13129 detached

正如您所看到的,虽然他们都说exit_group(0),但后者说资源暂时无法使用。

有什么想法吗?

0 个答案:

没有答案