Apache No space left on device

Inter-Process Communication,进程间通信

报错信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cat /var/logs/httpd/error_log |grep -i device
[Wed Nov 21 20:15:01 2018] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Nov 21 20:15:01 2018] [notice] sohudb_post_config begin
[Wed Nov 21 20:15:01 2018] [notice] create_server_temp_conf begin
[Wed Nov 21 20:15:01 2018] [notice] create_server_temp_conf end
[Wed Nov 21 20:15:01 2018] [notice] Digest: generating secret for digest authentication ...
[Wed Nov 21 20:15:01 2018] [notice] Digest: done
[Wed Nov 21 20:15:01 2018] [notice] sohudb_post_config begin
[Wed Nov 21 20:15:01 2018] [notice] cp_create: ok
[Wed Nov 21 20:15:01 2018] [notice] qdb_cp_create: ok
[Wed Nov 21 20:15:01 2018] [notice] socket_cp_create: ok
[Wed Nov 21 20:15:01 2018] [notice] schat_cp_create: ok
[Wed Nov 21 20:15:01 2018] [notice] set_mc_host_sc end
[Wed Nov 21 20:15:01 2018] [notice] cp_initialize: begin 23014
[Wed Nov 21 20:15:01 2018] [notice] cp_initialize: for loop i=0, server_no:1
[Wed Nov 21 20:15:01 2018] [notice] cp_initialize: ok
[Wed Nov 21 20:15:01 2018] [notice] set_qdb_host_sc end
[Wed Nov 21 20:15:01 2018] [notice] qdb_cp_initialize: begin 23014
[Wed Nov 21 20:15:01 2018] [notice] qdb_cp_initialize: for loop i=0, server_no:1
[Wed Nov 21 20:15:01 2018] [notice] qdb_cp_initialize: ok
[Wed Nov 21 20:15:01 2018] [notice] set_socket_host_sc end
[Wed Nov 21 20:15:01 2018] [notice] socket_cp_initialize: begin 23014
[Wed Nov 21 20:15:01 2018] [notice] socket_cp_initialize: for loop i=0, server_no:1
[Wed Nov 21 20:15:01 2018] [notice] socket_cp_initialize: ok
[Wed Nov 21 20:15:01 2018] [notice] set_schat_host_sc end
[Wed Nov 21 20:15:01 2018] [notice] schat_cp_initialize: begin 23014
[Wed Nov 21 20:15:01 2018] [notice] schat_cp_initialize: for loop i=0, server_no:1
[Wed Nov 21 20:15:01 2018] [notice] schat_cp_initialize: for loop i=0, server_no:1,0,900,1000
[Wed Nov 21 20:15:01 2018] [notice] schat_cp_initialize: ok
[Wed Nov 21 20:15:01 2018] [notice] sohudb_post_config end
[Wed Nov 21 20:15:01 2018] [warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Nov 21 20:15:01 2018] [emerg] (28)No space left on device: Couldn't create accept lock (/etc/httpd/logs/accept.lock.23014) (5)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# ipcs -s

------ Semaphore Arrays --------
key semid owner perms nsems
0x000000a7 0 root 600 1
0x00000000 65273857 apache 600 1
0x00000000 65372162 apache 600 1
0x00000000 65470467 apache 600 1
0x00000000 65568772 apache 600 1
0x00000000 65667077 apache 600 1
0x00000000 65765382 apache 600 1
0x00000000 65863687 apache 600 1
0x00000000 65961992 apache 600 1
0x00000000 66060297 apache 600 1
0x00000000 66158602 apache 600 1
0x00000000 66256907 apache 600 1
0x00000000 66355212 apache 600 1
0x00000000 66453517 apache 600 1
0x00000000 66551822 apache 600 1
0x00000000 66650127 apache 600 1
0x00000000 66748432 apache 600 1
0x00000000 66846737 apache 600 1
0x00000000 66945042 apache 600 1
0x00000000 67043347 apache 600 1
0x00000000 67141652 apache 600 1
0x00000000 67239957 apache 600 1
0x00000000 67338262 apache 600 1
0x00000000 67436567 apache 600 1
0x00000000 67534872 apache 600 1
0x00000000 67633177 apache 600 1
0x00000000 67731482 apache 600 1
0x00000000 67829787 apache 600 1
0x00000000 67928092 apache 600 1
0x00000000 68026397 apache 600 1
0x00000000 68124702 apache 600 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 512
max semaphores per array = 25032000
max semaphores system wide = 32
max ops per semop call = 512
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ipcs -a

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x74008327 3440640 root 600 4 0
0x740082fd 4128769 root 600 4 0
0x00000000 4489218 root 644 80 2
0x740082fc 4096003 root 600 4 0
0x00000000 4521988 root 644 16384 2
0x00000000 4554757 root 644 280 2

------ Semaphore Arrays --------
key semid owner perms nsems
0x000000a7 0 root 600 1
0x00000000 170524673 apache 600 1
0x00000000 170557442 apache 600 1

------ Message Queues --------
key msqid owner perms used-bytes messages

处理方案

1
2
3
4
5
6
7
8
# for i in $(/usr/bin/ipcs -s | awk '/apache/ {print $2}'); do /usr/bin/ipcrm -s $i; done
# ipcs -s

------ Semaphore Arrays --------
key semid owner perms nsems
0x000000a7 0 root 600 1
0x00000000 170524673 apache 600 1
0x00000000 170557442 apache 600 1

linux/unix下的进程间两类通信方式

基于文件的IPC

  • 基于普通文件的IPC
  • 基于管道文件的IPC
    • 普通管道
    • 匿名管道
      • 匿名管道只能使用在父子进程之间
  • 基于socket文件的IPC
    • 对等模型
      • 对等模型主要用于udp编程
    • C/S模型
      • C/S模型主要用于TCP编程

基于内存的IPC

  • 基于共享内存的IPC,
  • 基于共享队列的IPC,
  • 基于信号量的IPC。
  • 内核内存的工具(ipcs)

    ipcs命令往标准输出写入一些关于活动进程间通信设施的信息.

    • ipcs可以指定查看的具体信息,
      • 如ipcs -m 查看共享内存,
      • -q:查看共享队列,
      • ipcs -s查看共享信号量,
      • 以上3中都不指定时则是查看共享内存、共享队列和共享信号量

参考文档