element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.02k stars 1.96k forks source link

Properly support multiple tabs #26231

Open marcusmueller opened 1 year ago

marcusmueller commented 1 year ago

Steps to reproduce

  1. I'm using an EMS-hosted element web 1.11.42
  2. As usual, I opened a second tab to go to the element URL in order to handle a coding related manner while keeping an eye on an organizational space, and participating in a documentation-related discussion

Outcome

What did you expect?

Second tab works, as it always used to – after all, having more than one window open is a very classical power-user workflow

What happened instead?

image

I got a message

Element is open in another window. Click "Continue" to use Element here and disconnect the other window.

and that's more than annoying. This makes element worse to use than a significant part of the competition, which we decided against a while back.

Operating system

Linux x86_64

Browser information

FF 117.0.1

URL for webapp

chat.gnuradio.org

Application version

Element version: 1.11.42 Olm version: 3.2.14

Homeserver

https://gnuradio.ems.host

Will you send logs?

No

marcusmueller commented 1 year ago

This very very strong regression seems to have been introduced in https://github.com/matrix-org/matrix-react-sdk/pull/11425. It is mentioned in the changelog under "Features", which is a miscategorization, on two fronts:

  1. It's not a feature, but was introduced to fix a bug, and
  2. it's a very strong functional regression.

The original bug that was fixed in https://github.com/matrix-org/matrix-react-sdk/pull/11425 describes the taken approach as

A (somewhat hacky) option might be to lock out multiple tabs

and I'd concur; it's a very hotfix way of dealing with this. Since this requires a broadcast channel, there would be other (but potentially with downsides) ways of avoiding ratcheting races. The taken approach is understandable, but not without alternatives. This issue documents the user experience regression the taken approach entails.

t3chguy commented 1 year ago

It's not a feature, but was introduced to fix a bug, and

Sure it is, it guards you against the footgun of using multiple tabs which had a low risk of data corruption, with rust crypto that risk went up so the necessity for such a guard was higher.

t3chguy commented 1 year ago

Blocked on https://github.com/vector-im/element-web/issues/2503

bornav commented 12 months ago

This makes it completely unusable for my use case Reverting to v1.11.40, and freezing the automatic update till this is resolved

marcusmueller commented 12 months ago

@t3chguy I'm trying to understand the technical side of this: Why is this blocked on #2503? We clearly have a channel to exchange the "there's another instance running" information, why not use that for arbitrating access to the ratchet?

Is implementing @ara4n's proposed webworker really the only way out of this regression? It feels like saying "blocked on this core architectural aspects" makes it unattainable to fix this.

t3chguy commented 12 months ago

The channel uses a very rudimentary lock in localstorage. The Rust crypto stack needs to only run in one place due to heavy leveraging of caches, abstracting all crypto calls via serialisation in localstorage would be dreadful for performance. If you feel the Rust crypto stack should be less restrictive then please open an issue on its tracker.

marcusmueller commented 12 months ago

Thanks for the clarification! Much appreciated that you point me in the right directions :+1:

ChristianMayer commented 12 months ago

It's not a feature, but was introduced to fix a bug, and

Sure it is, it guards you against the footgun of using multiple tabs which had a low risk of data corruption, with rust crypto that risk went up so the necessity for such a guard was higher.

It's not a feature. It's a huge UX regression.

That it was introduced to fix something deemed even worse (and probably is even worse) doesn't stop it from being an UX regression. Preventing users from using multiple tabs is a broken UX design.

xarinatan commented 11 months ago

I ran into this issue today somehow, but without having multiple tabs open. No amount of refreshing and restarting Firefox would fix the issue, eventually I cleared the cookies/site data for that domain and everything was fine and dandy again.

bornav commented 11 months ago

@xarinatan did you update the element client, same happened to me when I updated the client

xarinatan commented 11 months ago

