Opened on 11/12/2014 at 07:14:30 PM
Closed on 11/12/2014 at 09:13:21 PM
#1560 closed defect (fixed)
ZeroDivisionError in sitescripts.stats.bin.pagegenerator
Reported by: | trev | Assignee: | trev |
---|---|---|---|
Priority: | P1 | Milestone: | |
Module: | Infrastructure | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Platform: | Unknown | |
Ready: | yes | Confidential: | no |
Tester: | Verified working: | no | |
Review URL(s): |
Description
Background
Our stats server was producing errors when generating pages lately:
File "/opt/sitescripts/sitescripts/stats/template/fileStats.html", line 141, in top-level template code {{row(field.title, data[field.name].True, params, chart=False, File "/opt/sitescripts/sitescripts/stats/template/fileStats.html", line 93, in template <td align="right">{{(value.bandwidth / params.totalbandwidth * 100)|round(precision=1)}}%</td> ZeroDivisionError: division by zero
Apparently, params.totalbandwidth is zero. We didn't consider that scenario when the script was created - there must be at least one hit, otherwise no statistics would exist for that file. Here that hit apparently produced zero bandwidth which is highly unusual but not impossible.
What to change
We should guard against division by zero here, similarly to how it is done elsewhere.
Attachments (0)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Fixed: https://hg.adblockplus.org/sitescripts/rev/10ffba8a0b9c