Finite-time Freeze?

Support and discussions for the x86/x64 Linux version of Pale Moon and specific Linux distribution questions related to the browser.

Moderator: trava90

Forum rules
If your question is about general use of the browser and not specific to Linux, then please use the General Support board.
vannilla
Board Warrior
Board Warrior
Posts: 1132
Joined: 2018-05-05, 13:29

Re: Finite-time Freeze?

Post by vannilla » 2019-02-16, 10:25

moonbob69 wrote:The only way a thread stops is if it decides it is done, decides to wait for something, or the CPU interrupts it, literally with the CPU hardware.
No, a thread can stop (and potentially never resume) also because of mutual exclusion locks. Since threads are part of the same process they can access the same memory addresses; since they run in parallel, setting a global variable in multiple threads means the final value is unpredictable or even cause a crash or memory leak. Thus, threads synchronize themselves by waiting (i.e. stopping execution) until the thread operating on the shared state is done.
It is up to the programmer to properly set up this mechanism, the OS only provides the tools and the processor knows nothing about that.
moonbob69 wrote:Do threads get to set their own error entry points to respond to specific anticipated errors like divide-by-zero?
On Unix-like systems, some errors similar to that have a signal, so programs can potentially handle them.
moonbob64 wrote:If a process has a handler, that sounds like interrupt-code itself; such code is only entitled to copy the information into its own memory space and return, and then work on that signal in its own time-slice later. How do signals work? Does a process have more than one entry point. or is the only entry point supposed to check for signals to see it it is being run for the first time or in response to a signal?
Handlers are normal functions like everything else.
The difference is that they are used as values of a special vector that the OS creates when the program is executed.
When the OS sends a signal to the process what it means is that the process calls this function instead of performing the operation it would perform otherwise.
Signals are handled completely at the OS level, they have nothing to do with the processor or interrupts.
Also, if the signal handler is fast enough (as it should be for unrelated reasons), the process can handle a signal without having to wait for the next time slice.
moonbob64 wrote: I had asked previously if anyone knew how the "unresponsive script" box was triggered, and how much trouble it would be to have a stop button that knew where scripts were and stop them.
Doesn't that box have a "stop execution" (or however it's called) button?
Also it's triggered after a script executes for a certain amount of time without stopping.

User avatar
moonbob69
Apollo supporter
Apollo supporter
Posts: 39
Joined: 2019-02-06, 09:13

Re: Finite-time Freeze?

Post by moonbob69 » 2019-02-19, 09:23

Also it's triggered after a script executes for a certain amount of time without stopping.
Thanks for that information. The "unresponsive script" box does have a "stop" option, also a "continue" and "debug" option. (I would like to find a tutorial on how to use that "debug" option.) And selecting "stop", although it doesn't work instantly if the script has already caused a problem, in 2 minutes or so sometimes gets things running normally.

The useful thing would be to stop scripts that haven't triggered the "unresponsive" criterion. Moonchild has said that the browser "stop" button only stops new (or ongoing?) data transfers, and doesn't concern scripts that are doing stuff.
thread can stop... because of mutual exclusion locks.
If a thread calls an OS function that involves a potentially lockable or unavailable resource like I/O, I call that "deciding to wait for something"; once it makes that call it is too late to decide to do something else. Or in the case of locking, is there an immediate error return?

vannilla
Board Warrior
Board Warrior
Posts: 1132
Joined: 2018-05-05, 13:29

Re: Finite-time Freeze?

Post by vannilla » 2019-02-19, 10:22

moonbob69 wrote:(I would like to find a tutorial on how to use that "debug" option.)
You'd have to learn Javascript first; debugging it comes relatively naturally after that.
moonbob69 wrote: The useful thing would be to stop scripts that haven't triggered the "unresponsive" criterion. Moonchild has said that the browser "stop" button only stops new (or ongoing?) data transfers, and doesn't concern scripts that are doing stuff.
You need a content blocker for that. Try uMatrix (search the forum for installation instructions) or uBlock Origin.
moonbob64 wrote:If a thread calls an OS function that involves a potentially lockable or unavailable resource like I/O, I call that "deciding to wait for something"; once it makes that call it is too late to decide to do something else. Or in the case of locking, is there an immediate error return?
We are talking about two different things.
The locking I'm talking about has nothing to do with I/O or anything like that.
Threads often need to use shared resources. These resources most of the time are actually just memory addresses, so they are always available. To keep consistency and avoid other problems (look up on concurrency examples and problems), programmers put up "locks", so that threads will be able to work on those resources only if no one else work on them already.
If the lock is free, the thread takes it, making it busy. If it's busy, it yields the processor until it's notified that the lock is free. When it's done working with the resources, it "unlocks" the lock, notifying the other waiting threads that they can acquire the lock.
There other similar mechanism available to manage shared resources, but this is the most basic one. Making it work is entirely up to the programmer.

