[MDEV-22219] negative values on system variables longer equate to their maximium value Created: 2020-04-11 Updated: 2022-02-07 Resolved: 2021-04-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6 |
| Fix Version/s: | 10.6.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Roel Van de Paar | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | affects-tests, not-10.1, not-10.2 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
Leads to a standard OOM:
Due to:
Not sure where the 9223372036854775808 value comes from, but that (or the 3298534883352) would seem to be what causes the oversized alloc and subsequent OOM. Also not sure why in the error log above the Aria error (Can't lock...) is there (no other instance running there);
MariaDB 10.1.45 (dbg) produces the following instead of OOM;
Bug confirmed present in: Bug confirmed not present in: Fix ideas? disallow signed values, or sanity check 0 to max, or check data types (difference between versions maybe?), or mirror 10.1/10.2 behavior |
| Comments |
| Comment by Daniel Black [ 2020-04-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
So no ERANGE error on a negative number which seems consistent with the fineprint of strtoull's man page. Max size set a few instructions later based on LLONG_MAX https://github.com/MariaDB/server/blob/10.5/storage/innobase/handler/ha_innodb.cc#L19476
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2020-04-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thank you danblack for the analysis! | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2020-04-12 ] | ||||||||||||||||||||||||||||||||||||||||||
|
https://github.com/MariaDB/server/blob/10.5/unittest/mysys/my_getopt-t.c#L380-L386 described it as intentional (and questionable). I tend to think, if that supporting a easy setting to a maximum is needed (is there? which variables make sense?), there should be a set global XXX='MAXIMUM' like there is for 'DEFAULT'. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-04-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
danblack, thank you for the analysis. Indeed, strtoull() is not documented to return ERANGE for negative numbers, unless the non-negated number is out of range. Originally, only strtoll() was being used. The strtoull() variant was introduced in Later, in MariaDB 10.3.7, I changed innodb_buffer_pool_size to be unsigned, in an effort to reduce the amount of -Wconversion in InnoDB. (Finally, | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2020-05-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
This bug affects all unsigned parameters as I understand it, ref https://jira.mariadb.org/browse/MDEV-22501?focusedCommentId=152390&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-152390 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2021-04-07 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Merged fix into 10.6 that all negative values for unsigned returns an error. I haven't done a set global ... = MAXIMIUM. Lets leave that as a separate issue. There wasn't the interesting in a non-GA fix. So 10.6 it is. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2021-04-07 ] | ||||||||||||||||||||||||||||||||||||||||||
|
danblack Please let dbart and greenman know that this is a change in behaviour and that users need to be informed, in release notes and in the knowledge base. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2021-04-07 ] | ||||||||||||||||||||||||||||||||||||||||||
|
https://mariadb.com/kb/en/mariadb-1060-release-notes/ has been updated. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2021-04-12 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Followup in MDEV-25386 |