Page 1 of 1

Each new window as independent process

Posted: 2021-06-23, 13:38
by Alexei
It's my 1st post on this forum, though I'm using Pale Moon for quite a while.
I noticed Pale Moon from time to time becomes almost unresponsive - something takes 100% CPU and it's likely ralated to the particular page (I open each page in a new window).
I understand, it may be very hard to implement reliable protection against such situations. I think it would be nice to be able to open new window, as an independent instance (separate process). It may be "Open Link in New Instance" or something like that. I mean additional right-click option similar to "Open Link in New Private Window".
I think, such feature would provide additional security because opened web pages could be fully independent, as well as improved stability because crash of independent window would not affect other pages. Also, on each window it would be nice to have "Terminate and Reload" and "Terminate and Close" to deal with hang-issues.
BTW, Pale Moon is :thumbup:

Re: Each new window as independent process

Posted: 2021-06-23, 13:52
by Moonchild
This can't be done. The only way you can have multiple processes is in the way Google and Mozilla have done it, with electrolysis (e10s), which we explicitly don't support due to the many, many pitfalls, security issues and the resource handling nightmare it causes.
Just "launching another process" for a new window in our current state doesn't work because it can't use the same profile from multiple processes concurrently.

By the way, other browsers' multi-process approach doesn't actually stop non-responsiveness; it only masks it from the user. But if something really hangs, then yes, it will also affect the UI even in Chrome or Firefox; often in a more severe way at that (no watchdog pop-up or what not allowing you to stop bad scripting).

However, if you have any good ideas about how to approach this in a way that avoids concurrent profile access issues and doesn't use IPC/e10s I'd love to hear them.

Re: Each new window as independent process

Posted: 2021-06-23, 15:29
by Nuck-TH
While we are at it: can chrome and content execution and compilation of JS be separated into different threads? Or it is not only cause of UI lockups? I don't have any real knowledge of how it works in UXP, so I'm really curious. :oops:

IMHO long lockups are not really a problem(since they are rare) and timeout dialog is really useful(as it is usually scripts that not take long, but that really hit infinite loop), but small hiccups are - they severely damage usability by locking UI, messing up scroll, missing input, etc. And as bad masking as it fundamentally is, but it mitigates hiccups well.

Re: Each new window as independent process

Posted: 2021-06-23, 15:47
by New Tobin Paradigm
Improving multi-threading IS among our goals. Ideally most operations that could become ridiculous would be off the main thread. We have a decent degree of this already but as people have noticed sometimes the UI freezes from time to time. So we basically still have work to do on that front.

However, you can't think of multi-threading as strictly following the same model as how Mozilla did e10s. For one, it has to actually make sense and there wouldn't be the kind of duplication and redundancy involved in multi-process.

Re: Each new window as independent process

Posted: 2021-07-03, 13:11
by Alexei
@Moonchild
I think I have a workable idea of how to implement it with minimal efforts.
1) Allow users adding custom choices to Open Link menu.
Properties: Name, Command to invoke (with %url%), create standalone/child process (and maybe something else).
2) Add PaleMoon command line parameter: "limited functionality" (or something like that), this parameter would disallow changes to the PaleMoon files, which cannot be shared. Another parameter would apply config updates from specified file.

How it's supposed to work:
User's choice starts a script that copies core files to a temporary subdirectory (and/or creates hardlinks to them), creates configuration files in it, and starts the new PaleMoon instance in standlone mode. It could be a standard script (provided by PaleMoon) or written by user (for ex. to open link in another browser, download with Curl, etc.).

I believe such approach (using script to provide new functionality) brings a lot of flexibilty and, most importantly, does not increase complexity of the main application (in my view, overintegration is what modern software suffers from).

Re: Each new window as independent process

Posted: 2021-07-03, 13:48
by Nuck-TH
"Read only part" wouldn't function normaly as at least cookies are always need to be written. If such instance needs to be "new window" then lack of synchronization in places(history, bookmarks, etc...) and settings will create huge UX inconsistency.
If that new instance is not read only, then how do you sync all above stuff? If some sync module will need to be written, then consider that conflicting changes are not automatically mergeable.
Next option is inter-process communication... and here we are almost at how Firefox works. Iwouldn't even begin on ow much problems and security issues it caused there.

If easy ideas was a way - they would have been proposed or implemented at some point. But it isn't that easy.

Re: Each new window as independent process

Posted: 2021-07-05, 00:35
by moonbat
Just stick to Firefox instead :roll:

Re: Each new window as independent process

Posted: 2021-07-05, 01:27
by Moonchild
Alexei wrote:
2021-07-03, 13:11
I think I have a workable idea of how to implement it with minimal efforts.
I'm afraid not.
The "minimal effort" part would be if this was done in a dirty hack way. But if something like that would be done properly, then one needs to think about things like:
  • How would you distinguish a "limited functionality" window from a "regular" window? The user needs to know this, visually.
  • How would you handle the case if a user decides they want to have data from this "limited" window saved, anyway? Because that's inevitably going to happen.
  • How would you handle the copying of files from a profile that is locked by the main process? Keep in mind there are databases in use here that are locked and cannot be copied in an open state -- this is why you MUST shut down the browser if you make a filesystem profile backup, for example...
  • In what way would this kind of limited functionality and "throwaway" window be beneficial to the user aside from private-window-esque behavior (but then even more limited)? Does it outweigh the obvious added complexity?
etc.

So no, there is no simple solution for doing this, and any sort of "make a temp copy then run a new instance" is a massive can of worms. I'm not going to open that.

I suggest you approach this another way. If you have known-bad sites that don't play nice with Pale Moon and you still want to use it without it interfering with the rest of your browsing session, use a separate portable instance of the browser (e.g. by placing a shortcut to it on your desktop).

Re: Each new window as independent process

Posted: 2021-07-15, 15:05
by Alexei
moonbat wrote:
2021-07-05, 00:35
If you have known-bad sites that don't play nice with Pale Moon and you still want to use it without it interfering with the rest of your browsing session, use a separate portable instance of the browser (e.g. by placing a shortcut to it on your desktop).
Basically, that's what I want automated :) I mean automatic creation of new temporary portable instance and opening it with the link, which was clicked. You don't expect me to make such instance manually, right?
Actually, everything can be implemented with some simple scripts.
1. To be invoked at PaleMoon startup to save user preferences (if user's DB cannot provide shared access).
2. To be invoked when user chooses "Open in new instance".
3. To be invoked at instance termination.
Of course, it should be possible to add custom entry to right-click menu.
I'm not sure how you handle bookmarks, but PaleMoon already can import bookmars, so adding bookmarks from another instance shouldn't be a problem.

Re: Each new window as independent process

Posted: 2021-07-15, 15:20
by New Tobin Paradigm
RESOLVED INVALID

Re: Each new window as independent process

Posted: 2021-07-15, 20:45
by Moonchild
New Tobin Paradigm wrote:
2021-07-15, 15:20
RESOLVED INVALID
To put this in context: that would definitely not be something the browser itself would have to be tasked to do.
viewtopic.php?f=5&t=5647
Point 1, actually. At the very top of the list. For a reason.