Only held_messages for 1 (of 3) list has "Mailman REST API not available" message.
Hi everyone,
Today my stable mailman3 server started having web access problems. It specifically applies to only one of three lists on the mailman server (one of the others use the same domain name) and only to the held_messages page as admin. It displays the "Mailman REST API not available..." message despite the other two lists displaying it fine. I've rebooted the server and mailman core, but the problem remains (which is what I've seen suggested on this forum for the same error message so far).
I've been running a stable mailman3 server for the last 9 months and only updating the security patches for the the underling OS (Debian 10 with postgresql and nginx), I've encountered a problem that just seemed to appear today (wish no recent changes on the server).
Any suggestions or diagnosis to resolve it?
Duane
On 1/6/22 9:44 AM, Duane Raymond wrote:
Hi everyone,
Today my stable mailman3 server started having web access problems. It specifically applies to only one of three lists on the mailman server (one of the others use the same domain name) and only to the held_messages page as admin. It displays the "Mailman REST API not available..." message despite the other two lists displaying it fine. I've rebooted the server and mailman core, but the problem remains (which is what I've seen suggested on this forum for the same error message so far).
This sounds like a database problem. What's in Mailman core's var/logs/mailman.log ?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Thanks Mark.
This sounds like a database problem. What's in Mailman
core's var/logs/mailman.log ?
In the var/logs/mailman.log there was a permission error for the messages/ store folders. I noticed that some of the mm file and directories were owned by root vs 'mailman' user (what Brian uses when he set up the mm3 server). So after resetting all to mailman (I believe others use 'list') the error had changed (and other lists still seem to work fine). I checked the database, but wasn't sure what to look for. It is accessible and works for other lists on the same server.
Now I get the error below with the error from mailman.log. I've already restarted nginx and mailman gunicorn qcluster on the server. Any further suggestions to resolve this? Anyone out there wish to take a look as paid work? Something went wrong HTTP Error 500: <html> <head> <title>Internal Server Error</title> </head> <body> <h1><p>Internal Server Error</p></h1> </body> </html>
[07/Jan/2022:12:39:11 +0000] "GET /3.1/lists/listname@mylist.com/requests HTTP/1.1" 200 26760 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:11 +0000] "GET /3.1/lists/ listname.mylist.com/member/duane.raymond%40fairsay.com HTTP/1.1" 200 533 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:11 +0000] "GET /3.1/users/daaca246222e4eb595db826e8af776c2 HTTP/1.1" 200 292 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:11 +0000] "GET /3.1/users/daaca246222e4eb595db826e8af776c2/preferred_address HTTP/1.1" 200 425 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:11 +0000] "GET /3.1/lists/ listname@mylist.com/requests/count?token_owner=moderator HTTP/1.1" 200 73 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:11 +0000] "GET /3.1/lists/listname@mylist.com/held/count HTTP/1.1" 200 73 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:13 +0000] "GET /3.1/lists/listname.mylist.com HTTP/1.1" 200 438 "-" "GNU Mailman REST client v3.3.2" [07/Jan/2022:12:39:13 +0000] "GET /3.1/lists/ listname@mylist.com/held?count=0&page=1 HTTP/1.1" 200 90 "-" "GNU Mailman REST client v3.3.2" [2022-01-07 12:39:13 +0000] [32130] [ERROR] Error handling request /3.1/lists/listname@mylist.com/held?count=10&page=1 Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle self.handle_request(listener, req, client, addr) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 175, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/database/transaction.py", line 50, in wrapper rtn = function(*args, **kws) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/wsgiapp.py", line 193, in __call__ return super().__call__(environ, start_response) File "falcon/api.py", line 274, in falcon.api.API.__call__ File "falcon/api.py", line 269, in falcon.api.API.__call__ File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/post_moderation.py", line 174, in on_get resource = self._make_collection(request) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/helpers.py", line 182, in _make_collection entries = [as_dict(resource) for resource in collection] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/helpers.py", line 182, in <listcomp> entries = [as_dict(resource) for resource in collection] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/post_moderation.py", line 164, in _resource_as_dict resource = self._make_resource(request.id) File "/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/post_moderation.py", line 77, in _make_resource resource['msg'] = msg.as_string() AttributeError: 'NoneType' object has no attribute 'as_string' [07/Jan/2022:12:39:13 +0000] "GET /3.1/lists/ listname@mylist.com/held?count=10&page=1 HTTP/1.1" 500 0 "-" "-"
On 1/7/22 4:51 AM, Duane Raymond wrote:
Thanks Mark.
This sounds like a database problem. What's in Mailman
core's var/logs/mailman.log ?
In the var/logs/mailman.log there was a permission error for the messages/ store folders. I noticed that some of the mm file and directories were owned by root vs 'mailman' user (what Brian uses when he set up the mm3 server). So after resetting all to mailman (I believe others use 'list')
`list` is used by the Debian/Ubuntu packages. We recommend `mailman`. These ownership issues are often caused by running Mailman core as `root`. This causes certain things to be created/owned by `root` and when Mailman core is later run as `mailman`, it can't access these things. To guard against this, Mailman core >=3.3.5 will refuse to run Mailman as `root` unless a `--run_as_root` option is specified.
Now I get the error below with the error from mailman.log.
...
"/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman/rest/post_moderation.py", line 77, in _make_resource resource['msg'] = msg.as_string() AttributeError: 'NoneType' object has no attribute 'as_string'
This is https://gitlab.com/mailman/mailman/-/issues/856, fixed in Mailman 3.3.5 by https://gitlab.com/mailman/mailman/-/merge_requests/819. You can apply this patch to avoid the issue. ``` --- a/src/mailman/rest/post_moderation.py +++ b/src/mailman/rest/post_moderation.py @@ -74,7 +74,15 @@ class _HeldMessageBase(_ModerationBase): # resource. XXX See LP: #967954 key = resource.pop('key') msg = getUtility(IMessageStore).get_message_by_id(key) - resource['msg'] = msg.as_string() + if msg is None: + resource['msg'] = """\ +Subject: Message content lost +Message-ID: {} + +This held message has been lost. +""".format(key) + else: + resource['msg'] = msg.as_string() # Some of the _mod_* keys we want to rename and place into the JSON # resource. Others we can drop. Since we're mutating the dictionary, # we need to make a copy of the keys. When you port this to Python 3, ``` -- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Thanks Mark,
I was able to solve it as I decided to update to the version 3.3.5 (I was reluctant because the person who helped me install it - Brian - died of covid last year as you know).
Thanks for your help in getting me far enough that I could resolve the issue!
Cheers,
Duane
participants (2)
-
Duane Raymond
-
Mark Sapiro