mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-26 17:36:01 +03:00
[GH-ISSUE #2043] Daily Message sending limit is not reset every day #1510
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1510
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AmazingBeu on GitHub (Oct 22, 2020).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2043
On my Modoboa server, the policyd upload limit is not reset every day.
So, my sending limit is lowered each time I send a mail, and never goes back up.
@tonioo commented on GitHub (Oct 23, 2020):
@AmazingBeu How do you start the policy daemon?
@AmazingBeu commented on GitHub (Oct 23, 2020):
Im using supervisord as you recommend in the doc:
And I tried in CLI with the following command:
sudo -u modoboa /srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py policy_daemon --debug -v3 --host localhostAnd I never had any logs, even with the debug and verbosity options.
BTW I also tried without the host option.
But the port 9999 is listening and postfix is using it without errors in logs.
@tonioo commented on GitHub (Oct 23, 2020):
@AmazingBeu Logs should be contained in the /var/log/mail.log file, if you configured the logging part in django. Can you check if you see a 'modoboa.policyd' entry in the LOGGING setting?
@AmazingBeu commented on GitHub (Oct 23, 2020):
@tonioo No, I only have:
@tonioo commented on GitHub (Oct 23, 2020):
Looks like I forgot to mention this in the documentation... You can get an example here: https://github.com/modoboa/modoboa/blob/master/modoboa/core/commands/templates/settings.py.tpl#L319.
@AmazingBeu commented on GitHub (Oct 23, 2020):
@tonioo OK I changed all my LOGGING section for the ones you gave me, I restarted supervisor and uwsgi but i have no more logs.
@tonioo commented on GitHub (Oct 23, 2020):
You mean in the mail.log file?
@AmazingBeu commented on GitHub (Oct 23, 2020):
Yes, nothing more than before (postfix, dovecot and others)
@tonioo commented on GitHub (Oct 23, 2020):
@AmazingBeu If logging is configured correctly, you should see a startup message at least. (see https://github.com/modoboa/modoboa/blob/master/modoboa/policyd/management/commands/policy_daemon.py#L50)
@AmazingBeu commented on GitHub (Oct 23, 2020):
Nothing.
This is my config and other information:
settings.php
$ pip list
Machine informations
@tonioo commented on GitHub (Oct 23, 2020):
@AmazingBeu Config looks fine. Perhaps an issue with syslog configuration?
@AmazingBeu commented on GitHub (Oct 23, 2020):
@tonioo Hmm, I don't know, all the other logs seems work perfectly. There is no solution to set logs to stdout ?
@tonioo commented on GitHub (Oct 24, 2020):
@AmazingBeu you can play with LOGGING settings in order to configure a console output. It shoud be documented in Django's doc.
@AmazingBeu commented on GitHub (Oct 24, 2020):
@tonioo The problem seems to be solved and I don't know why ahah...
It's possible that the absence of LOGGING causes policyd doesn't reset the counters?
@tonioo commented on GitHub (Oct 26, 2020):
@AmazingBeu I don't think so...
Strange !
@tonioo commented on GitHub (Oct 27, 2020):
@AmazingBeu Is it still working?
@AmazingBeu commented on GitHub (Oct 27, 2020):
@tonioo I'm doing some tests, but each test takes 24h... 😁
@tonioo commented on GitHub (Oct 27, 2020):
@AmazingBeu Indeed ;)
@tonioo commented on GitHub (Nov 5, 2020):
@AmazingBeu Any news?
@AmazingBeu commented on GitHub (Nov 7, 2020):
It's look like works only one time, at the first UTC midnight after restarted Supervisor 🤔
I will confirm in 2 days
@AmazingBeu commented on GitHub (Nov 9, 2020):
@tonioo Ok that's it. PolicyD only resets the counters once, but why?
@tonioo commented on GitHub (Nov 10, 2020):
@AmazingBeu I guess it has something to do with rescheduling (see https://github.com/modoboa/modoboa/blob/master/modoboa/policyd/core.py#L277). What python version do you use?
@AmazingBeu commented on GitHub (Nov 10, 2020):
My virtualenv is based on Python 3.7.3 .
You have all the information here, except for Modoboa which I updated to 1.17 yesterday:
https://github.com/modoboa/modoboa/issues/2043#issuecomment-715342871
@tonioo commented on GitHub (Nov 11, 2020):
@AmazingBeu I also use python 3.7 on my own server and I see in logs that the reset_counters coroutine is called every night... I enabled limits on my own account and will check if the counter is reset tomorrow.
@kalimero67 commented on GitHub (Nov 22, 2020):
Sorry boys @AmazingBeu and @tonioo but ...
I have the same problem and I'm waiting for solution.
What is it? Change LOGGING in settings.py? How exactly?
Thanks Jan
@tonioo commented on GitHub (Dec 4, 2020):
@kalimero67 There is no solution at the moment since I can't reproduce the issue on my own server...
@kalimero67 commented on GitHub (Jan 11, 2021):
Then please help with these fatal questions:
root@mail:/etc/cron.d# nmap localhost
9999/tcp open abyss
sudo -u modoboa /srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py p olicy_daemon --debug -v3 --host 127.0.0.1
File "/usr/lib/python3.7/asyncio/baseevents.py", line 1378, in createserver
% (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 9999): address already in use
Thanks thank thanks
@AmazingBeu commented on GitHub (Jan 25, 2021):
FYI, I have the problem with a new installation (Debian 10 and MySQL)
@kalimero67 commented on GitHub (Mar 2, 2021):
If you do NOT find another solution, run (by cron) daily this script:
cat /root/redis.sql | mysql --user=modoboa --password=*** --silent | redis-cli 2>&1
File 'redis.sql':
CONNECT modoboa; SELECT "hset", "messages_count", username, message_limit FROM admin_mailbox AS a JOIN core_user AS c ON a.user_id=c.id WHERE message_limit<>0; SELECT "hset", "messages_count", name, message_limit FROM admin_domain WHERE message_limit<>0; SELECT "hgetall", "messages_count"@tonioo commented on GitHub (Mar 10, 2021):
@AmazingBeu I finally reproduced this issue on my own server! I think the way I planify this periodic task is wrong but I don't know what I could use to replace it. A new cron task is the simplest fix but it is one more task... Otherwise I could introduce a asynchronous scheduler like celery or rq to the default Modoboa setup but it creates one new requirement...
What do you think?
@AmazingBeu commented on GitHub (Mar 10, 2021):
Personally, I would prefer a cron job because it is much simpler (I love the KISS principle 😁)
After that, there might be some advantages to have an asynchronous scheduler, like to get the state of the tasks in Modoboa's web interface, but you might need a lot of work for that...
@alessandromagridotnet commented on GitHub (Apr 22, 2021):
Hi, same error here. The emails work like a charm except for the daily limit.
Is there any news about this bug? (or any workaround?)
@Mik-Cryo commented on GitHub (Dec 1, 2021):
Same problem
Any news, or fix we can apply directly ?
And the most important :) : Merci pour tout ton travail sur Modoboa @tonioo
@tonioo commented on GitHub (May 5, 2022):
I think this issue should be fixed with 2.0. There was a sync <> async issue in the process responsible for resetting counters.