Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

502 Bad Gateway Error when connecting to PHP-FPM upstream in Nginx" #309

Closed
PierreJiji opened this issue Mar 13, 2023 · 7 comments
Closed
Labels

Comments

@PierreJiji
Copy link

Description:

I have deployed HumHub on OpenShift using the provided Docker image and environment variables on docker-compose.prod.yml. However, when I try to access the HumHub site through a web browser, I receive a "502 Bad Gateway" error. I have checked that the HumHub service is running and is accessible outside of the OpenShift cluster but not all the time.

Additionally, there are intermittent connection issues with the database, even though the database configuration appears to be correct.

Here are some of the error messages or logs that may be relevant:

[13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "NOTICE: PHP message: An Error occurred while handling another error:" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/Connection.php:722" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "Stack trace:" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#0 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/Connection.php(722): PDO->__construct()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#1 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/Connection.php(637): yii\db\Connection->createPdoInstance()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#2 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/Connection.php(1067): yii\db\Connection->open()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#3 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/Connection.php(1054): yii\db\Connection->getMasterPdo()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#4 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(413): yii\db\Connection->getSlavePdo()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#5 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(437): yii\db\mysql\QueryBuilder->supportsFractionalSeconds()" [13-Mar-2023 20:27:17] WARNING: [pool www] child 118 said into stderr: "#6 /var/www/localhost/htdocs/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilde..."

2023/03/13 20:35:38 [error] 44#44: *69 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xxx.2.xx, server: _, request: "GET /sw.js?v=1678739737 HTTP/1.1", upstream: "fastcgi://172.30.81.xx:9000", host: "humhub-xxx.apps.xxx.openshift.xxx", referrer: "https://humhub-xxx.apps.xxx.openshift.xxx/user/auth/login"

Steps to reproduce:

  • Deploy HumHub on OpenShift using the provided Docker image and environment variables.

  • Access the HumHub site through a web browser.

  • Observe the "502 Bad Gateway" error message.

Expected behavior:

The HumHub site should display the expected content without any errors.

Actual behavior:

The HumHub site displays a "502 Bad Gateway" error message, and there are intermittent connection issues with the database.

Thank you for your help in resolving this issue.

@ArchBlood
Copy link

Seems related to docker-library/php#207

@mriedmann
Copy link
Owner

Hi!

Have you checked the db connection manually? (you can use curl -v <db-hostname> and see if it connects)
Have you created a service for the db? (if not, have you used the exact pod-ip or pod-name to connect to the db?)
Is it named "db"? (if you name the service "db" it should behave like the compose-file)

@PierreJiji
Copy link
Author

Yes, I already have my database with all the tables, but sometimes the connection is refused and sometimes it is correct

@mriedmann
Copy link
Owner

That sounds like your db crashes or you readiness probe is incorrect. Please check if your DB has enough memory and cpu. You can also check the restart-counter and previous log (oc logs -p <podname>)

@PierreJiji
Copy link
Author

I managed to install the application on Kubernetes EKS and everything was working fine, but I didn't get the same behavior on OpenShift. There may be something missing in the network configuration, but we can consider this issue resolved !

Thank you so much for ur help !

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jun 22, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants