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

Element-R: panic and outgoing messages stopped after time went backwards #26416

Closed
richvdh opened this issue Oct 23, 2023 · 6 comments
Closed
Assignees
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust T-Defect Z-Element-R-Blocker A blocker for enabling Element R by default Z-Labs

Comments

@richvdh
Copy link
Member

richvdh commented Oct 23, 2023

This didn't seem to have any particular effect, but is troubling nonetheless:

panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/instant-0.1.12/src/wasm.rs:24:9:
`earlier` cannot be later than `self`.

Stack:

Error
    at push.1407.module.exports.__wbg_new_abda76e883ba8a5f (vector://vector/webapp/bundles/52ca33933beb098de228/37.js:7089:17)
    at wasm://wasm/011935b2:wasm-function[2735]:0x2a1cdc
    at wasm://wasm/011935b2:wasm-function[17665]:0x3fd706
    at wasm://wasm/011935b2:wasm-function[4233]:0x2ff367
    at wasm://wasm/011935b2:wasm-function[13291]:0x3e348b
    at wasm://wasm/011935b2:wasm-function[13290]:0x3e345c
    at wasm://wasm/011935b2:wasm-function[5517]:0x3388c5
    at wasm://wasm/011935b2:wasm-function[2265]:0x27a23a
    at wasm://wasm/011935b2:wasm-function[705]:0x1929f6
    at wasm://wasm/011935b2:wasm-function[3295]:0x2c941e
@richvdh richvdh added T-Defect A-Element-R Issues affecting the port of Element's crypto layer to Rust labels Oct 23, 2023
@richvdh
Copy link
Member Author

richvdh commented Oct 24, 2023

In #26417, this caused outgoing requests to stop happening.

@richvdh
Copy link
Member Author

richvdh commented Oct 24, 2023

Looking at a rageshake that includes this panic, it looks like time went backwards:

2023-10-23T09:02:30.278Z D FetchHttpApi: --> GET https://matrix.sw1v.org/_matrix/client/v3/sync?filter=xxx&timeout=xxx&since=xxx
2023-10-23T09:02:28.655Z D FetchHttpApi: <-- GET https://matrix.sw1v.org/_matrix/client/v3/sync?filter=xxx&timeout=xxx&since=xxx [-1623ms 200]
2023-10-23T09:02:28.698Z E panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/instant-0.1.12/src/wasm.rs:24:9:
`earlier` cannot be later than `self`.

(It looks like this happened when systemd synced my clock:

Oct 23 10:02:28 xps9320 systemd-timesyncd[1431]: Initial synchronization to time server 91.189.91.157:123 (ntp.ubuntu.com).

)

@richvdh richvdh changed the title Element-R: panic Element-R: panic and outgoing messages stopped after time went backwards Oct 24, 2023
@BillCarsonFr BillCarsonFr added the Z-Element-R-Blocker A blocker for enabling Element R by default label Nov 8, 2023
@richvdh richvdh self-assigned this Dec 13, 2023
@richvdh
Copy link
Member Author

richvdh commented Dec 13, 2023

This seems to be because the polyfill we use for std::time::Instant (https://github.com/sebcrozet/instant) uses Date.now() rather than a proper monotonic time like std::time::Instant says we should.

I have filed an issue (sebcrozet/instant#53)

richvdh added a commit to matrix-org/matrix-rust-sdk that referenced this issue Dec 13, 2023
With the `inaccurate` feature, this polyfill uses `Date.now()` to emulate
`Instant`, which is not monotonic, causing problems like
element-hq/element-web#26416.
@richvdh
Copy link
Member Author

richvdh commented Dec 13, 2023

Hopefully this will be fixed by matrix-org/matrix-rust-sdk#2935.

@richvdh
Copy link
Member Author

richvdh commented Dec 14, 2023

XKCD particularly on-point today: https://xkcd.com/2867/

@richvdh
Copy link
Member Author

richvdh commented Dec 15, 2023

matrix-org/matrix-js-sdk#3961 has upgraded the rust sdk, so this should now be fixed.

@richvdh richvdh closed this as completed Dec 15, 2023
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 T-Defect Z-Element-R-Blocker A blocker for enabling Element R by default Z-Labs
Projects
None yet
Development

No branches or pull requests

2 participants