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

Scary "Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust" on startup #26864

Closed
ara4n opened this issue Jan 12, 2024 · 2 comments
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Labs

Comments

@ara4n
Copy link
Member

ara4n commented Jan 12, 2024

Steps to reproduce

  1. Upgraded EDR to 2024011101 (rust sdk 0.7.0 (746c5db)
  2. Migration of IndexeddbCryptoStore to v8 kicked off
  3. Immediately spat out some scary uncaught errors:
09:26:57.057 rageshake.ts:77 INFO matrix_sdk_indexeddb::crypto_store::migrations: IndexeddbCryptoStore upgrade data -> v8 starting
    at /home/runner/.cargo/git/checkouts/matrix-rust-sdk-1f4927f82a3d27bb/3e17fc2/crates/matrix-sdk-indexeddb/src/crypto_store/migrations.rs:316
09:27:01.036 rageshake.ts:77 INFO matrix_sdk_indexeddb::crypto_store::migrations: Fixing inbound group session data keys
    row_count=424319
    at /home/runner/.cargo/git/checkouts/matrix-rust-sdk-1f4927f82a3d27bb/3e17fc2/crates/matrix-sdk-indexeddb/src/crypto_store/migrations.rs:327
09:27:01.675 matrix_sdk_crypto_wasm.js:9107 Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
    at module.exports.__wbindgen_throw (matrix_sdk_crypto_wasm.js:9107:1)
    at wasm_bindgen::throw_str::hdbe5c00d01779cd7 (015bc85e:0x3ddebc)
    at wasm_bindgen::__rt::borrow_fail::h04d5bedb4db8fb5d (015bc85e:0x3dded9)
    at byn$mgfn-shared$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x3ef5c8)
    at wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x38153f)
    at <matrix_sdk_crypto_wasm::identifiers::UserId as wasm_bindgen::convert::traits::FromWasmAbi>::from_abi::h4888cd6fc5b4c5d8 (015bc85e:0x35d42b)
    at __wbg_userid_free (015bc85e:0x37dc9a)
    at matrix_sdk_crypto_wasm.js:1877:1
    at FinalizationRegistry.cleanupSome (<anonymous>)
09:27:01.676 matrix_sdk_crypto_wasm.js:9107 Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
    at module.exports.__wbindgen_throw (matrix_sdk_crypto_wasm.js:9107:1)
    at wasm_bindgen::throw_str::hdbe5c00d01779cd7 (015bc85e:0x3ddebc)
    at wasm_bindgen::__rt::borrow_fail::h04d5bedb4db8fb5d (015bc85e:0x3dded9)
    at byn$mgfn-shared$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x3ef5c8)
    at wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x38153f)
    at <matrix_sdk_crypto_wasm::identifiers::UserId as wasm_bindgen::convert::traits::FromWasmAbi>::from_abi::h4888cd6fc5b4c5d8 (015bc85e:0x35d42b)
    at __wbg_userid_free (015bc85e:0x37dc9a)
    at matrix_sdk_crypto_wasm.js:7298:1
    at FinalizationRegistry.cleanupSome (<anonymous>)

However, it then completed 5 minutes later:

09:32:25.095 rageshake.ts:77 INFO matrix_sdk_indexeddb::crypto_store::migrations: IndexeddbCryptoStore upgrade data -> v8 finished
    at /home/runner/.cargo/git/checkouts/matrix-rust-sdk-1f4927f82a3d27bb/3e17fc2/crates/matrix-sdk-indexeddb/src/crypto_store/migrations.rs:392
  1. The app then took minutes to send messages until I disabled backups (EDR takes minutes to send messages after importing offline key backup. #26783) - but then, more unusually, failed to decrypt messages too for about 5 minutes. It eventually unwedged though, and superficially seems to be working okay?

Outcome

What did you expect?

No scary uncaught errors during migrations which make it sound like rust has broken mid-migration.

Separately, If the app is going to spend 5 minutes doing a critical migration, it HAS to warn the user that it's upgrading itself, and for the user to be patient otherwise they'll just get bored and restart the app. Even I didn't realise the migration was still going (given the scary uncaught errors!) - have filed this at #26864

What happened instead?

I thought the migration had failed. Perhaps it did? I don't know.

Operating system

No response

Application version

2024011101

How did you install the app?

No response

Homeserver

No response

Will you send logs?

Yes

@ara4n ara4n added the T-Defect label Jan 12, 2024
@ara4n ara4n changed the title Failed(?) migration to indexeddb v8 Scary Uncaught Errors on EDR after upgrading to 2024011101 Jan 12, 2024
@ara4n
Copy link
Member Author

ara4n commented Jan 12, 2024

Looks like this may be unrelated to the migration, given I'm now getting the same two uncaught throws launching the app post-migration, and superficially the migration looks like it worked (the indexeddb says it's on version 8):

