1 (edited by misceh 2018-08-21 09:38:17)

Topic: Iredapd throttle setting priority issue

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8 (Upgraded from 0.9.7)
- Linux/BSD distribution name and version: centos-release-7-5.1804.el7.centos.2.x86_64
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,

My throttle setting as below:

Global setting: (Only apply outbound throttle)
Period of time: 21600
Max outbound: 250
Cumulative Max Size: 0 (unlimited)
Max Size in Single Mail: 15000000

Below setting applied to 1 particular email account: (postmaster@xxx.com)
Period of time: 21600
Max outbound: 0 (unlimited)
Cumulative Max Size: 0 (unlimited)
Max Size in Single Mail: 15000000

===============================
With above setting, max oubound message for postmaster@xxx.com should be unlimited.
However, i check the iredapd log it is still showing postmaster@xxx.com max_msgs = 250

This is the log:

2018-08-21 09:10:53 DEBUG [SQL] Query throttle setting:

        SELECT id, account, priority, period, max_msgs, max_quota, msg_size
          FROM throttle
         WHERE kind='outbound' AND account IN ('192.168.1.27', '@ip', 'postmaster@xxx.com', '@xxx.com', '@.', '192.168.1.*', '192.168.*.27')
         ORDER BY priority DESC
         
2018-08-21 09:10:53 DEBUG [SQL] Query result:
[(4L, 'postmaster@xxx.com', 10, 21600L, 0L, 0L, 0L), (1L, '@.', 0, 21600L, 250L, 0L, 15000000L)]
2018-08-21 09:10:53 DEBUG sender throttle setting: max_msgs=250/id=4/account=postmaster@xxx.com; 
msg_size=15000000 (bytes)/id=1/account=@.; 

Look at the throttle.py source code, it seems like bypassing the higher priority setting if the value of max_msg is "0" (unlimited)

Source code:

if continue_check_max_msgs and _max_msgs > 0:
            continue_check_max_msgs = False
            t_settings['max_msgs'] = {'value': _max_msgs,
                                      'period': _period,
                                      'tid': _id,
                                      'account': _account,
                                      'track_key': [],
                                      'expired': False,
                                      'cur_msgs': 0,
                                      'cur_quota': 0,
                                      'init_time': 0}
            t_setting_keys[(_id, _account)].append('max_msgs')
            tracking_sql_where.add('(tid=%d AND account=%s)' % (_id, sql_user))
            throttle_info += 'max_msgs=%(value)d/id=%(tid)d/account=%(account)s; ' % t_settings['max_msgs']

Right now, what my workaround for this is to set Max outbound 999999 for the postmaster@xxx.com

----

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

2

Re: Iredapd throttle setting priority issue

Fixed moment ago, patch here:
https://bitbucket.org/zhb/iredapd/commi … b7fd9e607b

3

Re: Iredapd throttle setting priority issue

Hi Zhang,

Thank you very much.
This fixed the problem.

4 (edited by misceh 2018-08-23 12:00:24)

Re: Iredapd throttle setting priority issue

Hi Zhang,

Sorry for my previous reply, the max_msgs is correct now but iredapd log appears below error now.

2018-08-23 08:31:45 ERROR <!> Error while applying plugin "throttle": ['Traceback (most recent call last):\n', '  File "/opt/iRedAPD-2.2/libs/utils.py", line 105, in apply_plugin\n', '  File "/opt/iredapd/plugins/throttle.py", line 600, in restriction\n', '  File "/opt/iredapd/plugins/throttle.py", line 444, in apply_throttle\n', "KeyError: 'msg_size'\n"]

Please help.

**We are using iredapd 2.2 version**

5

Re: Iredapd throttle setting priority issue

with the change from

if continue_check_msg_size and _msg_size > 0:

to

if continue_check_msg_size and _msg_size == 0:

Seems like it's going to skip if the _msg_size not equal to 0.
And causing the error occurs?

2018-08-23 08:31:45 ERROR <!> Error while applying plugin "throttle": ['Traceback (most recent call last):\n', '  File "/opt/iRedAPD-2.2/libs/utils.py", line 105, in apply_plugin\n', '  File "/opt/iredapd/plugins/throttle.py", line 600, in restriction\n', '  File "/opt/iredapd/plugins/throttle.py", line 444, in apply_throttle\n', "KeyError: 'msg_size'\n"]

6

Re: Iredapd throttle setting priority issue

I don't have this error while testing, it's more like a python syntax error after patched. May i know how you patched it?

Btw, i committed new fix for this issue ('==' should be '>='):
https://bitbucket.org/zhb/iredapd/commi … 2b00b6099d

Since only 3 lines changed, i think it might be easier for you to edit the file manually and apply the changes.