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

Rust panic when executing insert with arguments #298

Open
Lan2u opened this issue Feb 15, 2025 · 1 comment
Open

Rust panic when executing insert with arguments #298

Lan2u opened this issue Feb 15, 2025 · 1 comment

Comments

@Lan2u
Copy link

Lan2u commented Feb 15, 2025

I am experiencing a rust panic within the libsql/client source code - here is the source code of our usage https://github.com/Makespace/members-app/blob/5a8b052587a07cdee2216b48aa8d470a4341f460/src/init-dependencies/google/get-cached-sheet-data.ts#L96

await dbClient.execute({
        sql: `
              INSERT INTO cached_sheet_data (cached_at, sheet_id, cached_data)
              VALUES ($cachedAt, $sheetId, $cachedData)
              ON CONFLICT (sheet_id) DO UPDATE SET
                cached_at = excluded.cached_at,
                cached_data = excluded.cached_data;
            `,
        args: {
          cachedAt: cacheTimestamp,
          sheetId,
          cachedData,
        },
      });

And the error

2025-02-15T17:26:55.474 app[148e200df35498] lhr [info] thread '<unnamed>' panicked at src/statement.rs:360:62:

2025-02-15T17:26:55.474 app[148e200df35498] lhr [info] called `Option::unwrap()` on a `None` value

2025-02-15T17:26:55.474 app[148e200df35498] lhr [info] stack backtrace:

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 0: 0x7f200b86a8be - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 1: 0x7f200b52768c - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 2: 0x7f200b83f6f2 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 3: 0x7f200b86c16f - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 4: 0x7f200b86b978 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 5: 0x7f200b86cabc - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 6: 0x7f200b86c488 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 7: 0x7f200b86c416 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 8: 0x7f200b86c403 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 9: 0x7f200b496904 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 10: 0x7f200b4969f2 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 11: 0x7f200b496d45 - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 12: 0x7f200b51bb1e - <unknown>

2025-02-15T17:26:55.475 app[148e200df35498] lhr [info] 13: 0x7f200b4de14d - <unknown>

2025-02-15T17:26:55.491 app[148e200df35498] lhr [info] 14: 0xc51049 - _ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE

2025-02-15T17:26:55.491 app[148e200df35498] lhr [info] 15: 0xf57eaf - _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE

2025-02-15T17:26:55.491 app[148e200df35498] lhr [info] 16: 0xf5871d - _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEENS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EEPmi

2025-02-15T17:26:55.491 app[148e200df35498] lhr [info] 17: 0xf58be5 - _ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE

2025-02-15T17:26:55.495 app[148e200df35498] lhr [info] 18: 0x1963df6 - Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit

This happens everytime and I can reliably recreate it. For context I'm trying to insert a large string into the database which represents a blob of data stored as json.

Seems to match tursodatabase/libsql#1811 (comment) (I've posted on both as this repo seemed like a more appropriate place)

Versions

"@libsql/client": "^0.14.0",
"typescript": "^5.1.3"

Node 20
@Lan2u
Copy link
Author

Lan2u commented Feb 15, 2025

I was able to work-around the issue by changing the query to be

await dbClient.execute({
        sql: `
              INSERT INTO cached_sheet_data (cached_at, sheet_id, cached_data)
              VALUES (?, ?, ?)
              ON CONFLICT (sheet_id) DO UPDATE SET
                cached_at = excluded.cached_at,
                cached_data = excluded.cached_data;
            `,
        args: [cacheTimestamp, sheetId, cachedData],
      });

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