1

Topic: Error: ValueError('No JSON object could be decoded',)

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: FreeBSD 10.3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,
I just upgraded both to 0.9.8 and iRedAdmin-Pro 2.9, everything seems to be working fine, except with the mailing list feature.
as i tried to create a new making list i get this error:
'"Error: ValueError('No JSON object could be decoded',)"
I would like some info on how i can debug this further.
Thank you

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Error: ValueError('No JSON object could be decoded',)

*) Any error in Nginx/uwsgi log files?
*) Do you have parameter "mlmmjadmin_api_auth_token =" in iRedAdmin-Pro config file?

3

Re: Error: ValueError('No JSON object could be decoded',)

ok,
first to your questions:
No errors in Nginx
Yes, the token is setup.

I have further looked into this, since my live server went through a few upgrades i have made a fresh installation in a dev jail and i got the same result.
So i attempted to debug a bit and it looks to me that the issue comes from mlmmjadmin or potentially some python module.
I tried making a query with curl using this format (taken from  the readme.md):

curl -X POST \
    --header 'X-MLMMJADMIN-API-AUTH-TOKEN: 43a89b7aa34354089e629ed9f9be0b3b' \
    -d "owner=postmaster@a.io&only_subscriber_can_post=yes"
    http://127.0.0.1:7790/list@domain.com

of course i replaced the token, postmaster@a.io with an email present in the system as well as 'domain.com' with a domain present in the system (possibly replacing postmaster@a.io and domain.com was not necessary for testing purposes, but...)
the response i get is "Internal Server Error".
I added DEBUG = True to /opt/mlmmjadmin/settings.py but i get the same response...

Any additional debugging that i could run?

4

Re: Error: ValueError('No JSON object could be decoded',)

Try this:

*) Stop mlmmjadmin service.
*) Start it this way:

cd /opt/mlmmjadmin/
python mlmmjadmin.py

Now reproduce the error, you should see some error message on console. We need this error message for troubleshooting.

5

Re: Error: ValueError('No JSON object could be decoded',)

here is the error:

# python mlmmjadmin.py
Traceback (most recent call last):
  File "mlmmjadmin.py", line 18, in <module>
    from libs.logger import logger
  File "/opt/mlmmjadmin-1.4/libs/logger.py", line 16, in <module>
    facility=settings.SYSLOG_FACILITY)
  File "/usr/local/lib/python2.7/logging/handlers.py", line 761, in __init__
    self._connect_unixsocket(address)
  File "/usr/local/lib/python2.7/logging/handlers.py", line 804, in _connect_unixsocket
    self.socket.connect(address)
  File "/usr/local/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 2] No such file or directory

It seems that it might be an error related to logging.
My rc.conf has the flowing lines:

# Prevent syslog to open sockets
syslogd_enable="YES"
syslogd_flags="-ss"

These are recommended settings for a FreeBSD jail but it might affect the logging behavior...
I can try removing those entries if you think that might be the culprit.
thanks

6

Re: Error: ValueError('No JSON object could be decoded',)

I found one problem, which solves the error i got from the command line, but doesn't seem to solve the original issue.
On FreeBSD this line needs to be added to the settings.py file.
SYSLOG_SERVER = '/var/run/log'
This is overwrites the default SYSLOG_SERVER = '/dev/log'.

Now if i ran
# python mlmmjadmin.py
I get no error. But if i call it from the IRedAdmin-Pro interface i still get
Error: ValueError('No JSON object could be decoded',)

I'll continue to investigate, any suggestion appreciated.

7

Re: Error: ValueError('No JSON object could be decoded',)

2 possible solutions:

1) What's the local socket file of syslog? Default is /dev/log, does FreeBSD jail have same socket? if it's different, try to add a parameter in /opt/mlmmjadmin/settings.py like this:

SYSLOG_SERVER = '/dev/path/to/log'

2) Does your jail support logging to the host syslog service? If yes, try to add 2 parameters in /opt/mlmmjadmin/settings.py like this:

SYSLOG_SERVER = '<ip>'
SYSLOG_PORT = 514

After updated settings.py, you need to restart mlmmjadmin service.

8

Re: Error: ValueError('No JSON object could be decoded',)

iredmail.mb wrote:

Now if i ran
# python mlmmjadmin.py
I get no error. But if i call it from the IRedAdmin-Pro interface i still get
Error: ValueError('No JSON object could be decoded',)

What's the output on console?

9

Re: Error: ValueError('No JSON object could be decoded',)

the output is:
http://127.0.0.1:7790/

10

Re: Error: ValueError('No JSON object could be decoded',)

iredmail.mb wrote:

the output is:
http://127.0.0.1:7790/

After this, you should login to iRedAdmin-Pro and trigger the error again. After triggerred, the console should have more log.

11

Re: Error: ValueError('No JSON object could be decoded',)

Very weird.
If i submit a new mailing list with the script running from command line, it works!
But if i start it from /usr/local/etc/rc.d/mlmmjadmin start
it still gives me the error!

12

Re: Error: ValueError('No JSON object could be decoded',)

iredmail.mb wrote:

If i submit a new mailing list with the script running from command line, it works!

Me too,
when "systemctl restart mlmmjadmin.service"
this is my /var/log/message :
Jun  4 15:57:02 mail uwsgi: *** Operational MODE: preforking ***
Jun  4 15:57:02 mail uwsgi: Traceback (most recent call last):
Jun  4 15:57:02 mail uwsgi:  File "mlmmjadmin.py", line 16, in <module>
Jun  4 15:57:02 mail uwsgi:
Jun  4 15:57:02 mail uwsgi: import settings
Jun  4 15:57:02 mail uwsgi: ImportError
Jun  4 15:57:02 mail uwsgi: :
Jun  4 15:57:02 mail uwsgi: No module named settings
Jun  4 15:57:02 mail uwsgi:
Jun  4 15:57:02 mail uwsgi: unable to load app 0 (mountpoint='') (callable not found or import error)

PS: sorry my  OS is :CentOS7; iRedAdmin-Pro-LDAP-3.1

13

Re: Error: ValueError('No JSON object could be decoded',)

when used  https://docs.iredmail.org/upgrade.mlmmjadmin.html
to upgrade .

cd mlmmjadmin-1.4/tools/
bash upgrade_mlmmjadmin.sh

that is working .
Sorry my bad.

14

Re: Error: ValueError('No JSON object could be decoded',)

To my understanding in FreeBSD SYSLOG_SERVER needs to be changed to:
SYSLOG_SERVER = '/var/run/log'
Looking at this man page it confirms that /var/run/log is the default (but maybe i'm missing something, it is the first time that i look at syslog in detail)
https://www.freebsd.org/cgi/man.cgi?que … ;sektion=8
In any case, after many test, i got it to work on my installation with that change alone from the original configuration.

15

Re: Error: ValueError('No JSON object could be decoded',)

This has been fixed in iRedMail. and iRedMail-0.9.8 was repacked with this fix.