Bug #72082 mysqlslap crashes by Floating point exception

Submitted: 20 Mar 2014 6:21 Modified: 31 Mar 2014 16:17
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.16 OS:Linux (CentOS 6.3)
Assigned to: CPU Architecture:Any
Tags: iterations, mysqlslap

[20 Mar 2014 6:21] Tsubasa Tanaka
Description:
mysqlslap crashes by Floating point exception when it's given zero(or null) to "--iterations".

How to repeat:
$ mysqlslap --auto-generate-sql --number-of-queries=10 --iterations=
Floating point exception (core dumped)

$ mysqlslap --version
mysqlslap  Ver 1.0 Distrib 5.1.71, for redhat-linux-gnu (x86_64)

Program received signal SIGFPE, Arithmetic exception.
0x000000000040cbb9 in generate_stats (mysql=0x7fffffffdef0, current=<value optimized out>, eptr=0x0)
    at /home/ttanaka/mysql-5.6.16/client/mysqlslap.c:2178
warning: Source file is more recent than executable.
2178      con->avg_timing= con->avg_timing/iterations;
Missing separate debuginfos, use: debuginfo-install openssl-1.0.1e-16.el6_5.x86_64
(gdb) bt
#0  0x000000000040cbb9 in generate_stats (mysql=0x7fffffffdef0, current=<value optimized out>, eptr=0x0)
    at /home/ttanaka/mysql-5.6.16/client/mysqlslap.c:2178
#1  concurrency_loop (mysql=0x7fffffffdef0, current=<value optimized out>, eptr=0x0)
    at /home/ttanaka/mysql-5.6.16/client/mysqlslap.c:519
#2  0x000000000040d5a8 in main (argc=0, argv=0x9473a8) at /home/ttanaka/mysql-5.6.16/client/mysqlslap.c:399

Suggested fix:
Set min_value to &iterations.

See attached file.
[20 Mar 2014 6:22] Tsubasa Tanaka
set min_value and max_value to &iterations.

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug72082.patch (application/octet-stream, text), 1.01 KiB.

[20 Mar 2014 6:46] MySQL Verification Team
Hello Tsubasa,

Thank you for the bug report and contribution.
Verified as described.

Thanks,
Umesh
[31 Mar 2014 16:17] Paul DuBois
Noted in 5.7.5 changelog.

mysqlslap accepted an --iterations option value of 0, which resulted
in a divide-by-zero error. The minimum option value now is 1. Thanks
to Tsubasa Tanaka for the patch.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.