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

Thoughts about multi-user support #5573

Open
bobbyz007 opened this issue Jun 25, 2019 · 11 comments
Open

Thoughts about multi-user support #5573

bobbyz007 opened this issue Jun 25, 2019 · 11 comments
Labels
question user / developer questions

Comments

@bobbyz007
Copy link

bobbyz007 commented Jun 25, 2019

Theia is designed under a single user scenario, that is back-end should run in a sandboxed environment like docker. But setting up docker or k8s seems a little bit too heavy cause someone may use Theia only as code editor or generic platform to extend functions, so is it possible to run in multi-user scenarios under some conditions, supposing:

  1. Front-end sources are packaged as html,js,css,etc, and are rendered by web browsers, supposing there are userA, userB.
  2. More than one clents such as UserA and UserB connect to the same back-end service.

This brought a problem userA and userB could access the same underlying file system and conflicts may exist. But if the conflicts are tolerable form someone's use case(like multiple writes, but last wins), Or Doing validation outside to make sure different users access different workspace folders, does it make sense?

@kittaakos
Copy link
Contributor

This brought a problem userA and userB could access the same underlying file system and conflicts may exist.

The users can select different workspace roots so they won't conflict.

But if the conflicts are tolerable form someone's use case(like multiple writes, but last wins), Or Doing validation outside to make sure different users access different workspace folders, does it make sense?

Can you please clarify a bit on this?

@kittaakos kittaakos added the question user / developer questions label Jun 25, 2019
@bobbyz007
Copy link
Author

bobbyz007 commented Jun 26, 2019

@kittaakos More details:

But if the conflicts are tolerable form someone's use case(like multiple writes, but last wins)

Assuming multiple users are editing the same file, naming 'test.js' for example, the last one who save the edit may override others' modifications. Saying 'tolerable' means it's acceptable for one's business

Or Doing validation outside to make sure different users access different workspace folders, does it make sense?

The users indeed can select different workspace roots, but we should have ways to make sure they do.
One of the ways is doing validation, like , we have a table 't_user_workspace' to hold all the workspaces the user created or are authorized:

userid workspace
userA /test/wa
userB /test/wb

When userA logged in, only workspace '/test/wa' can be openned by validating against t_user_workspace.

My concern is , even though having the above considerations in mind, whether the back-end really support multiple user, are there other problems like concurrency issues in java? I'm new to nodejs, and look forward to seeing more details or thoughts about multi user support in Theia. Really appreciate.

@paul-marechal
Copy link
Member

paul-marechal commented Jun 27, 2019

IIUC, the backend tries to have as little state as possible, and when state is needed, it is stored in some kind of session (1 per connected client).

The biggest issues are filesystem related I think: like you mentioned if two people edit the same files there may be concurrency issues. Some talked about collaborative editing, but no extension was published yet for it.

Aside from the filesystem I don't exactly see what would go wrong. Just Git alone, since the state is inside the .git folder, when one switches branches it will change it for everyone. Sounds like a weird development environment.

@bobbyz007
Copy link
Author

I'm preparing to test Theia with multiple user visiting, so it's better to keep this issue open if there are some problems in the process I would post here.

@akosyakov
Copy link
Member

If you have a dirty editor then saving a file will override any changes on fs and propagate to all editors which are not dirty. Consequently If you don't have a dirty editor then an editor content will be overridden by any changes on fs.

@justin-z
Copy link

justin-z commented Jul 4, 2019

If you have a dirty editor then saving a file will override any changes on fs and propagate to all editors which are not dirty. Consequently If you don't have a dirty editor then an editor content will be overridden by any changes on fs.

Are there ways to tackle this behavior gracefully? if multiple users are editing the same file, this is weird, Whether propagating to all editors in frontend or just saving to fs in backend, maybe it's about concurrent editting, need diff/merge to resolve the conflicts, seems a little bit complicated.

@blueken
Copy link

blueken commented Jul 4, 2019

I think there are 2 ways to fix out this problem

  1. each user visit a new theia instance providing by by k8s
  2. If you only have one theia instance, you can create 2 branches using terminal extension

Either way, userA and userB dont edit same file in concurency way, but merge theirs changes by git

@paul-marechal
Copy link
Member

@blueken solution 1 is the recommended one, since it gives users an isolated environment. Solution 2, where you clone the same repository on different places of the same host and open a Theia instance for each, this can work too. But you then have to play around with starting each Theia instance with the right uid/gid to restrain the user from accessing things he shouldn't (mostly other's workspaces).

If you want to reuse the same Theia server process for multiple users though, then everyone will share the same permissions. Theia doesn't manage user auth, not without modifications/extensions.

@akosyakov
Copy link
Member

maybe it's about concurrent editting, need diff/merge to resolve the conflicts, seems a little bit complicated.

We wist to do it, but not this year. There are more pressing matters like complete support of vscode extensions and 1.0 release.

Isolated env per a user sounds good.

@bobbyz007
Copy link
Author

bobbyz007 commented Jul 6, 2019

@blueken If one needs support a complete environment including coding, building, debugging, packaging etc, then isolated environment is necessary and somewhat inevitable.
But in other cases like as code editor, it's more easy for users to extend by integrating theia than monaco itself as theia has provided many apis and language server support. From this point of view I think it's a scenario that theia could support multi user with not much effort.

@realsongcs
Copy link

Hi guys, is this topic under developing? Has any progresses?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question user / developer questions
Projects
None yet
Development

No branches or pull requests

7 participants