Percona-Lab/sysbench-tpcc

bad argument #3 to 'format'

Opened this issue · 1 comments

The full error is

FATAL: `thread_run' function failed: ...cal/Cellar/sysbench/1.0.17_1/share/sysbench/tpcc_run.lua:648: bad argument #3 to 'format' (number expected, got nil)

It seems to happen randomly, some long runs complete and some shorter ones encounter this right at the start. The error points to this command:

UPDATE customer%d
                        SET c_balance = c_balance + %f,
                            c_delivery_cnt = c_delivery_cnt + 1
                      WHERE c_id = %d
                        AND c_d_id = %d
                        AND c_w_id = %d]])
                      :format(table_num, sm_ol_amount, o_c_id, d_id, w_id)

When I run the query that generates o_c_id, I get a value though. It's quite puzzling; I thought it had to do with data corruption from exiting the command unexpectedly but it happens even after a fresh prepare and not tampering with anything. Hopefully you can shed some light on it. Thanks.

I am having the same issue, hard to find any fault. It happens only with concurrency (more than one thread). At 8 threads I am seeing the issue about once per 1000s. I fixed it adding:

if o_c_id ~= nil then

After the select returning o_c_id to exclude the remaining of new_order if a nil is retuned.