2010年4月27日

[PHP-users 35165] Re:phpのmail関数がたまにfalseを返す

中出です。

レス、ありがとうございます。


> > fstat64(4, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
> > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7c4d000
> > write(4, "To: root\nSubject: subject\n\nbody\n", 32) = -1 EPIPE (Broken pipe)

> > --- SIGPIPE (Broken pipe) @ 0 (0) ---
> > close(4) = 0
>
> EPIPEエラーが発生した。ということは分かりました。
>
> 以下について、何ら記述がないので教えてください。、
> ・mail()sleep(1)を繰り返しつつも、なんとか「PHP>>> end」まで到達した。
> ・永久にmail()sleep(1)を繰り返し続けた。(endに到達しない)
> どちらでしょうか?
> (また、後者であるならsleepを10とか20とかにすると、endに到達しませんか?)
>

sleepしましたが、「PHP>>> end」まで到達しました。


> 子プロセスも追跡してみるとどうなりますか?
> $ sudo sh -c "strace -f php ./mailtest.php > trace.log 2>&1"
>

該当箇所のログは以下のような感じとなっていました。
Segmentation faultが出ているようです。
なぜ、Segmentation faultとなるのでしょう。


●ログ
clone(Process 18263 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f7c728) = 18263
[pid 18263] close(4) = 0
[pid 18263] dup2(3, 0) = 0
[pid 18263] close(3) = 0
[pid 18263] execve("/bin/sh", ["sh", "-c", "/usr/sbin/sendmail -t -i"], [/* 20 vars */]) = 0
[pid 18263] brk(0) = 0x935e000
[pid 18263] access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
[pid 18263] open("/etc/ld.so.cache", O_RDONLY) = 3
[pid 18263] fstat64(3, {st_mode=S_IFREG|0644, st_size=41901, ...}) = 0
[pid 18263] mmap2(NULL, 41901, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f97000
[pid 18263] close(3) = 0
[pid 18263] open("/lib/libtermcap.so.2", O_RDONLY) = 3
[pid 18263] read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\372\203\0004\0\0\0"..., 512) = 512
[pid 18263] fstat64(3, {st_mode=S_IFREG|0755, st_size=13084, ...}) = 0
[pid 18263] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f96000
[pid 18263] mmap2(0x83f000, 14568, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x83f000
[pid 18263] mmap2(0x842000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2) = 0x842000
[pid 18263] close(3) = 0
[pid 18263] open("/lib/libdl.so.2", O_RDONLY) = 3
[pid 18263] read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\32~\0004\0\0\0"..., 512) = 512
[pid 18263] fstat64(3, {st_mode=S_IFREG|0755, st_size=16428, ...}) = 0
[pid 18263] mmap2(0x7e1000, 12408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7e1000
[pid 18263] mmap2(0x7e3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0x7e3000
[pid 18263] close(3) = 0
[pid 18263] open("/lib/libc.so.6", O_RDONLY) = 3
[pid 18263] read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\357j\0004\0\0\0"..., 512) = 512
[pid 18263] fstat64(3, {st_mode=S_IFREG|0755, st_size=1611564, ...}) = 0
[pid 18263] mmap2(0x699000, 1332676, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x699000
[pid 18263] mprotect(0x7d8000, 4096, PROT_NONE) = 0
[pid 18263] mmap2(0x7d9000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13f) = 0x7d9000
[pid 18263] mmap2(0x7dc000, 9668, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7dc000
[pid 18263] close(3) = 0
[pid 18263] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f95000
[pid 18263] set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f956c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
[pid 18263] mprotect(0x7e3000, 4096, PROT_READ) = 0
[pid 18263] mprotect(0x7d9000, 8192, PROT_READ) = 0
[pid 18263] mprotect(0x690000, 4096, PROT_READ) = 0
[pid 18263] munmap(0xb7f97000, 41901) = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
[pid 18263] close(3) = 0
[pid 18263] brk(0) = 0x935e000
[pid 18263] brk(0x937f000) = 0x937f000
[pid 18263] open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
[pid 18263] fstat64(3, {st_mode=S_IFREG|0644, st_size=56450656, ...}) = 0
[pid 18263] mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7d95000
[pid 18263] mmap2(NULL, 962560, PROT_READ, MAP_PRIVATE, 3, 0x2e43) = 0xb7caa000
[pid 18263] close(3) = 0
[pid 18263] getuid32() = 0
[pid 18263] getgid32() = 0
[pid 18263] geteuid32() = 0
[pid 18263] getegid32() = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] time(NULL) = 1272336853
[pid 18263] open("/proc/meminfo", O_RDONLY) = 3
[pid 18263] fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
[pid 18263] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ca9000
[pid 18263] read(3, "MemTotal: 2075284 kB\nMemFre"..., 4096) = 771
[pid 18263] close(3) = 0
[pid 18263] munmap(0xb7ca9000, 4096) = 0
[pid 18263] rt_sigaction(SIGCHLD, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGCHLD, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] rt_sigaction(SIGQUIT, {0x1, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] uname({sys="Linux", node="www.mail-hikaku.net", ...}) = 0
[pid 18263] stat64("/home/redadmin", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 18263] stat64(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 18263] getpid() = 18263
[pid 18263] open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = 3
[pid 18263] fstat64(3, {st_mode=S_IFREG|0644, st_size=25462, ...}) = 0
[pid 18263] mmap2(NULL, 25462, PROT_READ, MAP_SHARED, 3, 0) = 0xb7ca3000
[pid 18263] close(3) = 0
[pid 18263] getppid() = 5905
[pid 18263] stat64(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
[pid 18263] stat64("/usr/bin/sh", 0xbff5c730) = -1 ENOENT (No such file or directory)
[pid 18263] stat64("/bin/sh", {st_mode=S_IFREG|0755, st_size=735004, ...}) = 0
[pid 18263] access("/bin/sh", X_OK) = 0
[pid 18263] access("/bin/sh", R_OK) = 0
[pid 18263] stat64("/bin/sh", {st_mode=S_IFREG|0755, st_size=735004, ...}) = 0
[pid 18263] access("/bin/sh", X_OK) = 0
[pid 18263] access("/bin/sh", R_OK) = 0
[pid 18263] getpgrp() = 5903
[pid 18263] rt_sigaction(SIGCHLD, {0x807aa60, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 18263] rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {0x1, [], 0}, 8) = 0
[pid 18263] rt_sigaction(SIGCHLD, {SIG_DFL, [], 0}, {0x807aa60, [], 0}, 8) = 0
[pid 18263] execve("/usr/sbin/sendmail", ["/usr/sbin/sendmail", "-t", "-i"], [/* 20 vars */]) = -1 EINVAL (Invalid argument)
[pid 18263] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 18263 detached
<... waitpid resumed> [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV}], 0) = 18263
--- SIGCHLD (Child exited) @ 0 (0) ---
munmap(0xb7c90000, 4096) = 0
write(1, "PHP>>> cnt : 3052 ret : \n", 25PHP>>> cnt : 3052 ret :
) = 25
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({1, 0}, {1, 0}) = 0


では、失礼します。
_______________________________________________
PHP-users mailing list PHP-users@xxxxx
http://ml.php.gr.jp/mailman/listinfo/php-users
PHP初心者のためのページ - 質問する前にはこちらをお読みください
http://oldwww.php.gr.jp/php/novice.php3


投稿者 xml-rpc : 2010年4月27日 13:18
役に立ちました?:
過去のフィードバック 平均:(0) 総合:(0) 投票回数:(0)
本記事へのTrackback: http://hoop.euqset.org/blog/mt-tb2006.cgi/95501
トラックバック
コメント
コメントする




画像の中に見える文字を入力してください。