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 when copy pasting unicode symbols into the DuckDB WASM Shell #1467

Open
Mytherin opened this issue Nov 1, 2023 · 2 comments
Open

Error when copy pasting unicode symbols into the DuckDB WASM Shell #1467

Mytherin opened this issue Nov 1, 2023 · 2 comments

Comments

@Mytherin
Copy link
Contributor

Mytherin commented Nov 1, 2023

What happens?

Copy pasting queries containing unicode symbols seems to crash the shell

To Reproduce

Copy paste the following query into the shell:

select substring('🦆🦆🦆' from 3) AS result;

The console shows this backtrace indicating it's some problem in the Rust code of the shell.

125.ab3eb309c74a6b483ba2.js:1 panicked at 'Attempt to index past end of Rope: char index 50, Rope char length 41', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.2.0/src/rope.rs:825:9

Stack:

Error
    at r.wbg.__wbg_new_59cb74e423758ede (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:39587)
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1656]:0x1b94ca
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1020]:0x19cce1
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1338]:0x1b55f4
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[166]:0xf4aae
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[545]:0x16fde6
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[190]:0x1027e5
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[357]:0x14be1e
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1039]:0x19db77
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[852]:0x190624


r.wbg.__wbg_error_4bb6c2a97407129a @ 125.ab3eb309c74a6b483ba2.js:1
$func1656 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b9591
$func1020 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19cce1
$func1338 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
$func166 @ shell_bg.24b3ad8dafba895da74f.wasm:0xf4aae
$func545 @ shell_bg.24b3ad8dafba895da74f.wasm:0x16fde6
$func190 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1027e5
$func357 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14be1e
$func1039 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19db77
$func852 @ shell_bg.24b3ad8dafba895da74f.wasm:0x190624
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_c2361a9d5c9a4fcb @ 125.ab3eb309c74a6b483ba2.js:1
$func877 @ shell_bg.24b3ad8dafba895da74f.wasm:0x193044
$func1016 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19c8cd
$func873 @ shell_bg.24b3ad8dafba895da74f.wasm:0x192b03
$func1282 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b3736
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_6c9a4bf55755f9b8 @ 125.ab3eb309c74a6b483ba2.js:1
$func501 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1674e8
$func357 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14bb71
$func1039 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19db77
$func852 @ shell_bg.24b3ad8dafba895da74f.wasm:0x190624
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_c2361a9d5c9a4fcb @ 125.ab3eb309c74a6b483ba2.js:1
$func877 @ shell_bg.24b3ad8dafba895da74f.wasm:0x193044
$func923 @ shell_bg.24b3ad8dafba895da74f.wasm:0x196694
$func353 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14ad23
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h50067c4801d94c98 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
ct @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
_keyDown @ 240.4eba470b56e46fb0a63b.js:2
(anonymous) @ 240.4eba470b56e46fb0a63b.js:2
shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07 Uncaught (in promise) RuntimeError: unreachable
    at shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
    at shell_bg.24b3ad8dafba895da74f.wasm:0xf4aae
    at shell_bg.24b3ad8dafba895da74f.wasm:0x16fde6
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1027e5
    at shell_bg.24b3ad8dafba895da74f.wasm:0x14be1e
    at shell_bg.24b3ad8dafba895da74f.wasm:0x19db77
    at shell_bg.24b3ad8dafba895da74f.wasm:0x190624
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
    at ut (125.ab3eb309c74a6b483ba2.js:1:30870)
$func1020 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07
$func1338 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
$func166 @ shell_bg.24b3ad8dafba895da74f.wasm:0xf4aae
$func545 @ shell_bg.24b3ad8dafba895da74f.wasm:0x16fde6
$func190 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1027e5
$func357 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14be1e
$func1039 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19db77
$func852 @ shell_bg.24b3ad8dafba895da74f.wasm:0x190624
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_c2361a9d5c9a4fcb @ 125.ab3eb309c74a6b483ba2.js:1
$func877 @ shell_bg.24b3ad8dafba895da74f.wasm:0x193044
$func1016 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19c8cd
$func873 @ shell_bg.24b3ad8dafba895da74f.wasm:0x192b03
$func1282 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b3736
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_6c9a4bf55755f9b8 @ 125.ab3eb309c74a6b483ba2.js:1
$func501 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1674e8
$func357 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14bb71
$func1039 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19db77
$func852 @ shell_bg.24b3ad8dafba895da74f.wasm:0x190624
$wasm_bindgen__convert__closures__invoke1_mut__hd4fb6485278754f8 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b645c
ut @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
Promise.then (async)
r.wbg.__wbg_then_c2361a9d5c9a4fcb @ 125.ab3eb309c74a6b483ba2.js:1
$func877 @ shell_bg.24b3ad8dafba895da74f.wasm:0x193044
$func923 @ shell_bg.24b3ad8dafba895da74f.wasm:0x196694
$func353 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14ad23
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h50067c4801d94c98 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
ct @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
_keyDown @ 240.4eba470b56e46fb0a63b.js:2
(anonymous) @ 240.4eba470b56e46fb0a63b.js:2
125.ab3eb309c74a6b483ba2.js:1 panicked at 'already mutably borrowed: BorrowError', packages/duckdb-wasm-shell/crate/src/shell.rs:1064:29

