#1639 Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute

Reporter Johannes Morgenroth
Owner Nobody
Created
Updated
Stars ★ (1)
Tags
  • Priority-Medium
  • MySQL
  • Status-Accepted
  • Component-Persistence
  • Type-Defect
  1. Johannes Morgenroth on

    What steps will reproduce the problem? 1. Install prosody 0.11.8 with mod_pep via docker DIGEST:sha256:602140d31c591390da7b57900c4bf460a9430a68b496fafff5e37e0666931d69 2. Configure with sql backend with mysql (version >= 8.0.22) 3. Connect a client with PEP support (e.g. Conversations). What is the expected output? No error. What do you see instead? These error messages show up multiple times if a client connects. sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute What version of the product are you using? On what operating system? - prosody 0.11.8 with mod_pep - mysql (version >= 8.0.22) Please provide any additional information below. AFAIK, prepared statements have been changed starting with version 8.0.22 of mysql to avoid programming mistakes. Same issue seems to be discussed here: https://github.com/sidorares/node-mysql2/issues/1239

  2. Zash on

    Hi, thanks for the report. Could you try to reproduce this with debug logging and mod_debug_sql enabled. This would show what the full query was.

    Changes
    • tags Status-NeedInfo Component-Persistence MySQL
  3. Johannes Morgenroth on

    Great resonse time. :-) There seem to be multiple queries affected. All of them related to 'prosodyarchive'. I have cut them out of the debug log... domain.tld:bookmarks debug No existing Private XML bookmarks for foobar@domain.tld, migration already done: <nil> sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_storage:bookmarks' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_bookmarks/mod_bookmarks.lua:103: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/sessionmanager.lua:209: in function 'sm_bind_resource' /usr/lib/prosody/modules/mod_saslauth.lua:313: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:142: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- domain.tld:pep debug get_pep_service("foobar") sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_eu.siacs.conversations.axolotl.bundles:1610564730' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:795: in function 'items' /usr/lib/prosody/util/pubsub.lua:641: in function 'get_items' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:311: in function 'handler' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:291: in function </usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:278> (...tail calls...) /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/modules/mod_iq.lua:38: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:180: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get items: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- domain.tld:pep debug get_pep_service("foobar") sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_urn:xmpp:avatar:metadata' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_vcard_legacy.lua:312: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:176: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- domain.tld:mam debug Archive query, id gdmejm08uf with anyone from the dawn of time until now sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'archive' AND "sort_id" > COALESCE( ( SELECT "sort_id" FROM "prosodyarchive" WHERE "key" = '33f6b268-d415-4659-aa51-c4a586a2ebd1' AND "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'archive' LIMIT 1 ), 0) ORDER BY "sort_id" ASC LIMIT 51; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_mam/mod_mam.lua:133: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:181: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- domain.tld:pep debug get_pep_service("foobar") sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_eu.siacs.conversations.axolotl.devicelist' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_pep.lua:268: in function 'resend_last_item' /usr/lib/prosody/modules/mod_pep.lua:295: in function 'update_subscriptions' /usr/lib/prosody/modules/mod_pep.lua:390: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:180: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_storage:bookmarks' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_pep.lua:268: in function 'resend_last_item' /usr/lib/prosody/modules/mod_pep.lua:295: in function 'update_subscriptions' /usr/lib/prosody/modules/mod_pep.lua:390: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:180: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_urn:xmpp:avatar:metadata' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_pep.lua:268: in function 'resend_last_item' /usr/lib/prosody/modules/mod_pep.lua:295: in function 'update_subscriptions' /usr/lib/prosody/modules/mod_pep.lua:390: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:180: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute -- domain.tld:pep debug get_pep_service("foobar") sql debug SQL transaction begin [function(mod_storage_sql.lua:328)] sql debug [select] SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" WHERE "host" = 'domain.tld' AND "user" = 'foobar' AND "store" = 'pep_urn:xmpp:avatar:metadata' ORDER BY "sort_id" DESC LIMIT 1; sql debug Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute stack traceback: /usr/lib/prosody/util/sql.lua:151: in function </usr/lib/prosody/util/sql.lua:148> (...tail calls...) [C]: in function 'xpcall' /usr/lib/prosody/util/sql.lua:206: in function '_transaction' /usr/lib/prosody/util/sql.lua:221: in function 'transaction' /usr/lib/prosody/modules/mod_storage_sql.lua:328: in function 'find' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:814: in function 'get' /usr/lib/prosody/modules/mod_pubsub/pubsub.lib.lua:861: in function 'head' /usr/lib/prosody/util/pubsub.lua:662: in function 'get_last_item' /usr/lib/prosody/modules/mod_vcard_legacy.lua:312: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/stanza_router.lua:176: in function 'core_post_stanza' /usr/lib/prosody/core/stanza_router.lua:127: in function 'core_process_stanza' /usr/lib/prosody/modules/mod_c2s.lua:276: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> sql debug SQL transaction failure [function(mod_storage_sql.lua:328)]: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute sql debug SQL connection is up, so not retrying sql error Error in SQL transaction: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute domain.tld:pep error Unable to get item: /usr/lib/prosody/util/sql.lua:151: Error executing statement parameters: Incorrect arguments to mysqld_stmt_execute

  4. Zash on

    Found https://bugs.mysql.com/bug.php?id=102642 which makes me think MySQL changed their API in some incompatible way. I think this means it needs to be fixed in LuaDBI. If you are lucky it might simply need a recompile.

  5. Zash on

    Could reproduce with: ``` lua db=assert(require"DBI".Connect("MySQL", "prosody", "prosody", "secret", "127.0.0.1", 3306)) s=assert(db:prepare("SELECT 1 LIMIT ? OFFSET ?")) assert(s:execute(1, 1)) ``` I wonder if it's because numbers in Lua are floats (prior to 5.3), and it's expecting integers there? Filed this issue: https://github.com/mwild1/luadbi/issues/64 I guess we could work around it by inserting that number with printf instead.

    Changes
    • tags Status-Accepted

New comment

Not published. Used for spam prevention and optional update notifications.