Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script is failing on MySQL 5.6.10(AWS Aurora) #435

Open
kirtangajjar opened this issue Apr 17, 2019 · 7 comments
Open

Script is failing on MySQL 5.6.10(AWS Aurora) #435

kirtangajjar opened this issue Apr 17, 2019 · 7 comments

Comments

@kirtangajjar
Copy link

kirtangajjar commented Apr 17, 2019

Getting following error when running it on Mysql 5.6 (AWS Aurora) -

 >>  MySQLTuner 1.7.15 - Major Hayden <major@mhtx.net>

Use of uninitialized value in division (/) at mysqltuner.pl line 2657 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    and the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.

Illegal division by zero at mysqltuner.pl line 2657 (#2)
    (F) You tried to divide a number by 0.  Either something was wrong in
    your logic, or you need to put a conditional in to guard against
    meaningless input.

Uncaught exception from user code:
	Illegal division by zero at mysqltuner.pl line 2657.
	main::calculations() called at mysqltuner.pl line 6307
@jmrenouard
Copy link
Collaborator

Hi @kirtangajjar

I hav no AWS env. to perform tests.

Help welcomes !

@kirtangajjar
Copy link
Author

kirtangajjar commented Jun 13, 2019

@jmrenouard I debugged the issue and found that the error is occuring here - https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.pl#L2657

At that line, $myvar{'innodb_buffer_pool_size'} is not initialized. That is because running SHOW VARIABLES in AWS RDS does not return innodb_buffer_pool_size(maybe because it's dynamic). To fix this problem, we just have to ensure that $myvar{'innodb_buffer_pool_size'} and $mycalc{'innodb_log_size_pct'} are initialized

Screenshot 2019-06-13 at 1 03 38 PM

I did make a hackish attempt to solve this problem with below code and it seems to work, but I'm not sure if it might have other unintended consequences.

    # InnoDB
    if ( $myvar{'have_innodb'} eq "YES" && defined $myvar{'innodb_buffer_pool_size'} ) {
        $mycalc{'innodb_log_size_pct'} =
          ( $myvar{'innodb_log_file_size'} *
              $myvar{'innodb_log_files_in_group'} * 100 /
              $myvar{'innodb_buffer_pool_size'} );
    }

    if( !defined $myvar{'innodb_buffer_pool_size'}) {
      $mycalc{'innodb_log_size_pct'} = 0;
      $myvar{'innodb_buffer_pool_size'} = 0;
    }

If this looks fine to you, I can raise a PR for it.

@jmrenouard
Copy link
Collaborator

Hi, fixed in MySQLTuner 1.7.18

@dhsathiya
Copy link

dhsathiya commented Nov 6, 2019

@jmrenouard Seems lilke same error with some other variable.
Getting following error when running it on Mysql 5.6 (AWS Aurora) -

 >>  MySQLTuner 1.7.19 - Major Hayden <major@mhtx.net>
Use of uninitialized value in division (/) at mysqltuner.pl line 2706 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
    
    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    and the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.
    
Illegal division by zero at mysqltuner.pl line 2706 (#2)
    (F) You tried to divide a number by 0.  Either something was wrong in
    your logic, or you need to put a conditional in to guard against
    meaningless input.
    
Uncaught exception from user code:
        Illegal division by zero at mysqltuner.pl line 2706.
        main::calculations() called at mysqltuner.pl line 6376

@jmrenouard jmrenouard reopened this Nov 6, 2019
@jmrenouard
Copy link
Collaborator

If someone want to handle that.

@RafalLukawiecki
Copy link

Just tried on Aurora and the error is still present, though lists line 2707. I am new to this script. Also getting "274 CVE(s) found"—I suspect it does not get the version string correctly from Aurora.

@OliverBailey
Copy link

	line 2 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
    
    To help you figure out what was undefined, perl will try to tell you
    the name of the variable (if any) that was undefined.  In some cases
    it cannot do this, so it also tells you what operation you used the
    undefined value in.  Note, however, that perl optimizes your program
    and the operation displayed in the warning may not necessarily appear
    literally in your program.  For example, "that $foo" is usually
    optimized into "that " . $foo, and the warning will refer to the
    concatenation (.) operator, even though there is no . in
    your program.
    
Illegal division by zero at mysqltuner.pl line 2707, <STDIN> line 2 (#2)
    (F) You tried to divide a number by 0.  Either something was wrong in
    your logic, or you need to put a conditional in to guard against
    meaningless input.
    
Uncaught exception from user code:
	Illegal division by zero at mysqltuner.pl line 2707, <STDIN> line 2.
	main::calculations() called at mysqltuner.pl line 6377

Aye, same thing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants