Bug #71852 ULONG_MAX capable sys vars could not set in my.cnf
Submitted: 27 Feb 2014 6:34 Modified: 5 Mar 2014 11:56
Reporter: Yasushi Miyazaki Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.16, 5.6.17 OS:Linux
Assigned to: CPU Architecture:Any
Tags: eval_num_suffix

[27 Feb 2014 6:34] Yasushi Miyazaki
Description:
On 64 bit matchines, ULONG_MAX value is possibility over LLONG_MAX value.
Therefore, ULONG_MAX capable variables, for example 'max_connect_errors', could not set the value between (LONG_MAX(==LLONG_MAX) + 1) and ULONG_MAX.

At function 'eval_num_suffix' in mysys_ssl/my_getopt.cc parse number using 'strtoll'. 'strtoll' returns between LLONG_MIN and LLONG_MAX. In order to parse ULONG_MAX value, these range is insufficiency.

How to repeat:
for example, max_connect_errors:
1. max value written on reference manual in my.cnf:
[mysqld]
max_connect_errors = 18446744073709547520
2. start mysqld
3. see mysql.err
[ERROR] Incorrect integer value: '18446744073709547520'
[Warning] option 'max_connect_errors': unsigned value 0 adjusted to 1
[ERROR] mysql/bin/mysqld: Error while setting value '18446744073709547520' to 'max_connect_errors'
[ERROR] Aborting

Suggested fix:
create and use unsigned long long returning function that is similar function 'eval_num_suffix' in mysys_ssl/my_getopt.cc
[27 Feb 2014 12:22] Laurynas Biveinis
Bug 68291?
[4 Mar 2014 9:43] Yasushi Miyazaki
Yes. I got the same result the bug 68291.
But I think bug 68291 is reported about 'unsigned long long' value on 32bit/64bit machine.
This bug 71852 is additionally happen in 'unsigned long' maximum value(ULONG_MAX) on Linux 64bit machine.
[5 Mar 2014 11:56] MySQL Verification Team
Hello!,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[18 Apr 2015 22:06] Laurynas Biveinis
Was this fixed by the following?

$ git show -s cac6fc8
commit cac6fc837a5f72203058e4acc6b8b4dba8a98294
Author: V S Murthy Sidagam <venkata.sidagam@oracle.com>
Date:   Wed Jan 7 15:10:05 2015 +0530

    Description: According to the manual, the maximum value for group_concat_max_len in 64bit
    mysqld is 18446744073709547520. This works fine when set dynamically in the
    mysql command prompt. However, if the value is set in my.cnf, mysqld will refuse to honor
    and will not start up.
    
    Analysis: When the option group_concat_max_len is parsed and tries to store the given value,
    it will call eval_num_suffix() to convert the given value string to numeric value with the
    string function strtoll(). Since the give value won't fit in the longlong type an error is
    thrown and server refuse to start.
    
    Fix: As a fix we need to use strtoull() instead of strtoll(). which can accumulate the given
    unsigned longlong value.
    
    Note: This bug is already fixed in mysql-5.7 under bug #16491145. Hence used the same code changes to fix this bug as well.