Year 2038 problem

Issue #626 resolved
Uwe Kiewel created an issue

see also https://en.wikipedia.org/wiki/Year_2038_problem

To keep most mails "forever", I set default retention to 36500 (100 years). Now I encountered missing mails with that retention time. I checked metadata table and found out retained = 304736003. That unix time stamp means Wed, 29 Aug 1979 00:53:23 GMT. Therefore, pilerpurge purged all mails with the default retention.

I marked that bug as critical due to a retention of "only" 23 years from now will run into that problem.

Comments (3)

  1. Janos SUTO repo owner

    I've just mitigated the issue by fixing the data type of the retention field. It's capable of holding a 4 byte unsigned value providing a time range to 2106, I believe that it's a reasonable upper limit.

    However please carefully choose the retention value. The resulting retention date mustn't go beyond 2016 (if you use the fix, get the master branch to have it) to prevent the overflow. For example, some people use 36500 days (~100 years) for the retention days to prevent the deletion of some important messages, however it's wrong, because 2015 + 100 = 2115 > 2106.

    It's also possible to use a 8 byte long value storing the retention date, however it would require a database schema change (I'm reluctant to force it), and though I believe that piler is a great piece of software I have doubts that it will be used long after I'm gone. Thinking about some 'eternal' message stores, it's possible that you will stop sending emails to the given piler at a given point, and stop purging as well, thus emails will be preserved to the end of times, if that's really necessary.

    So in a nutshell: upgrade to the latest master branch, and you'll be fine until 2106. Perhaps I'll upgrade the database type to a 8 byte version (unsigned bigint) which would survive even the collapse of the Sun (in terms of date capabilities).

  2. Log in to comment