Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error("invalid value: integer -51928, expected u64", line: 1, column: 212) with taos version 0.12.3 and TDengine 3.3.2.0 Community #370

Open
Audrique opened this issue Oct 25, 2024 · 0 comments

Comments

@Audrique
Copy link

Audrique commented Oct 25, 2024

Hi, so I am receiving highfrequency financial data through a websocket and have been using TDengine to store it in a database. I use in my Cargo.toml file:

taos = { version = "0.12.3", default-features = false, features = ["ws-native-tls"]}

and I only insert the data into an existing table:

async fn build_taos_ws() -> Result<Taos, Box<dyn std::error::Error>> {
    let dsn = "ws://127.0.0.1:6041";
    let builder = TaosBuilder::from_dsn(dsn)?;
    let taos = builder.build().await?;
    let _ = taos.query("show databases").await?;
    println!("Connected to taos");
    Ok(taos)
}

let taos = build_taos_ws().await.unwrap();

...
if parsed_msg.topic.starts_with("best_price_change") {
let sql = format!("INSERT INTO {} (time, instrument, best_ask_price, best_bid_price, update_number) VALUES (NOW, '{}', {}, {}, {});",
                                                            price_update_table_name,
                                                            trading_pair,
                                                            new_best_ask,
                                                            new_best_bid,
                                                            update_number
);
taos.exec(sql).await?;
} else if parsed_msg.topic.starts_with("trades") {
...

let sql = format!("INSERT INTO {} (time, instrument, direction, price, volume, update_number) VALUES (NOW, '{}', '{}', {}, {}, {});",
                                                            trade_update_table_name,
                                                            trading_pair,
                                                            trade.direction.to_string(),
                                                            trade.price,
                                                            trade.volume,
                                                            update_number,
);
taos.exec(sql).await?;
} 

This worked perfectly fine until today, where after running the code for ~20min I got the following error:

image

This refers to the following code inside the read_queries function (of the asyn.rs file):

let v: WsRecv = serde_json::from_slice(&payload).unwrap();

When I did some further digging I think it refers to trying to asign the ReqId (which is of type u64) inside the WsRecv struct (see taos-ws/src/query/infra.rs), -51928, which explains the error message I got. However the question remains, why did this happen? Why was the payload in a wrong format?

My problem is that for now, I have not been able to reproduce the error. I tried inputting invalid values into my table (for example a negative integer when the column is of type unsigned integer, but this gave different errors, meaning that the input should not be the problem. Furthermore, I ran my code again and now it worked for an hour straight.

Edit:
Today the error happened again (after running my code for ~8 hours straight):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant