Mailman 3 Web Application Startup Time or Availability - 502 Bad Gateway and Postorius
Hello,
I've been setting up a new Mailman 3 installation earlier this year, and I think things have been going okay so far.
I've noticed, however, that after a long amount of time passes (for example, a weekend), when I try to visit the local Mailman 3 web application (e.g., example.mailman.site/mailman3/lists/, where it says "Postorius" at the top left corner of the page and shows a list of mailing lists in the body of the page), I sometimes get a 502 Bad Gateway type of error (referenced from my notes). As far as I can tell, this looks like a normal web server (nginx?) error. If I try visiting the Mailman 3 server location again in a web browser shortly thereafter, I still might get a 502 Bad Gateway error. If I wait a while longer (maybe a minute or more?), the Mailman 3 web application appears to load as expected.
I've tried looking at the gunicorn documentation (https://docs.gunicorn.org/en/stable/index.html) and searching online (including in this Mailman3 mailing list) to see if there's something that can be done to fix this issue. The closest thing I can find for now is advice for something that, while possibly being technologically unrelated, includes the idea of "warmup requests", which makes me think of simply setting up some sort of script to periodically load a page on the Mailman 3 web application in order to keep it more available for visitors (https://stackoverflow.com/a/57056170).
Is there a setting or something in any of the Mailman 3 related programs that could help with keeping the Mailman 3 web application up and running more often without having to resort to making an ongoing, automated request to the Mailman 3 web application?
Thank you.
- Note: "Mailman 3" terminology is referenced from this page: https://lists.mailman3.org/archives/
On 5/3/21 1:45 PM, summersan@nclack.k12.or.us wrote:
Hello,
I've been setting up a new Mailman 3 installation earlier this year, and I think things have been going okay so far.
I've noticed, however, that after a long amount of time passes (for example, a weekend), when I try to visit the local Mailman 3 web application (e.g., example.mailman.site/mailman3/lists/, where it says "Postorius" at the top left corner of the page and shows a list of mailing lists in the body of the page), I sometimes get a 502 Bad Gateway type of error (referenced from my notes). As far as I can tell, this looks like a normal web server (nginx?) error. If I try visiting the Mailman 3 server location again in a web browser shortly thereafter, I still might get a 502 Bad Gateway error. If I wait a while longer (maybe a minute or more?), the Mailman 3 web application appears to load as expected.
What is your configuration for accessing Mailman. I gather you are proxying from nginx to something. Is that something gunicorn or uwsgi? You mention gunicorn but this can be confusing as mailman core's REST API uses gunicorn, but that is separate from the web server's wsgi interface to Django.
In any case, this issue is probably with whatever nginx is proxying to (gunicorn or uwsgi) and not with Django or Mailman core.
I've tried looking at the gunicorn documentation (https://docs.gunicorn.org/en/stable/index.html) and searching online (including in this Mailman3 mailing list) to see if there's something that can be done to fix this issue. The closest thing I can find for now is advice for something that, while possibly being technologically unrelated, includes the idea of "warmup requests", which makes me think of simply setting up some sort of script to periodically load a page on the Mailman 3 web application in order to keep it more available for visitors (https://stackoverflow.com/a/57056170).
That's certainly a possibility and may be a solution. It would be simple enough to set up an hourly cron to do a curl or wget to retrieve example.mailman.site/mailman3/lists/ and see if that helps.
Is there a setting or something in any of the Mailman 3 related programs that could help with keeping the Mailman 3 web application up and running more often without having to resort to making an ongoing, automated request to the Mailman 3 web application?
Nothing that I'm aware of, but if so, it would most likely be a gunicorn or uwsgi setting rather than something in Mailman or Django, although it could be that gunicorn or uwsgi is timing out in trying to connect to Django in which case it could be a Django issue, but not one I've heard of.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Hi Mark,
Thank you for your quick response!
When setting up Mailman 3, I went through much of this "how to" guide here: https://wiki.list.org/DOC/Howto_Install_Mailman3_On_Debian10.
As far as I can tell, my current setup appears to be proxying from Nginx to Gunicorn, according to the related Nginx and mailman3-project-specific Gunicorn config files. Specifically, I checked the local address:port being used in the Nginx file and compared that to the mailman3-project-specific Gunicorn bind address. It looks like I might have "separated out" the REST API to a different server block in the Nginx config file, so I think I'm looking at the correct server block with this conclusion.
For what it's worth, I don't recall this type of "slow first visit startup" issue happening in the past when using web applications with uwsgi, and I've had the opportunity to use uwsgi with a variety of programs. I think Gunicorn is fairly new to me. I do, however, remember that something like this might have happened in the past when using Passenger (https://www.phusionpassenger.com/) a long time ago, but that might have been setting related on my part.
Okay, thanks for the encouragement about the potential solution to periodically accessing the related "example.mailman.site/mailman3/lists/" type location (from my earlier email). Wanted to check on that and was also hoping that there might be some setting I'm missing in the overall Mailman 3 project setup related to the "slow first visit startup" issue.
Thank you!
On 5/3/21 3:27 PM, summersan@nclack.k12.or.us wrote:
Hi Mark,
Thank you for your quick response!
When setting up Mailman 3, I went through much of this "how to" guide here: https://wiki.list.org/DOC/Howto_Install_Mailman3_On_Debian10.
Which uses gunicorn as the wsgi server for Django.
As far as I can tell, my current setup appears to be proxying from Nginx to Gunicorn, according to the related Nginx and mailman3-project-specific Gunicorn config files. Specifically, I checked the local address:port being used in the Nginx file and compared that to the mailman3-project-specific Gunicorn bind address. It looks like I might have "separated out" the REST API to a different server block in the Nginx config file, so I think I'm looking at the correct server block with this conclusion.
Nginx has nothing to do with the REST API. The REST API is accessed by Postorius and HyperKitty via mailmanclient and django-mailmane which are installed by pip as dependencies of Postorius and Hyperkitty.
For what it's worth, I don't recall this type of "slow first visit startup" issue happening in the past when using web applications with uwsgi, and I've had the opportunity to use uwsgi with a variety of programs. I think Gunicorn is fairly new to me. I do, however, remember that something like this might have happened in the past when using Passenger (https://www.phusionpassenger.com/) a long time ago, but that might have been setting related on my part.
Okay, thanks for the encouragement about the potential solution to periodically accessing the related "example.mailman.site/mailman3/lists/" type location (from my earlier email). Wanted to check on that and was also hoping that there might be some setting I'm missing in the overall Mailman 3 project setup related to the "slow first visit startup" issue.
I'm not aware of anything you missed. I think this has to be a gunicorn issue or possibly related to Django, but I'm not specifically aware of any issues. There might be something you can set in gunicorn, but I don't know what.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
summersan@nclack.k12.or.us