mailinabox icon indicating copy to clipboard operation
mailinabox copied to clipboard

Internal Server Error adding Aliases

Open infidelus opened this issue 4 years ago • 8 comments

I've been using MIAB for Two months now. Over the last few weeks, whenever I try to add an alias address I get a popup saying:

Add Alias
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Contrary to the message it doesn't seem to affect the actual adding as the new alias appears as soon as I refresh the page, but thought it might be worth mentioning. I noted there's a similar closed bug someone posted a couple of years (https://github.com/mail-in-a-box/mailinabox/issues/1296) that didn't have any obvious resolution.

I originally installed 0.44 and have subsequently run sudo mailinabox (to fix another error) and also recently upgraded to 0.45. No other changes on the host apart from Ubuntu 18.04 updates.

infidelus avatar May 21 '20 18:05 infidelus

I'm also seeing a similar error now if I try and add custom DNS entries

Custom DNS (Error)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

infidelus avatar Jun 10 '20 20:06 infidelus

As noted in https://github.com/mail-in-a-box/mailinabox/issues/1778, I tried a fresh install today to see if it resolved the error. After restoring the backup and logging in, unfortunately the error was also back. So it appears whatever's wrong is either saved in the backup or there's a problem with nginx.

infidelus avatar Jun 13 '20 20:06 infidelus

Server errors from the management daemon are in syslog. Find call stacks in the logs with this: grep Traceback /var/log/syslog | sed 's/#012/\n/g' The error may be in a rotated log file, though, because you posted about this 2 days ago. You could try this as well: gzip -dc /var/log/syslog.2.gz | grep Traceback | sed 's/#012/\n/g' Maybe it will reveal something, maybe not.

downtownallday avatar Jun 15 '20 18:06 downtownallday

Thanks.

The first command didn't return anything, but the second did, though I don't know if it helps.

error.log

infidelus avatar Jun 15 '20 19:06 infidelus

Just as a test, I've just tried adding a custom DNS entry again, then run your first command. Output attached.

error.log

infidelus avatar Jun 15 '20 19:06 infidelus

The management daemon doesn't report program output in syslog for the "untrapped" call to shell(), so it's impossible to know why the zone signing failed (assuming here that ldns-signzone outputted something meaninful). If the temp files are still hanging around, I guess you could run the shell command manually from a prompt as root.

downtownallday avatar Jun 17 '20 01:06 downtownallday

Thanks. Unfortunately I see the same internal server error at the terminal and the same errors appear as in the previous error log.

The entry still shows in the management interface if I refresh the page.

infidelus avatar Jun 17 '20 09:06 infidelus

I have a similar problem with v55:

Dec  6 17:53:17 jumplink Exception on /dns/custom [GET]
Traceback (most recent call last):
  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/root/mailinabox/management/daemon.py", line 75, in newview
    return viewfunc(*args, **kwargs)
  File "/root/mailinabox/management/daemon.py", line 332, in dns_get_records
    for i, r in enumerate(sorted(records, key = lambda r : (
  File "/root/mailinabox/management/daemon.py", line 333, in <lambda>
    zones.index(r["zone"]) if r.get("zone") else 0, # record is not within a zone managed by the box
KeyError: 'zone'

Looks like the key "zone" does not exist for me.

Edit I have switched to master because there seems to be a fix: https://github.com/mail-in-a-box/mailinabox/commit/34017548d5833e598fc0b72f9b816fa788c119d3

But this not help. I have updated the error message above for that.

Edit 2 I had to restart the daemon with service mailinabox restart, now it works

JumpLink avatar Dec 06 '21 16:12 JumpLink