If you really want to go on about "waiting on I/O", on Linux if a device or a file is unavailable an error is returned. Additionally, the C interface with the system has functions like "select" that can handle multiple file descriptors, even without blocking.
Plus, I/O in general can be handled in a non-blocking way (e.g. Java NIO just to name one that is not an OS.)
Thus, wether or not a program blocks on I/O is entirely a programmer's decision, not the OS's or the processor's.

User avatar
moonbob69
Apollo supporter
Apollo supporter
Posts: 39
Joined: 2019-02-06, 09:13

Re: Finite-time Freeze?

Post by moonbob69 » 2019-02-22, 08:39

on Linux if a device or a file is unavailable an error is returned
Data from real devices is always unavailable at least some of the time. The regular uncomplicated Read etc functions wait until it is available or until it is known that it is never going to be available- on error or eof.

An error in use of Mlock(), locking user memory to keep it from being paged, would cause poor performance of the all applications but not freeze other threads for a finite time.

An error in mutual exclusion locks or even a thread that stops and never resumes hangs the application but once it occurs, how can that problem have a finite time? I've experienced other applications that stop responding to input or providing output, but most of the time the desktop still works, and you can use desktop functions to kill it.

Are there ways that a user program simply not responding to its inputs can hang the Linux function that is providing them (moving the cursor)? Overflowing stacks, queues, etc?

I can see how memory leaks eventually slow down a system with disk swapping, but I don't see how a halt would happen suddenly; and once it happened, I don't see how it could correct itself in a finite time.

What are the things a user program can do to crash Linux (a permanent freeze with no error notice)?

User avatar
moonbob69
Apollo supporter
Apollo supporter
Posts: 39
Joined: 2019-02-06, 09:13

Re: Finite-time Freeze?

Post by moonbob69 » 2019-02-22, 09:36

Some new info. Replacing PM27 with PM28.3.1 (32 bit), the problem has gotten worse.

After running the new version only a few hours, a finite freeze occurred when using a PM function: with 3 tabs open, what seemed like a quick pop-up-window-closing was observed; I thought maybe I had accidentally agreed to a plug-in. So I clicked on PM Tools->Add-Ons. That page with the 4 selections opened, and promptly froze everything. To verify that it was more than slow mouse action, I pressed F12 (a shortcut key for opening JWM desktop manager).

After 6 minutes, a white box the size of the JWM menu appeared. Then nothing more until after 9 minutes total, when the white box was filled in and the JWM submenu next to it appeared. (No add-ons were present.)

Then an hour later at reuters.com (not a bad site in previous experience), another freeze for 11 minutes; probably dragging a scroll-bar. This time, pressing F12 did not draw anything until after the time was up, with the full normal menu. Only 2 minutes later (hardly had a chance to see what the reuters story was) another freeze for 12 minutes.

Then, 2 hours later, at a not-so-well-behaved site and probably dragging or scrolling, froze for 6 minutes while loading vidstat.taboola.com (a foreign URL). Then the JWM window (my timing reference), the ESC key to close the window, and only 2 inches of mouse travel before a 13 minute freeze.

3 hours later, a 14 minute freeze when actually clicking on a previously-opened "Pale Moon forums" tab.

Htop showed normal operation (total CPU 2-4%) after all these unfreezes. Also, before starting PM, I had killed "pmcputemp" (a status-bar display app) which had previously shown suspiciously high memory usage in Htop.

Are there some system calls common to these incidents? Without knowing how PM can freeze or crash other (desktop) threads, it would seem that the problem is in the kernel or Xorg library threads, triggered by something PM does.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 27813
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: Finite-time Freeze?

Post by Moonchild » 2019-02-22, 09:55

It's most likely related to, as you already observed, something in Xorg or your desktop manager/drivers. Pale Moon, like any modern web browser, is more akin to a full-fledged PC game than a regular desktop application, so it can and will tax parts of your desktop/system other applications might not even go near.
As for the actual cause of this, I'm really not well-versed enough in Linux to know what this would be a symptom of. Others may be better suited to help.
"There will be times when the position you advocate, no matter how well framed and supported, will not be accepted by the public simply because you are who you are." -- Merrill Rose
Image

Locked