@bornav I'm not entirely sure what triggered it, my laptop ran out of power (so the browsing session was force-closed while on standby) so that could be a reason, I have a system that automatically updates the Matrix/Element containers to whatever's the latest tag on docker's registry so it could've been updated in that time, too.

Once it was triggered there was no way to resolve it without clearing the cookies/session storage for Element though. I restarted Firefox, ctrl+reloaded the page as well as just re-opening the page and browsing back to the main domain, to no avail, until I reset the aforementioned data.

xarinatan commented 11 months ago

I'm having the same issue again, different machine this time, again the only solution is to completely reset the cookies/local site data for Matrix.. I doubt I'm the only one who runs into this if it happens this often.

It's seemingly onset by laptops having ran out of power while in standby, I bet there's a very simple locking mechanism that just marks the session as locked when Element is initialized, but that means if the browser is ended incorrectly it'll cause Element to think its session is unavailable when it's not.

marcusmueller commented 11 months ago

@xarinatan you're describing a separate issue, as far as I understand it, namely that single-tab-ensurance mechanism has a bug. So, please fill in a separate issue. Help the maintainers – keep separate issues separate, a bug tracker is not a discussion forum. Thank you!

exercismnow commented 11 months ago

I have a similar issue when using Firefox's container tabs.

In order to isolate Element accounts, I have different containers for different accounts. But sometimes (not always), I'll get this warning message that Element is open in another tab. I can usually circumvent it by refreshing the page, but I wonder if it's a privacy concern that Element can detect other instances of it running in different containers.

richvdh commented 11 months ago

I wonder if it's a privacy concern that Element can detect other instances of it running in different containers.

If that were really what's happening, it would be a concern for everything to do with container tabs, and you'd need to take it up with Mozilla. But I very much doubt that is what is happening: either you actually have a second instance running in the same container, or you're seeing some other bug where the lock is not being correctly cleared on reload.

It's likely that https://github.com/matrix-org/matrix-react-sdk/pull/11800 will help with this once it is released; if not, please open a separate issue and submit logs from within the app (they are still useful even if you have to reload).

Zer0- commented 10 months ago

1.11.45 here, same issue

lunera-dev commented 4 months ago

It's 7+ months later and this is still an issue. In my use case, I am NOT using E2E because encryption in my org is against policy. Is there a way I can have multiple tabs (rooms) open at the same time since E2E is disabled? #2503 links here.

t3chguy commented 4 months ago

Is there a way I can have multiple tabs (rooms) open at the same time since E2E is disabled?

Not unless you actually disable E2E, which requires building Element with E2E disabled, it isn't a runtime flag.

lunera-dev commented 4 months ago

How can I build without encryption? I'll try to figure it out but appreciate any direction. 

Just web is what we are focused on.