Stack:

Error
    at r.wbg.__wbg_new_59cb74e423758ede (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:39587)
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1656]:0x1b94ca
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1020]:0x19cce1
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1338]:0x1b55f4
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1147]:0x1ad36d
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[353]:0x14ac87
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1407]:0x1b643c
    at ct (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:30712)
    at O.s [as _customKeyEventHandler] (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:30574)
    at O._keyUp (https://shell.duckdb.org/static/js/240.4eba470b56e46fb0a63b.js:2:406747)


r.wbg.__wbg_error_4bb6c2a97407129a @ 125.ab3eb309c74a6b483ba2.js:1
$func1656 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b9591
$func1020 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19cce1
$func1338 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
$func1147 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1ad36d
$func353 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14ac87
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h50067c4801d94c98 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
ct @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
_keyUp @ 240.4eba470b56e46fb0a63b.js:2
(anonymous) @ 240.4eba470b56e46fb0a63b.js:2
shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07 Uncaught RuntimeError: unreachable
    at shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1ad36d
    at shell_bg.24b3ad8dafba895da74f.wasm:0x14ac87
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
    at ct (125.ab3eb309c74a6b483ba2.js:1:30712)
    at O.s [as _customKeyEventHandler] (125.ab3eb309c74a6b483ba2.js:1:30574)
    at O._keyUp (240.4eba470b56e46fb0a63b.js:2:406747)
    at HTMLTextAreaElement.<anonymous> (240.4eba470b56e46fb0a63b.js:2:392618)
$func1020 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07
$func1338 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
$func1147 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1ad36d
$func353 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14ac87
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h50067c4801d94c98 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
ct @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
_keyUp @ 240.4eba470b56e46fb0a63b.js:2
(anonymous) @ 240.4eba470b56e46fb0a63b.js:2
125.ab3eb309c74a6b483ba2.js:1 panicked at 'already mutably borrowed: BorrowError', packages/duckdb-wasm-shell/crate/src/shell.rs:1064:29

Stack:

Error
    at r.wbg.__wbg_new_59cb74e423758ede (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:39587)
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1656]:0x1b94ca
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1020]:0x19cce1
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1338]:0x1b55f4
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1147]:0x1ad36d
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[353]:0x14ac87
    at https://shell.duckdb.org/static/wasm/shell_bg.24b3ad8dafba895da74f.wasm:wasm-function[1407]:0x1b643c
    at ct (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:30712)
    at O.s [as _customKeyEventHandler] (https://shell.duckdb.org/static/js/125.ab3eb309c74a6b483ba2.js:1:30574)
    at O._keyDown (https://shell.duckdb.org/static/js/240.4eba470b56e46fb0a63b.js:2:405242)


r.wbg.__wbg_error_4bb6c2a97407129a @ 125.ab3eb309c74a6b483ba2.js:1
$func1656 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b9591
$func1020 @ shell_bg.24b3ad8dafba895da74f.wasm:0x19cce1
$func1338 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
$func1147 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1ad36d
$func353 @ shell_bg.24b3ad8dafba895da74f.wasm:0x14ac87
$_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h50067c4801d94c98 @ shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
ct @ 125.ab3eb309c74a6b483ba2.js:1
s @ 125.ab3eb309c74a6b483ba2.js:1
_keyDown @ 240.4eba470b56e46fb0a63b.js:2
(anonymous) @ 240.4eba470b56e46fb0a63b.js:2
shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07 Uncaught RuntimeError: unreachable
    at shell_bg.24b3ad8dafba895da74f.wasm:0x19cd07
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b55f4
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1ad36d
    at shell_bg.24b3ad8dafba895da74f.wasm:0x14ac87
    at shell_bg.24b3ad8dafba895da74f.wasm:0x1b643c
    at ct (125.ab3eb309c74a6b483ba2.js:1:30712)
    at O.s [as _customKeyEventHandler] (125.ab3eb309c74a6b483ba2.js:1:30574)
    at O._keyDown (240.4eba470b56e46fb0a63b.js:2:405242)
    at HTMLTextAreaElement.<anonymous> (240.4eba470b56e46fb0a63b.js:2:392712)

Browser/Environment:

Chrome

Device:

MacBook

DuckDB-Wasm Version:

Latest

DuckDB-Wasm Deployment:

shell.duckdb.org

Full Name:

Mark Raasveldt

Affiliation:

DuckDB Labs

@carlopi
Copy link
Collaborator

carlopi commented Nov 1, 2023

I had to double check (#1468), but this works properly when not using the shell package (within node or Web embedding of duckdb-wasm).

There are also other cases where shell adds a layer of complexity and some problem on its own.

One step forward would be having a simper non-shell deployment, that would double both as simple deployment of duckdb-wasm (where you use it as a library, and embedders are responsible for UI) and as a tool to simplify checking sources of problems, since it would allow a workflow like:

  1. check works in duckdb
  2. check works in duckdb-wasm simple deployment
  3. check whether works in duckdb-wasm-shell

Where it's easier to find what component is responsible.

@szarnyasg
Copy link
Contributor

Slapping "High Priority" on this to test the bot

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

3 participants