2.4 Troubleshooting
Being a highly customizable language and tool support
development environment, MetaEdit+ may sometimes expose the end user to issues
originating from the language or code generator definitions made by the
metamodeler. We have done our best to prevent this from happening, but in order
to retain the maximum expressive power for language development, the metamodeler
is not actively prohibited from making mistakes such as destructive refactoring
or implementing accidental infinite loops. Incomplete or erroneous language or
generator definitions may result in run-time anomalies or erratic behavior. This
is quite normal during the development stage of a new language, but sometimes
such troubles may unfortunately slip through the metamodeler’s testing
into deployment.
The most common case of an apparent hang is an infinite
recursion in a generator. If this happens in a generator run automatically in
the background (e.g. an identifier generator while displaying an object in a
list, or a symbol’s text label generator while displaying a diagram),
MetaEdit+ will cut the generation short at the timeout value specified in
Options | System: see Section
3.1.3.
The generation output so far will be shown, followed by ‘*Error*:
Generator took too long - maybe recursion e.g. id; in identifier
generator?’. Alternatively, if a manually started generator hangs, the
user can press the
Break button in the progress bar widget to interrupt
the generator and open a Generator Debugger: see Section
5.2.1. The information in the Generator
Debugger may be useful to the metamodeler; the modeler can continue work as
normal.
Aside from bugs in generators or MetaEdit+ itself, trouble
may also arise from corrupted model and repository data structures. Typical
sources for corruption are power and hardware failures that may have left the
repository in a faulty state, careless system administration operation, or
metamodel or model imports. While MetaEdit+ can usually catch and prevent
suspicious import operations, or can revert from them by abandoning the current
transaction, there may arise a condition where MetaEdit+ shows an error dialog,
hangs, or otherwise prevents further work. An error dialog looks like
Figure 2–2:

Figure 2–2. Error dialog.
The error dialog has
buttons to Proceed with the current operation (if possible),
Terminate it or Exit MetaEdit+. If you choose to terminate the
operation, please note that the operation is left half-finished and it is not
recommended to commit the current transaction unless you are completely sure
that data integrity was not affected. Also please note that choosing Exit
MetaEdit+ will initiate an emergency exit procedure which will automatically
discard the changes made during the current transaction.
Whenever an error dialog is opened, MetaEdit+ will write a
trace to the meplus0.err file in the current working directory; please include
that file when reporting the problem to MetaCase.
If multiple error dialogs continue to open a few seconds
apart, the problem is most likely an error in displaying the contents of a
window. Minimize the application windows, Terminate the error dialogs, and
restore the windows one at a time to find the offending window. Minimize that
window again, choose Close from the operating system pop-up menu for the
minimized window, and Terminate any error dialogs.
If MetaEdit+ hangs during an operation other than
generation, the user can interrupt processing of the MetaEdit+ program itself by
pressing
F8, which will open an error dialog as above. In those cases
when pressing
F8 does not help or MetaEdit+ encounters an unrecoverable
problem, an Emergency Evaluator (
Figure
2–3) can be launched by pressing
Shift+F8.

Figure 2–3. Emergency Evaluator.
In the Emergency
Evaluator the following operations are available by typing the respective
command and pressing ESC:
 | restore:
Releases and refreshes any MetaEdit+ windows that may have
frozen. |
 | exit:
Exits MetaEdit+ cleanly, losing changes made during the current
transaction. |
 | quit:
Exits MetaEdit+, losing changes and leaving logged-in users needing
reconstruct. |
 | kill:
Same as above but also leaves the open I/O streams
uncommitted. |
If your MetaEdit+ license
includes the API features, the following are also available:
 | api:
Starts the MetaEdit+ API on the default port on localhost to provide API access
to the design
data |
 | graphs:
Dumps all graphs to an XML export file,
emergencyDumpGraphs.mxm |
 | types:
Dumps all types to an XML export file,
emergencyDumpTypes.mxt |
 | extras:
Dumps generators and library symbols to emergencyDump
directory |
Any valid command line parameter
sequence is also supported with the API: see the ‘MetaEdit+ Workbench
User’s Guide’ for available command line parameters and formatting
(as for internal...execute in
MERL).
Please note that the Emergency Evaluator is provided only
as the last line of defense in those cases where work cannot be continued, or
only at the risk of repository corruption. The evaluator provides minimal means
for saving the current work and closing MetaEdit+ – it does not provide
tools for debugging or repairing the underlying problem.
 | Remember,
frequent backups are the best way to ensure error recovery with minimal loss of
work. |