From: Michael Telatynski @.***> Sent: Thursday, May 23, 2024 3:05 AM To: element-hq/element-web Cc: Lunera; Comment Subject: Re: [element-hq/element-web] Properly support multiple tabs (Issue #26231)

Is there a way I can have multiple tabs (rooms) open at the same time since E2E is disabled?

Not unless you actually disable E2E, which requires building Element with E2E disabled, it isn't a runtime flag. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

t3chguy commented 4 months ago

How can I build without encryption? I'll try to figure it out but appreciate any direction.

You'd have to force legacy crypto mode via configuration flags and then also remove @matrix-org/olm from the bundle such that it forces encryption disabled.

lunera-dev commented 4 months ago

How can I build without encryption? I'll try to figure it out but appreciate any direction.

You'd have to force legacy crypto mode via configuration flags and then also remove @matrix-org/olm from the bundle such that it forces encryption disabled.

I'm trying to find the proper way to "force legacy crypto mode via flags" but cannot find that as a documented option for config.json. Would deeply appreciate a link. I tried Google but my Google-fu failed me.

If you mean the well-known client, I already have the following:

             "io.element.e2ee": {
                    "default": false,
                    "force_disable": true,
                    "secure_backup_required": false
            }
t3chguy commented 4 months ago

@lunera-dev https://github.com/element-hq/element-web/blob/develop/docs/labs.md#use-the-rust-cryptography-implementation-feature_rust_crypto-in-development - keep in mind the migration is one-way, so any sessions already on rust crypto would need to be logged out and back in

osresearch commented 2 months ago

Is it possible to use the multiple tab detection to instead trigger the library to perform the safe but slower mode that "abstracts all crypto calls via serialisation in localstorage"? That way the popup could warn the user that enabling this mode will slow down all of their matrix tabs and allow the user to choose if they are willing to make that trade-off. If the number of tabs drops to 1 or fewer, the last surviving tab can re-enable the fast mode.

Reactongraph commented 2 months ago

@t3chguy I have followed these steps to disable E2EE, but nothing works:

I uninstalled @matrix-org/olm and removed all its dependencies used in loadOlm. I added the following code to the config.json file:

{
"features": {
"feature_rust_crypto": false
},
"io.element.e2ee": {
"default": false,
"force_disable": true
}
}

After making the above changes, I built the project and then ran it. I also tried to disable encryption by overwriting the initCrypto method in loadApp. Despite these efforts, E2EE is not disabled. Could you provide further guidance on how to effectively disable E2EE?

t3chguy commented 2 months ago

@Reactongraph an unrelated issue is not a support forum. Rust crypto is no longer disableable as per its removal from https://github.com/element-hq/element-web/blob/develop/docs/labs.md#use-the-rust-cryptography-implementation-feature_rust_crypto-in-development

Reactongraph commented 2 months ago

@t3chguy, I want to disable all types of E2EE. Can you please guide me through the process?

t3chguy commented 2 months ago

[this] is not a support forum.

ctrlbrk42 commented 2 months ago

@Reactongraph an unrelated issue is not a support forum. Rust crypto is no longer disableable as per its removal from https://github.com/element-hq/element-web/blob/develop/docs/labs.md#use-the-rust-cryptography-implementation-feature_rust_crypto-in-development

Hi,

Is this thread still current -- broken multiple tabs (due to crypto module/E2EE)?

I've been working to try and enable multiple tab support as well, and I don't need E2EE. So this news of the module being removed was new to me.

I'm trying to understand why the issue still exists if the module was removed?

t3chguy commented 2 months ago

@ctrlbrk42 the module was not removed, the labs flag for it has, it is now the only supported module. Thus as it cannot be disabled, you cannot simply skip the legacy variant from the build as was previously supported.

ctrlbrk42 commented 2 months ago

@ctrlbrk42 the module was not removed, the labs flag for it has, it is now the only supported module.

Ok thank you. So does that mean there is no longer any possibility of multiple tab support? This issue should be closed as "won't fix"? Or is there still a plan to solve it?

My entire project requires no E2EE and also requires multi-tab, so I'm doing my best to understand the current state.

I get this isn't a support forum but I've spent weeks trying to solve this on my own. So I guess I'm asking for a little pity lol 😂.

I would offer a bounty or whatever it takes to solve this issue.

Thank you for taking time to respond.

marcusmueller commented 2 months ago

@t3chguy seriously, this is running out of control. Could you go ahead and remove all the comments that ask for help, about features in the build, and finally this one itself? If we're trying to get anywhere with this, we should keep the information in this issue quickly surveillable. You say "this isn't a discussion forum", yet we tolerate exactly that.

t3chguy commented 2 months ago

Or is there still a plan to solve it?

That's up to the crypto team, if they had thought its a wont-fix I'd have expected they would have closed this by now

richvdh commented 2 months ago

Speaking from the crypto team: we hope to fix it one day, but it is not currently a priority.

My entire project requires no E2EE and also requires multi-tab, so I'm doing my best to understand the current state.

Possibly you could build a fork of Element that disables E2EE support, and also disables the multi-tab check; but bear in mind that's not a configuration we support or test, so it's hard to say what brokenness you would encounter.