element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Properly support multiple tabs

Open marcusmueller opened this issue 2 years ago • 33 comments

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 avatar Sep 24 '23 19:09 marcusmueller

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.

marcusmueller avatar Sep 24 '23 19:09 marcusmueller

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 avatar Sep 25 '23 08:09 t3chguy

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

t3chguy avatar Sep 26 '23 11:09 t3chguy

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

bornav avatar Sep 30 '23 16:09 bornav

@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.

marcusmueller avatar Sep 30 '23 16:09 marcusmueller

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.

t3chguy avatar Sep 30 '23 17:09 t3chguy

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

marcusmueller avatar Sep 30 '23 17:09 marcusmueller

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.

ChristianMayer avatar Oct 01 '23 13:10 ChristianMayer

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.

xarinatan avatar Oct 07 '23 19:10 xarinatan

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

bornav avatar Oct 07 '23 19:10 bornav

@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 avatar Oct 07 '23 19:10 xarinatan

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.

xarinatan avatar Oct 15 '23 17:10 xarinatan

@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!

marcusmueller avatar Oct 15 '23 18:10 marcusmueller

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.

exercismnow avatar Oct 24 '23 22:10 exercismnow

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).

richvdh avatar Oct 27 '23 09:10 richvdh

1.11.45 here, same issue

Zer0- avatar Nov 03 '23 11:11 Zer0-

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.

lunera-dev avatar May 21 '24 18:05 lunera-dev

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.

t3chguy avatar May 23 '24 08:05 t3chguy

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: @.***>

lunera-dev avatar May 23 '24 11:05 lunera-dev

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.

t3chguy avatar May 23 '24 11:05 t3chguy

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
            }

lunera-dev avatar May 27 '24 22:05 lunera-dev

@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

t3chguy avatar May 28 '24 07:05 t3chguy

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.

osresearch avatar Jul 23 '24 11:07 osresearch

@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?

Reactongraph avatar Jul 25 '24 06:07 Reactongraph

@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

t3chguy avatar Jul 25 '24 08:07 t3chguy

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

Reactongraph avatar Jul 25 '24 12:07 Reactongraph

[this] is not a support forum.

t3chguy avatar Jul 25 '24 12:07 t3chguy

@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?

ctrlbrk42 avatar Jul 25 '24 12:07 ctrlbrk42

@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.

t3chguy avatar Jul 25 '24 12:07 t3chguy

@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.

ctrlbrk42 avatar Jul 25 '24 13:07 ctrlbrk42