Problem/Motivation
Original report
Watchdog wid reaches maximum integer storeable
To reproduce: have a site which generates a large number of Notices and Warnings (eg. uninitialised variables, unset array keys) per page load, and which receives a very large amount of traffic.
Expected behaviour: dblog automatically limits the number of log messages to the specified value, site continues to function without issue.
Actual behaviour: because dblog never resets the wid auto_increment value, the wid eventually reaches 2147483648. At this point the site suffers a White Screen of Death; all requests fail with a 500 code but no errors are logged in the server logs (as is usual with such errors) and altering error logging does not produce any on-screen errors. (Probably because the attempt to log the DB exception raised fails in its own right.)
Detection of issue: the only ways to find out what is happening are a) to know this is a possible issue and check the current value of the auto_increment, or b) to use a debugger to step through the code line-by-line until a notice is generated.
Possible fixes or remediation:
1. Have dblog output the database error to the server logs, to screen, or somewhere accessible to developers.
2. Have dblog be aware of the maximum value an integer can take in the database used, and refrain from attempting to add any more entries once the wid gets close to that maximum.
3. Have dblog periodically reset all extant wids to start at 1, and reset the auto_increment.
Issue was observed in Drupal v7.67, but definitely affects all v7 variants, and may well affect v8 as well.
Steps to reproduce
Proposed resolution
Remaining tasks
Postponed on #3191391: Schema::changeField() has bug when changing regular serial field to big serial field