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: Close() doesn't reliably cancel listeners, causing panics #150

Open
kegsay opened this issue Oct 16, 2024 · 0 comments
Open

rust: Close() doesn't reliably cancel listeners, causing panics #150

kegsay opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kegsay
Copy link
Member

kegsay commented Oct 16, 2024

Such as:

panic: Log in goroutine after TestMultiprocessInitialE2EESyncDoesntDropDeviceListUpdates has completed: [[@user-15-alice:hs1](https://matrix.to/#/@user-15-alice:hs1)]TimelineDiff change: &{ID:$sqDro8apgvTq4Gi8G-pjchrhLyQLvxC4h7jKNOjpfv8 Text:pre message Sender:[@user-16-bob:hs1](https://matrix.to/#/@user-16-bob:hs1) Targe

..despite the test calling .Close() on the client. It looks like this is a race condition as the logs show:

2024-10-16T12:04:19.458875Z  INFO TestMultiprocessInitialE2EESyncDoesntDropDeviceListUpdates: [@user-15-alice:hs1](rust) Close | rust.go:0
2024-10-16T12:04:19.458912Z DEBUG log: cancel    
2024-10-16T12:04:19.458925Z DEBUG matrix_sdk_ffi::task_handle: Cancelling the task handle | bindings/matrix-sdk-ffi/src/task_handle.rs:24
2024-10-16T12:04:19.458956Z DEBUG matrix_sdk_ffi::task_handle: Cancelling the task handle | bindings/matrix-sdk-ffi/src/task_handle.rs:24
2024-10-16T12:04:19.458655Z DEBUG matrix_sdk::sliding_sync: Done handling response | crates/matrix-sdk/src/sliding_sync/mod.rs:679 | spans: sync_once{pos="29/s159_1_0_1_8_1_76_85_0_1"}

where subsequent lines then clearly show the timeline listener being invoked, which does t.Logf which causes the panic.

Instead, we should latch closed = true when closed is called then immediately return on all callbacks if closed. It's a bit crap though.

@kegsay kegsay added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant