Sam007's avatar

Lumen Get Random 502 Bad Gateway Error

I have two projects, one framework is lumen, the other is cphalcon. When php extensions include cphalcon, the lumen service response random 502 issue. I can not find one userful infomation for resolve this issue, so is it bug?

strace ouput

[pid   988] 13:02:12 open("DatabaseQueue.php", O_RDONLY) = 4 <0.000031>
[pid   988] 13:02:12 fstat(4, {st_mode=S_IFREG|0755, st_size=8162, ...}) = 0 <0.000027>
[pid   988] 13:02:12 fstat(4, {st_mode=S_IFREG|0755, st_size=8162, ...}) = 0 <0.000028>
[pid   988] 13:02:12 fstat(4, {st_mode=S_IFREG|0755, st_size=8162, ...}) = 0 <0.000028>
[pid   988] 13:02:12 read(4, "<?php\n\nnamespace... "..., 8192) = 8162 <0.000033>
[pid   988] 13:02:12 read(4, "", 8192)  = 0 <0.000032>
[pid   988] 13:02:12 read(4, "", 8192)  = 0 <0.000028>
[pid   988] 13:02:12 --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
[pid   475] 13:02:12 <... epoll_wait resumed> {{EPOLLHUP, {u32=53271016, u64=53271016}}, {EPOLLHUP, {u32=53271088, u64=53271088}}}, 13, 1000) = 2 <0.059808>
[pid 27722] 13:02:12 <... epoll_wait resumed> {{EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP|EPOLLRDHUP, {u32=582345585, u64=140141070246769}}}, 512, 500) = 1 <0.060297>
[pid   988] 13:02:12 +++ killed by SIGSEGV (core dumped) +++
[pid   475] 13:02:12 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_DUMPED, si_pid=988, si_status=SIGSEGV, si_utime=112, si_stime=22} ---
[pid 27722] 13:02:12 gettimeofday( <unfinished ...>
[pid   475] 13:02:12 write(6, "C", 1 <unfinished ...>
[pid 27722] 13:02:12 <... gettimeofday resumed> {1481634132, 583129}, NULL) = 0 <0.000034>
[pid   475] 13:02:12 <... write resumed> ) = 1 <0.000059>
[pid 27722] 13:02:12 recvfrom(27,  <unfinished ...>
[pid   475] 13:02:12 rt_sigreturn()     = 2 <0.000113>
[pid 27722] 13:02:12 <... recvfrom resumed> 0x1f07980, 262144, 0, 0, 0) = -1 ECONNRESET (Connection reset by peer) <0.000234>
[pid   475] 13:02:12 read(9, "", 1023)  = 0 <0.000060>
[pid 27722] 13:02:12 write(14, "2016/12/13 13:02:12 [error] 27722#0: *13808 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 101.240.99.163, server: xxx.com, request: \"POST /test HTTP/1.1\", upstream: \"fastcgi://127.0.0.1:9000\", host: \"xxx.com\"\n", 498 <unfinished ...>
[pid   475] 13:02:12 epoll_ctl(8, EPOLL_CTL_DEL, 9, {EPOLLIN, {u32=53271016, u64=53271016}} <unfinished ...>
[pid 27722] 13:02:12 <... write resumed> ) = 498 <0.000061>
[pid   475] 13:02:12 <... epoll_ctl resumed> ) = 0 <0.000035>
[pid 27722] 13:02:12 close(27 <unfinished ...>
[pid   475] 13:02:12 close(9 <unfinished ...>
[pid 27722] 13:02:12 <... close resumed> ) = 0 <0.000042>
[pid   475] 13:02:12 <... close resumed> ) = 0 <0.000050>
[pid 27722] 13:02:12 writev(26, [{"HTTP/1.1 502 Bad Gateway\r\nServer: nginx/1.9.9\r\nDate: Tue, 13 Dec 2016 13:02:12 GMT\r\nContent-Type: text/html\r\nContent-Length: 172\r\nConnection: keep-alive\r\n\r\n", 156}, {"<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n", 120}, {"<hr><center>nginx/1.9.9</center>\r\n</body>\r\n</html>\r\n", 52}], 3 <unfinished ...>

php-fpm log

[13-Dec-2016 13:18:00.905125] DEBUG: pid 1604, fpm_event_loop(), line 419: event module triggered 2 events
[13-Dec-2016 13:18:00.905175] DEBUG: pid 1604, fpm_got_signal(), line 76: received SIGCHLD
[13-Dec-2016 13:18:00.905202] WARNING: pid 1604, fpm_children_bury(), line 252: [pool www] child 1610 exited on signal 11 (SIGSEGV - core dumped) after 50.904866 seconds from start
[13-Dec-2016 13:18:00.905635] NOTICE: pid 1604, fpm_children_make(), line 421: [pool www] child 1616 started
[13-Dec-2016 13:18:00.905665] DEBUG: pid 1604, fpm_event_loop(), line 419: event module triggered 1 events

nginx log

2016/12/13 13:28:58 [error] 1696#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 101.240.99.163, server: xxx.com, request: "POST /wechat HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.com"  
2016-12-13 21:36:02

Details

  • Lumen Framework version: 5.2
  • PHP Version: 5.6.29
  • Operating System: Linux version 3.10.0-327.22.2.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) )
  • Installation type: Compiling from source
  • Zephir version (if any): Version 0.9.4a-dev
  • Server: Nginx
  • Other related info (Database, table schema): AliCloud ECS/AliCloud RDS(MySQL5.6)

Thanks for help!

0 likes
1 reply

Please or to participate in this conversation.