On 04/26/2011 03:21 PM, Juan Rossi wrote: > > > On 20/04/11 18:57, Simon Hobson wrote: >> Juan Rossi wrote: >> >>> I am having trouble with the quotas module for policyd 2.0.10, >>> >>> I have the following configuration as policies, basically throttle SASL >>> authenticated users: >>> >>> Policy: Name Default Ext SASL auth >>> Source Members: $*,!%internal_ips,!%whitelisted >>> >>> >>> I have the quotas set as: >>> >>> Policy: Default Ext SASL auth >>> Name: Quote SASL USER >>> Track: SASLUsername >>> Period: 600 >>> Verdict: DEFER >>> >>> >>> And the limit for the above quota set to: >>> >>> Type Counter Limit >>> MessageCount 5 >>> MessageCumulativeSize 10485760 >>> >>> When a email comes in, MessageCount works fine, but the >>> MessageCumulativeSize not as expected. >>> >>> When I test user, during the protocol status RCPT I get the normal stuff: >>> >>> Apr 19 23:17:24 juan cbpolicyd[15109]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], rea >>> son=quota_update, policy=7, quota=3, limit=4, >>> track=SASLUsername:[email protected], counter=MessageCount, >>> quota=2/5 (38.9%) >>> Apr 19 23:17:24 juan cbpolicyd[15109]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], rea >>> son=quota_update, policy=7, quota=3, limit=5, >>> track=SASLUsername:[email protected], >>> counter=MessageCumulativeSize, quota=656667/10485760 (6.3%) >>> >>> >>> But when the protocol reaches END-OF-MESSAGE I get: >>> >>> >>> Apr 19 23:20:56 juan cbpolicyd[4995]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], reas >>> on=quota_update, policy=7, quota=3, limit=5, >>> track=SASLUsername:[email protected], >>> counter=MessageCumulativeSize, quota=7645098/10485760 (72.9%) >>> >>> >>> If I send another email, just behind this one: >>> >>> Apr 19 23:23:55 juan cbpolicyd[4992]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], reason=quota_update, policy=7, quota=3, >>> limit=4, track=SASLUsername:[email protected], >>> counter=MessageCount, quota=3/5 (33.5%) >>> Apr 19 23:23:55 juan cbpolicyd[4992]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], reason=quota_update, policy=7, quota=3, >>> limit=5, track=SASLUsername:[email protected], >>> counter=MessageCumulativeSize, quota=701667/10485760 (6.7%) >>> >>> END-MESSAGE >>> >>> Apr 19 23:26:37 juan cbpolicyd[15109]: module=Quotas, mode=update, >>> host=60.234.162.14, helo=[192.168.0.37], [email protected], >>> [email protected], reason=quota_update, policy=7, quota=3, >>> limit=5, track=SASLUsername:[email protected], >>> counter=MessageCumulativeSize, quota=7633962/10485760 (72.8%) >>> >>> >>> It like MessageCumulativeSize gets updated to the latest message size, >>> in the two stages, instead of work like MessageCount. >>> >>> What could be the problem? >> >> Looks fine to me. Each time you send a massage, the quota counters get >> updated - by adding the latest message AND by "tailing off" the current >> counter. There is a 3 minute gap between those two messages, so the >> counters will get reduced by about 30% before adding the second message. >> You can see that best with the message count which drops from 38% to 33% >> by the time the second message goes through. For the cumulative size, >> the numbers don't look quite right, I'd expect something more in the >> area of 5M when the second message starts going through. >> >> Try sending the messages closer together and see what happens. Also, >> which version are you using ? >> > > > Hi, I am using policyd version 2.0.10 > > > I changed one og the quota policy interval > Policy: Default Ext SASL auth > Name: Quote SASL USER > Track: SASLUsername > Period: 1800 > Verdict: DEFER > > > Here are a new set of logs > > I might have screwed the lasts logs > > * MESSAGE 1: > > Apr 26 03:15:19 juan cbpolicyd[13495]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=4, track=SASLUsername:[email protected], > counter=MessageCount, quota=3/5 (54.4%) > Apr 26 03:15:19 juan cbpolicyd[13495]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=5, track=SASLUsername:[email protected], > counter=MessageCumulativeSize, quota=952222/10485760 (9.1%) > > > - END OF MESSAGE > > > Apr 26 03:16:27 juan cbpolicyd[15109]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=5, track=SASLUsername:[email protected], > counter=MessageCumulativeSize, quota=5273748/10485760 (50.3%) > > > * MESSAGE 2: > Apr 26 03:17:24 juan cbpolicyd[4995]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=4, track=SASLUsername:[email protected], > counter=MessageCount, quota=4/5 (70.7%) > Apr 26 03:17:24 juan cbpolicyd[4995]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=5, track=SASLUsername:[email protected], > counter=MessageCumulativeSize, quota=968333/10485760 (9.2%) > > > - END OF MESSAGE > > Apr 26 03:18:47 juan cbpolicyd[4992]: module=Quotas, mode=update, > host=60.234.162.14, helo=[192.168.0.37], [email protected], > [email protected], reason=quota_update, policy=7, quota=3, > limit=5, track=SASLUsername:[email protected], > counter=MessageCumulativeSize, quota=5289861/10485760 (50.4%) > > > > My problem is MessageCumulativeSize only, the other counter works perfectly. > > Is like MessageCumulativeSize get reseted, and the percentage always > goes back and forward. > > I am sending 3 MB emails each time, and the cumulative message size does > not seems to not apply. > > Any help with this?
Just tested also 2.0.11, happens with this version also. Found the error, finally, is within the table quotas_tracking structure. The default structure for the field quotas_tracking.Counter (tested in mysql) is decimal(10,4). Since the MessageCumulative size limit in the quota module is in bytes this is easy to overflow, and the value stored in database ends being 999999.9999, which is roughly almost 1 MB only The quota update tries to setup for example a 5 MB quota usage, but the counter field get stalled at 1MB, that why it looked that the Counter field reset. By resetting the database structure in the field quotas_tracking.Counter to decimal(15,4) that gives a maximum of 99999999999.9999, or 93GB. And solved the problem Will send the same to devel, as a bug report Regards Juan.- _______________________________________________ Users mailing list [email protected] http://lists.policyd.org/mailman/listinfo/users