rageshake.ts:77 DEPRECATED CONFIG OPTION: In the future, default_server_name will not be accepted. Please use default_server_config instead.
consoleObj.<computed> @ rageshake.ts:77
10:05:06.388 rageshake.ts:77 getSessionLock[2751c9ba-c539-4355-a3d5-4ac71dc602a3] Last ping (from 3325501e-8c99-4ad8-b3b9-439b9928b2b2) was 66362ms ago: proceeding with startup
10:05:19.659 matrix_sdk_crypto_wasm.js:9107 Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
    at module.exports.__wbindgen_throw (matrix_sdk_crypto_wasm.js:9107:1)
    at wasm_bindgen::throw_str::hdbe5c00d01779cd7 (015bc85e:0x3ddebc)
    at wasm_bindgen::__rt::borrow_fail::h04d5bedb4db8fb5d (015bc85e:0x3dded9)
    at byn$mgfn-shared$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x3ef5c8)
    at wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x38153f)
    at <matrix_sdk_crypto_wasm::identifiers::UserId as wasm_bindgen::convert::traits::FromWasmAbi>::from_abi::h4888cd6fc5b4c5d8 (015bc85e:0x35d42b)
    at __wbg_userid_free (015bc85e:0x37dc9a)
    at matrix_sdk_crypto_wasm.js:7298:1
    at FinalizationRegistry.cleanupSome (<anonymous>)
module.exports.__wbindgen_throw @ matrix_sdk_crypto_wasm.js:9107
$wasm_bindgen::throw_str::hdbe5c00d01779cd7 @ 015bc85e:0x3ddebc
$wasm_bindgen::__rt::borrow_fail::h04d5bedb4db8fb5d @ 015bc85e:0x3dded9
$byn$mgfn-shared$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab @ 015bc85e:0x3ef5c8
$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab @ 015bc85e:0x38153f
$<matrix_sdk_crypto_wasm::identifiers::UserId as wasm_bindgen::convert::traits::FromWasmAbi>::from_abi::h4888cd6fc5b4c5d8 @ 015bc85e:0x35d42b
$__wbg_userid_free @ 015bc85e:0x37dc9a
(anonymous) @ matrix_sdk_crypto_wasm.js:7298
Show 2 more frames
Show less
10:05:19.660 matrix_sdk_crypto_wasm.js:9107 Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
    at module.exports.__wbindgen_throw (matrix_sdk_crypto_wasm.js:9107:1)
    at wasm_bindgen::throw_str::hdbe5c00d01779cd7 (015bc85e:0x3ddebc)
    at wasm_bindgen::__rt::borrow_fail::h04d5bedb4db8fb5d (015bc85e:0x3dded9)
    at byn$mgfn-shared$wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x3ef5c8)
    at wasm_bindgen::__rt::WasmRefCell<T>::borrow_mut::h01c348272f2db5ab (015bc85e:0x38153f)
    at <matrix_sdk_crypto_wasm::identifiers::UserId as wasm_bindgen::convert::traits::FromWasmAbi>::from_abi::h4888cd6fc5b4c5d8 (015bc85e:0x35d42b)
    at __wbg_userid_free (015bc85e:0x37dc9a)
    at matrix_sdk_crypto_wasm.js:1877:1
    at FinalizationRegistry.cleanupSome (<anonymous>)

@dbkr dbkr added S-Minor Impairs non-critical functionality or suitable workarounds exist O-Occasional Affects or can be seen by some users regularly or most users rarely A-Element-R Issues affecting the port of Element's crypto layer to Rust labels Jan 12, 2024
@richvdh richvdh changed the title Scary Uncaught Errors on EDR after upgrading to 2024011101 Scary "Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust" on startup Jan 12, 2024
@BillCarsonFr
Copy link
Member

Cannot reproduce, and not seen since the recent changes on database and migration.
Closing for now, will re-open if new issue discovered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Labs
Projects
None yet
Development

No branches or pull requests

3 participants