hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

HHVM "Crashing" - 502 Errors - Bug or User-Error?

Open s3w47m88 opened this issue 10 years ago • 25 comments

Forgive me if this is not the correct place to report this, and I have searched and read many other Issues here in Github but can't confirm whether or not my issue is a duplicate of others or not beside on Issue that was closed for reason of Human Timeout.

I'm seeking confirmation as to whether or not others are experiencing this same issue and whether or not the issue is with HHVM itself (as in a bug). If not I assume it's a configuration issue and that I'll need to turn to proper forums for further support as I understand this is not necessarily a support forum.

That being said; I'm running an AWS EC2 T2 Medium Instance with Webmin / Virtualmin atop NGinx, Reddis and HHVM (called web-server-1). It's connected to a separate AWS EC2 T2 Large Instance that runs MySQL (called database-server-1). Web-server-1 operates about 25 WordPress websites. On web-server-1 HHVM recently started "crashing" multiple times a day at seemingly random intervals. When HHVM stops operating correctly any websites I visit display 502 errors. The only that that resolves it is restarting HHVM.

I have New Relic installed on web-server-1 and database-server-1. So I looked at the CPU and RAM usage at the times of the "crash" I don't see higher than normal usage of those resources - which would indicate to me there is a memory leak or a runaway script.

After looking through the forums here I see that many others (https://github.com/facebook/hhvm/issues/3876) are experiencing this issue and that it was confirmed as a bug but I'm not sure where to go from here.

Thank you all for your time and assistance, I hope this is helpful to others!

HHVM Error Log: https://gist.github.com/s3w47m88/fac1e0cbf4ae5846fbd2

s3w47m88 avatar Mar 04 '16 20:03 s3w47m88

same issue here on both normal and debug builds. log doesnt say anything about the crash, except sometimes it says it's a segfault. however your problem seems to be redis becomes unresponsive.

fcorriga avatar Mar 07 '16 18:03 fcorriga

Increasing hhvm.jit_a_size to 128Mb fixed the issue

kor-ea avatar Mar 07 '16 20:03 kor-ea

my JIT parameters: -vEval.JitASize=201326592 -vEval.JitAFrozenSize=139460608 -vEval.JitAColdSize=69206016 -vEval.JitGlobalDataSize=201326592

you mean i should RISE JitASize even more?

fcorriga avatar Mar 08 '16 13:03 fcorriga

.. keeps crashing even with insanely high values... like: hhvm.jit_a_size = 306184192 hhvm.jit_a_cold_size = 100663296 hhvm.jit_a_frozen_size = 201326592 ;hhvm.jit_a_hot_size = 0 hhvm.jit_a_prof_size = 306184192 hhvm.jit_a_max_usage = 306184192 hhvm.jit_global_data_size = 306184192

fcorriga avatar Mar 08 '16 18:03 fcorriga

As a workaround, you can use Monit to automatically restart your HHVM instance when it crashes.

MounirHamani avatar Mar 11 '16 00:03 MounirHamani

i already use it.. but it crashes so often monit won't be so much useful.

fcorriga avatar Mar 11 '16 09:03 fcorriga

Sorry about that. In the mean time, you can set it up to check "every minute" that HHVM is running. And if it's still really that bad, you can set up a fallback to php-fpm.

Also, sometimes it might be caused by some unsupported or mis-coded call to a function, so check your log files to find out what happend prior to the crashes.

Hope this helps.

2016-03-11 10:41 GMT+01:00 fcorriga [email protected]:

i already use it.. but it crashes so often monit won't be useful.

— Reply to this email directly or view it on GitHub https://github.com/facebook/hhvm/issues/6886#issuecomment-195291002.

MounirHamani avatar Mar 11 '16 17:03 MounirHamani

  • it is crashing, or stopping to respond?
  • is there a way to reproduce this, or a backtrace from all threads? (needs gdb for the latter)

There's not enough information for someone to try to fix this.

fredemmott avatar Mar 11 '16 18:03 fredemmott

it does crash. the hhvm process ends leaving no trace of the crash. no stacktrace, no log... nothing. it's a random crash but it happens FREQUENTLY (after 2 to 5 page loads) and even more frequenty in the debug build! (sometimes even after 1 page load). i've never used GDB, so please bear with me... is there a HHVM specific guide to run fastcgi thru GDB?

fcorriga avatar Mar 11 '16 18:03 fcorriga

@MounirHamani yes it is THAT bad... i have already monit running every 30 seconds... and that's not enough. hhvm crashes after 2 to 5 (or 6 maybe) page requests and as i told to Fred, the debug build crashes even more.

fcorriga avatar Mar 11 '16 18:03 fcorriga

Standard gdb documentation for attaching to a running process should cover it; the only thing is that most guides are for single-threaded programs - use 'thread apply all bt' instead of just 'bt' to get the backtrace for all threads.

fredemmott avatar Mar 11 '16 18:03 fredemmott

ok, thanks a lot. will post the backtrace as soon as possible.

fcorriga avatar Mar 11 '16 18:03 fcorriga

First problem i noticed. HHVM remain stuck doing something AFTER the page has been served. It keeps "eating" cpu cycles while does nothing. GDB reports a LOT of: warning: (Internal error: pc 0x3d6ae23 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x3d6ae22 in read in psymtab, but not in symtab.)

while hhvm is running. seems stuck in an infinite loop. the process sometimes exits after a while and prints:

[Fri Mar 11 20:26:04 2016] [hphp] [32240:7fd066fff700:1:000002] [] Finished singleJitRequest 1

in the hhvm log i'm trying to capture the backtrace However i'm running the 3.12.0-dbg build... there is no 3.12.1-dbg for debian wheezy.

fcorriga avatar Mar 11 '16 19:03 fcorriga

ok... Segmentation fault.... heres's the backtrace: http://pastebin.com/gMjMSaXB please tell me if you need more info like php and server ini files... etc.

fcorriga avatar Mar 11 '16 19:03 fcorriga

it's the same as: https://github.com/facebook/hhvm/issues/6865

fcorriga avatar Mar 15 '16 18:03 fcorriga

Found the cause. It is: https://github.com/facebook/hhvm/issues/6911

fcorriga avatar Mar 18 '16 10:03 fcorriga

@s3w47m88: does #6911 also explain your issue?

fredemmott avatar Mar 18 '16 16:03 fredemmott

Uhm... i think he experienced 2 issues at the same time. One is crash caused by the reusable_tc and the other, is the impossibility to connect to redis (at least, at the end of the the error log, it says HHVM was unable to connect to redis).

fcorriga avatar Mar 18 '16 16:03 fcorriga

Upgrading from 3.12.1 to 3.13.x brought on a plague of 502 on my 1.9 nginx server. I had to go back to 3.12.1 in particular and saw no more 502. I double checked that it was not an nginx issue but playing with 1.8 etc. Every version had issues with 3.13.x and played well with 3.12.1.

The 502 were caused by hhvm failing after about 5 page loads. (Sometimes even less).

I was also getting the pesky blank stack traces.

Don't know if this helps anyone but hey

gooki avatar Apr 14 '16 15:04 gooki

Were you upgrading to 3.13.0 or 3.13.1? 3.13.0 had issues that caused it to crash.

Orvid avatar Apr 14 '16 23:04 Orvid