Opened 7 years ago

Closed 7 years ago

#91 closed defect (fixed)

division by zero error if rate increment column is occasionally set to 0

Reported by: admin Owned by: somebody
Priority: minor Milestone:
Component: system Version: 2.1-BETA-20100819
Keywords: Cc:

Description

error should be handled by logging to system log properly

[2010-08-31 16:11:51.635608] Executing query rate_auth 
[2010-08-31 16:11:51.635648] Executing query 
SELECT *
FROM
        ENTRATEITEMS r
        INNER JOIN ENTCURRENCY c USING (ATRCURID)
        INNER JOIN ENTDESTCODES d USING (ATRDESTINATIONID)
        INNER JOIN ENTTIMESLOTITEMS t USING (ATRTIMESLOTID)
        INNER JOIN ENTDESTINATIONS dn ON dn.ATRDESTINATIONID = r.ATRDESTINATIONID
WHERE
        r.ATRRATEID = %(rate_id)s AND
        (date_format(now(),'%%H:%%i:%%S') BETWEEN t.ATRSTTM AND t.ATRENTM) AND
        (date_format(now(),'%%w') BETWEEN t.ATRSTDAY AND t.ATRENDAY) AND
        d.ATRDESTCODE = left(%(number)s, length(d.ATRDESTCODE))
ORDER BY length(d.ATRDESTCODE) DESC
LIMIT 1
 
[2010-08-31 16:11:51.635709] Query parameters: 
{'number': '88812127773456', 'rate_id': '36'}

[2010-08-31 16:11:51.636499] Query rate_auth exec-time 0.000904083251953 s 
[2010-08-31 16:11:51.636612] Result row: 
{'ATRMINUTELENGTH': 60L, 'ATRDESTINATIONID': 90L, 'ATRRATEID': 36L, 'ATRMINLENGTH': 2L, 'ATRCURID': 1L, 'ATRTIMESLOTID': 1L, 'ATRENTM': datetime.timedelta(0, 86399), 'ATRINCR': 0L, 'ATRCODELISTID': 39L, 'ATRINVDESTGROUPID': 0L, 'ATRSTDAY': 0L, 'ATRMAXLENGTH': 32L, 'ATRTIMESLOTITEMID': 1L, 'ATRENDAY': 6L, 'ATRCURNAME': 'USD', 'ATRDESTCODEID': 129L, 'ATRDESTENABLE': 1L, 'ATRSTTM': datetime.timedelta(0), 'ATRDESTNAME': 'CodeTest', 'ATRCURRATE': Decimal("1.00000000"), 'ATRTIMESTAMP': datetime.datetime(2010, 8, 20, 16, 20, 51), 'ATRRATEM': 0.050000000000000003, 'ATRGRACE': 1L, 'ATRRATEC': 0.0, 'ATRRTID': 122L, 'ATRCURDSCR': 'US Dollar', 'ATRDESTCODE': '8', 'ATRSRCID': 0L, 'ATRMINDUR': 1L}

[2010-08-31 16:11:51.637202] ERROR: Authorization module produced an exception. 
[2010-08-31 16:11:51.637892] ERROR: Traceback (most recent call last):
  File "/home/dtl/billing/radius_modules/radmod_authorize.py", line 72, in authorize
    result = _authorize(received, check, reply)
  File "/home/dtl/billing/radius_modules/radmod_authorize.py", line 721, in _authorize
    rem_sec -= (rem_sec) % user_rate.ATRINCR
ZeroDivisionError: long division or modulo by zero
 
[2010-08-31 16:11:51.637950] Auth Completed in  0.0204701423645 seconds 

Change History (1)

comment:1 Changed 7 years ago by admin

  • Resolution set to fixed
  • Status changed from new to closed

increment is set to 1 if it was 0

Note: See TracTickets for help on using tickets.