Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#6683 closed defect (invalid)

mysql error with mythtv trunk (incorrect arguments to mysql_stmt_execute) Qt 4.5

Reported by: nneul@… Owned by: Isaac Richards
Priority: major Milestone: unknown
Component: MythTV - General Version: head
Severity: high Keywords:
Cc: Ticket locked: no


Updated my mandriva-current box today and it broke mythbackend (and probably frontend as well, but can't really tell that).

It's getting the following error when starting mythbackend. Database is fine, selects against database are working properly (verified with a mysqld query log). Tested with mysql server 5.0.83, and the 5.1.35 mandriva package. qt4-database-plugin-mysql is version 4.5.2, but same symptom with 4.5.0 - couldn't easily downgrade further than that without invasive rpm hell.

2009-06-30 21:11:22.897 Connected to database 'myth' at host: localhost 2009-06-30 21:11:23.987 DataDirectProcessor::FixProgramIDs() -- begin 2009-06-30 21:11:27.603 New DB DataDirect? connection 2009-06-30 21:11:27.603 Connected to database 'myth' at host: localhost 2009-06-30 21:11:29.547 DB Error (Clear setting): Query was: DELETE FROM settings WHERE value = ? AND hostname = ? ; Bindings were:, :KEY=MythFillFixProgramIDsHasRunOnce Driver error was [2/1210]: QMYSQL3: Unable to execute statement Database error was: Incorrect arguments to mysql_stmt_execute

2009-06-30 21:11:29.547 DB Error (SaveSettingOnHost?('MythFillFixProgramIDsHasRunOnce') - query failure: ): Query was: INSERT INTO settings (value,data,hostname) VALUES ( ?, ?, ? ); Bindings were: :DATA=1,, :VALUE=MythFillFixProgramIDsHasRunOnce Driver error was [2/1210]: QMYSQL3: Unable to execute statement Database error was: Incorrect arguments to mysql_stmt_execute

2009-06-30 21:11:29.548 DataDirectProcessor::FixProgramIDs() -- end 2009-06-30 21:11:29.549 Current Schema Version: 1235 No setting found for this machine's BackendServerIP. Please run setup on this machine and modify the first page of the general settings.

Attempting to run mythtv-setup gets hundreds of similar errors.

The failing queries ARE making it to mysqld (verified with an strace), but the server is returning the error about incorrect arguments.

9381 read(24, "\26INSERT INTO settings (value,data,hostname) VALUES ( ?, ?, ? );", 63) = 63 9381 gettimeofday({1246414523, 315521}, NULL) = 0 9381 sched_setparam(-1222444028, 0) = -1 EINVAL (Invalid argument) 9381 write(24, "\f\0\0\1\0\v\0\0\0\0\0\3\0\0\0\0\27\0\0\2\3def\0\0\0\1?\0\f?\0\0\0\0\0\375\200\0\0\0\0\27\0\0\3\3def\0\0\0\1?\0\f?\0\0\0\0\0\375\200\0\0\0\0\27\0\0\4\3def\0\0\0\1?\0\f?\0\0\0\0\0\375\200\0\0\0\0\5\0\0\5\376\0\0\2\0", 106) = 106 9381 sched_setparam(24, { 16777228 }) = -1 EINVAL (Invalid argument) 9381 gettimeofday({1246414523, 315882}, NULL) = 0 9381 read(24, "\5\0\0\0", 4) = 4 9381 read(24, "\32\v\0\0\0", 5) = 5 9381 gettimeofday({1246414523, 316044}, NULL) = 0 9381 write(24, "\7\0\0\1\0\0\0\2\0\0\0", 11) = 11 9381 gettimeofday({1246414523, 316187}, NULL) = 0 9381 read(24, "F\0\0\0", 4) = 4 9381 read(24, "\27\v\0\0\0\0\1\0\0\0\0\1\376\0\37MythFillFixProgramIDsHasRunOnce\0011\", 70) = 70 9381 gettimeofday({1246414523, 316380}, NULL) = 0 9381 write(24, "2\0\0\1\377\272\4#HY000Incorrect arguments to mysql_stmt_execute", 54 <unfinished ...>

This has my main mythtv box dead in the water at this time. Any suggestions?

Change History (6)

comment:1 Changed 13 years ago by nneul@…

downgrading to the exact mysql server version I was running previously had no effect.

comment:2 Changed 13 years ago by sphery <mtdean@…>

This very much looks like a problem with the Qt-MySQL driver build/packaging/dependencies. Myth does not use the MySQL C API at all--instead using the Qt-MySQL drivers--so the problem is occurring at a lower level (i.e. in the Qt-MySQL drivers).

While the Qt4.5 Qt-MySQL drivers--unlike older versions--attempt to always execute statements as prepared statements (and, on failure fall back to non-prepared statements), and since this particular error, "Incorrect arguments to mysql_stmt_execute," generally occurs on execution of prepared statements, it may seem natural to assume it may be a newly-uncovered bug identified by Qt4.5 driver's penchant for executing all statements as prepared statements. However, in this case, the particular statements you've quoted as erroring are ones that we have always executed as prepared statements ( "DELETE FROM settings WHERE value = ? AND hostname = ? ;" and "INSERT INTO settings (value,data,hostname) VALUES ( ?, ?, ? );" ), so the code is known to work. That also means that the failure isn't a false failure due to the lastError() not being reset after the driver's failed attempt to use prepared statements to execute a statement that MySQL doesn't support executing as a prepared statement (because both of these statements are supported as prepared statements).

There are bug reports against MySQL where the given error was caused by improper packaging ( ) or compiling with incorrect optimizations ( and and others ). Please check with other MythTV trunk/Qt4.5 Mandriva users to find out whether they've encountered similar issues and if not, find out what they did differently with package versions/installation, or if so, forward the issue upstream to Mandriva as it's very unlikely to be a MythTV issue. Thanks.

comment:3 Changed 13 years ago by nneul@…

So, based on what you've described, it sounds fairly likely that switching to FC10 (or other distro besides mdv) will also likely be an effective way to correct the problem? (Been on my list to do for this machine for a while.)


comment:4 Changed 13 years ago by stuartm

Resolution: invalid
Status: newclosed

Sticking to the stable repos (not cooker) would be a good start. You should expect lots of things to break with cooker and reverting a single package might not be enough to fix it.

Trunk works fine with the latest packages from the Mandriva 2009.1 stable repos.

comment:5 Changed 13 years ago by stuartm

For those affected by this it turns out to be a broken mysql package as Michael suggested. One of the -O2 optimisations was at fault. I'm making available a fixed 64bit package here:

The package comes with no support or warranty, it may destroy your data or eat your children. It could be a week or two before Mandriva puts out their own fix hence why I'm making mine available. You may need to force installing with --replacepkgs --replacefiles because I've not changed the rpm version, merely rebuilt it.

comment:6 Changed 12 years ago by Davin McCall <davmac@…>

I hit this, and found a MySql? bug. I've filed a bug report:

And if anyone's interested in how I discovered the problem, a blog post about it:

Note: See TracTickets for help on using tickets.