HHVM 502 Bad gateway - Fedora 21

714 views Asked by At

G'day.

I have fedora 21, HHVM version 3.7. My issue unfortunately is that I can start the service, and I can access my pages no issue. However if I consistently refresh the page, the HHVM crashes and upon checking the status, it returns this error:

enter image description here

The HHVM error log returns:

Unable to open pid file /var/run/hhvm/pid for write

Now I can restart the server and it works fine, but only after a hand full of requests it will crash as above.

PHP-FPM is not running and nothing except HHVM is running on port 9000

Here is some config info

HHVM - server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.source_root = /srv/www
hhvm.server.default_document = index.php
hhvm.log.level = Error
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc

HHVM - service

[Unit]
Description=HipHop Virtual Machine (FCGI)

[Service]
ExecStart=/usr/bin/hhvm --config /etc/hhvm/server.ini --user hhvm --mode daemon -vServer.Type=fastcgi -vServer.Port=9000
PrivateTmp=true
[Install]
WantedBy=multi-user.target

NGINX - site file

##NGINX STUFF
    location ~ \.php$ {
       include /etc/nginx/fastcgi_params;
       fastcgi_pass 127.0.0.1:9000;
       fastcgi_index bootstrap.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }
##MORE NGINX STUFF

So from the info provided, is there any hint as to what could be the issue?

Cheers guys.

1

There are 1 answers

7
René Höhle On

This is a very simple permission issue like your log mentioned. You have no access to the pid folder to generate the pid file.

sudo chmod -R 777 /var/run/hhvm

I had the same problem on Ubuntu.

HHVM Unable to read pid file /var/run/hhvm/pid for any meaningful pid after reboot

Another problem when you have a lot of requests can be the max open files limit. When you come over the limit HHVM crashes. Normally you should see that error in your log and you can increase that limit.

https://serverfault.com/questions/679408/hhvm-exit-after-too-many-open-files

Here is my question on ServerFault.