502 Bad Gateway error while "View Issues"

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
rtartas
Posts: 8
Joined: 21 Sep 2010, 12:23

502 Bad Gateway error while "View Issues"

Post by rtartas »

Hi,

For one of my projects created in Mantis, when I press "View Issues" I receive error message:
502 Bad Gateway
nginx/1.6.2
I use MantisBT version 1.2.19.
Any idea how to solve it?
Thanks in advance for help!
rtartas
Posts: 8
Joined: 21 Sep 2010, 12:23

Re: 502 Bad Gateway error while "View Issues"

Post by rtartas »

Hi,

Can anybody help with this error?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: 502 Bad Gateway error while "View Issues"

Post by atrol »

This is hardly a Mantis problem, but a problem with your webserver setup.

Search the web for "502 bad gateway nginx" and you will find a lot of hints what might cause the issue, e.g. links like
http://jvdc.me/fix-502-bad-gateway-erro ... ading-php/
Please use Search before posting and read the Manual
sergeyol
Posts: 4
Joined: 12 Apr 2018, 09:51

Re: 502 Bad Gateway error while "View Issues"

Post by sergeyol »

We also have 502 error in several scenarios:
1) Opening "View Issues" in some cases
2) Opening issue that has specific long URLs anywhere in the description or a comment line (e.g. typical SharePoint link).

I would kindly not agree that this is an issue totally unrelated to Mantis. Analysis of logs (PHP, Apache etc.) shows that PHP process is restarting during such call:

[Thu Apr 12 13:02:55 2018] [notice] Parent: child process exited with status 255 -- Restarting.
[Thu Apr 12 13:02:57 2018] [notice] Apache/2.2.22 (Win32) PHP/5.3.11 mod_ssl/2.2.22 OpenSSL/0.9.8t configured -- resuming normal operations
[Thu Apr 12 13:02:57 2018] [notice] Server built: Jan 28 2012 11:16:39
[Thu Apr 12 13:02:58 2018] [notice] Parent: Created child process 5620
[Thu Apr 12 13:03:00 2018] [notice] Child 5620: Child process is running
[Thu Apr 12 13:03:00 2018] [notice] Child 5620: Acquired the start mutex.
[Thu Apr 12 13:03:00 2018] [notice] Child 5620: Starting 64 worker threads.
[Thu Apr 12 13:03:00 2018] [notice] Child 5620: Starting thread to listen on port 443.
[Thu Apr 12 13:03:00 2018] [notice] Child 5620: Starting thread to listen on port 80.

I believe that Mantis thread crashes during preparation interpretation of a page, thus resulting in error 502.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: 502 Bad Gateway error while "View Issues"

Post by atrol »

@sergeyol are you able to reproduce this on latest Mantis version using a supported PHP version?

I vaguely remember that we had memory issues / PHP crashes in older Mantis versions, using older PHP versions when having long URLs in description or notes.

As you are using a quite outdated PHP 5.3.11, your problem might disappear by upgrading PHP, or changing PHP memory settings.
Please use Search before posting and read the Manual
sergeyol
Posts: 4
Joined: 12 Apr 2018, 09:51

Re: 502 Bad Gateway error while "View Issues"

Post by sergeyol »

Thanks for the hint, for some reason I haven't considered PHP version. Just tried it with PHP 5.6/Apache 2.4 - error is still there. On the latest version of Mantis running as your demo environment, I was not able to reproduce it.

So I will try to upgrade first to PHP 7, and then to Mantis 2.x
markfilan
Posts: 1
Joined: 13 Aug 2019, 06:19

Re: 502 Bad Gateway error while "View Issues"

Post by markfilan »

The 502 Bad Gateway error usually happens when there are some network errors between computer and internet severs . This means that a server (not necessarily a web server) acting as a gateway or proxy and received an invalid response from an upstream (or origin) server. In most cases the problem is not with you computer or your internet connection , it's far more likely that it's the website's server instead. Fortunately, there are some common and effective solutions for analyzing and fixing most of the causes of 502 Bad Gateway Errors.

Perform a hard-refresh in your browser. On Macs, this is done by pressing Cmd + Shift + R.

This problem is due to poor IP communication between back-end computers, possibly including the Web server at the site you are trying to visit. Before analysing this problem, you should clear your browser cache completely.

If you get this problem for only some of the Web sites you try to visit then it is likely to be a problem at those sites i.e. one of their pieces of equipment is failing/overloaded. Contact the people at those sites.

If you are surfing the Web and see this problem for all Web sites you try to visit, then either 1) your ISP has a major equipment failure/overload or 2) there is something wrong with your internal Internet connection e.g. your firewall is not functioning correctly. In the first case, only your ISP can help you. In the second case, you need to fix whatever it is that is preventing you reaching the Internet.

In some cases, this error caused by low computer hard disk space, you can go check the free space of your computer hard disk. If there is really not enough free space left, clean your computer hard disk well.

Start your browser in Safe Mode. Running a browser in Safe Mode means to run it with default settings and without add-ons or extensions, including toolbars.

If your web application is configured to listen on a socket, ensure that the socket exists in the correct location and that it has the proper permissions

Finally, restart your computer/networking equipment. Some temporary issues with your computer and how it's connecting to your network could be causing 502 errors, especially if you're seeing the error on more than one website. In these cases, a restart would help.
Aguaka
Posts: 1
Joined: 09 Oct 2023, 23:14

Re: 502 Bad Gateway error while "View Issues"

Post by Aguaka »

This is an old question but wanted to give the exact solution I had to fix implement to this error in particular.

Like others said, 502 Bad Gateway is not from the Mantis itself, but from the web/proxy server (in my case, nginx) in front of it.
I had the exact same error on the exact same option, so I went to the logs on /var/logs/nginx/error.log, and then I found this:

Code: Select all

...upstream sent too big header while reading response header from upstream...
And if that's the case, what you need to do is go to the configuration file for the site you are using to serve/proxy the Mantis site, and add this to the server section of the parameters:

Code: Select all

server {
...
 proxy_busy_buffers_size   512k;
 proxy_buffers   4 512k;
 proxy_buffer_size   256k;
 # rest of the nginx config below #
 ...
}
Restart the nginx service, and that's it!
Post Reply