Stopping a program that has hung or is looping

This section contains advice on the safest way to stop a Sculptor program that cannot be exited using normal procedures. The main objective in such circumstances is to avoid damage to the file system.


Standard keyboard interrupts

First, try the standard keyboard interrupt character. Sculptor traps this interrupt and will delay it during a file update command. As soon as the update finishes, the interrupt is allowed through. If the Sculptor program allows interrupts, this stops the program safely. The Sculptor system variable sys.Interrupts determines whether interrupts are allowed or ignored. By default, this variable is OFF (interrupts are ignored).

On MS-DOS, the keyboard interrupt is CTRL-BREAK. CTRL-C also generates an interrupt if it is defined as the interrupt character, but fails if other characters are in the keyboard buffer. (CTRL-BREAK bypasses the keyboard buffer.) It is important to enable this interrupt at system level by including the following line in CONFIG.SYS:

BREAK=ON

On Unix, the keyboard interrupt is usually DEL or CTRL-C. It is fairly common to set the interrupt to CTRL-C in the terminal parameter file, even though DEL is used in the shell.

There is no keyboard interrupt character in Windows programs.


Stopping a program without keyboard interrupts

If the keyboard interrupt is ignored or is not available, the actions to be taken depend on the platform.

MS-DOS

The only way to stop the program is to reset or switch off the computer. If the program is likely to terminate on its own eventually, it is better, if possible, to wait for it to do so. If the system must be stopped, try to press the reset button at a time when the hard disk is not active.

UNIX

If the program is running in the background, run ps to identify the process id.

Otherwise, log in as the same user (preferred), or as “root” on another terminal, and run ps -a to identify the process id. It is very important to identify the correct process.

Kill the process using the default signal (SIGTERM):

kill process_id

This signal is trapped by Sculptor in the same way as the keyboard interrupt, but cannot be switched off in the program. This normally works but can fail if the program is accessing a device that is busy. Wait a short while to give the device time to become free. As a last resort, use

kill -9 process_id

This signal cannot be trapped by Sculptor, so it can cause file damage.

Windows 95, 98, ME

Click in the program’s window and type Ctrl+Alt+Del. Select the option to end the task.

If the program does not exit immediately, give it some time. Press Ctrl+Alt+Del again to reboot the computer only as a last resort.

Windows NT, 2000, XP and all later versions

Click the right mouse button on the task bar and start Task Manager. Select the Applications tab (not Processes). Highlight the application and press the End Task button.

If Task Manager informs you that the program is not responding, give it some time. If the program exits, there should be no file damage. Force the task to end only if it doesn’t exit after thirty seconds.

Use the End Process button in the Processes tab only as a last resort. This procedure does not allow the program to exit gracefully.


Checking Sculptor files after program has been terminated

After stopping a program, always run the kfcheck utility on all Sculptor files used by that program, to verify their integrity.

If secondary index damage is reported (missing or incorrect number of keys in index), it can be repaired by running kfri or kfbuild.

Other damage must be repaired using kfri (which has an option to rebuild secondary indexes as well) or by restoring the file from a backup.

All these checking and repairing operations can be run from the Sculptor File Manager.

IMPORTANT NOTE: Never run a program that might update a damaged file. This can make the damage much worse.