Closed tschuettler closed 4 years ago
I made my first steps with python and tried to debug this.
I was able to reproduce this behaviour with the test report https://github.com/modoboa/modoboa-dmarc/blob/master/modoboa_dmarc/tests/reports/Report_Domain_ngyn.org_Submitter_yahoo.com_Report-ID_1435111091.916236.eml:
The report_id is stored with less precission as a float.
Python3 seems to have a higher precission for floats as it is working fine there. I'm not sure where to alter that default behaviour. But since python3 does not seem to be affected i will try to upgrade the virtualenv.
I could boil the issue down to 2 minimal virtualenvs:
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print(float('1435111091.916236'))
1435111091.92
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print(float('1435111091.916236'))
1435111091.916236
@tschuettler Sorry for the late reply. Actually, modoboa does not try to interpret the report ID (you can see the type of the model field is Charfield). Unfortunately, I think it is an lxml issue which tries to guess the type of attribute. I don't know if there is an easy way to fix this on Python2...
The issue is now obsolete since Python2 is not supported anymore.
The actual report_id
1536287116.249533
from the xml gets truncated and rounded to1536287116.25
.Since we got 9 reports from yahoo that all have the about the same report_id (=timestamp) and were received at about the same time there was a unique contraint violation when the truncated report_id did not equal the rounded report_id that is stored from a previous report.
Since this exception is not handled, the full traceback will be send to the reporter.
Traceback for: Report Domain: email.oxfam.de Submitter: compuserve.com Report-ID: <1536287116.249533>:
The reports where the report_id is only truncated and rounded down are silently ignored when there is a matching report found, that should not actually be matched: (Importing report 1536287116.25 received from Yahoo! Inc. Report already imported.)