Bug #2507 stored procedure called through C API causes heavy cpu load
Submitted: 25 Jan 2004 15:36 Modified: 26 Sep 2004 21:25
Reporter: scott jensen Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.0 OS:Linux (Linux Red Hat 8)
Assigned to: Assigned Account CPU Architecture:Any

[25 Jan 2004 15:36] scott jensen
When I run a stored procedure that updates a row in one table in my database through the C API, it runs the update, prints the message to the screen (from my C code after the query executes and closes the handle), but mySQL then starts using all of the CPU (by using top, mySQL is consuming 98% of the cpu).

When I run the same stored procedure in mySQL (at the mySQL> prompt) it runs correctly and does not show up on the top list (the table I'm updating only has 5 records).

In executing through the C API, I get a handle using mysql_real_connect.

I then call mysql_prepare with the handle, a string with the stored procedure call, and the length of the string.  the return value is stored in a MYSQL_STMT.

I then call mysql_execute with that stmt.  It returns 0 and I then close the handle, print a message that the procedure is done, and exit the routine.

At this point, mySQL is now consuming 98% of the cpu as shown by top.  I end up rebooting the machine.  When I go back in, the update was actually done.

How to repeat:
Run the stored procedure again through the C API and monitor with top.
[25 Jan 2004 23:12] scott jensen
After working on this further, it seems to be the mysql_prepare that causes the problem.  If instead I use mysql_query it works fine.
[26 Aug 2004 21:25] MySQL Verification Team
Two questions:

1- Are you tested against the latest release ?

2- If the above is yes and the issue continues could you please provide your
    C API test case code. It can be attached using the Files tab as public or

Thanks in advance.
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".