Executing a Simulation

Problem

op_runsim cannot construct the simulation repository.

Solution

  • Check bind_err File – Check for linker errors in the bind_err file in your home directory under op_admin/tmp.

  • Check for Missing Object Files – op_runsim detects missing object files before linking and issues an error message, then aborts the simulation. Compile the necessary files in the Process Editor or with op_mko, then try running the simulation again. Alternatively, execute op_runsim with the -c flag, which forces the program to recompile all files referenced by the network model before rebuilding the repository.

  • Check for Unexported Variables or Functions – If you are using code repositories you have created (and have specified that op_runsim use those repositories by listing them in the “repositories” attribute), you must declare variables and functions with DLLEXPORT. Under Windows, you must also use IMPORT_GLOBAL to import variables that have been declared in another library.

  • Check for Undefined Symbols – Because of the way repositories are built, the linker does not detect undefined procedure symbols when building the repository (it does, however, detect undefined variables). Instead, one of two things can occur.

    • First, the Simulation Kernel can report being unable to find symbols corresponding to a process model or pipeline stage. Sometimes this occurs when the name of the pipeline stage function doesn't match the name of its object file. This is often due to a misspelling. For example, the pipeline stage model is “pipeline.ps.o” but the function is called “pipe_line()”. Verify the names match, then recompile the pipeline model.
    • Second, if a code module calls an external function which is not defined, the error is reported by the run-time loader (such as “ld.so.1” on Linux). This type of error occurs when the simulation repository is loaded. In this case, the simulation aborts. Be sure the necessary external code files are declared by the network and/or process models.
  • Search for Undefined Symbols in C Files – If the location of a misspelled symbol reference is unknown, it can be determined by combing through C files. In Linux, this can be done with the grep command. For instance, to search through all process models within a user’s op_models directory for the misspelled symbol “sgrt” (should be “sqrt”, for the math-library’s square-root function), use the following command:

      grep sgrt *.pr.c
    

    Under Windows, substitute “find” for “grep” and use double-quotes around the search string, as in the following example:

      find “sgrt” *.pr.c
    

    Note that this type of command may have to be issued several times, or within a longer argument list, if there is more than one active model directory. After the suspect lines in the process model C files are discovered, these files can be read into a text editor and scrolled to the discovered lines, so that the surrounding state transition diagram state can be determined. The corresponding process models can then be edited within the Process Editor, to fix the code in the affected states and recompile the process models. You can use a similar method to correct errors in pipeline (.ps.c or .ps.cpp) and external (ex.c or ex.cpp) source code.

  • Check op_admin/tmp Directory – If no bind_err editing pad appears, leave Modeler and change directories to the temporary file directory used by Modeler (<HOME>/op_admin/tmp). Look for the bind_err file, and if found, list it or edit it using a text editor.

  • Test for a Memory Problem – If no bind_err file is present, if a bind_err file does exist but is empty, or if a linker error indicates “out of memory”, the linker may have failed due to a shortage of virtual memory. Contact your system administrator to determine how much memory remains available while you run Modeler. If less than 5 MB of virtual memory is available (i.e., less than “5000k”), there is a possibility that this is causing the problem. Consider increasing the amount of available virtual memory and/or workstation RAM.

  • Check Temporary Disk Space – Another potential cause of a missing or empty bind_err file, or a cryptic error from the C compiler, archiver, or linker, is a lack of temporary disk space. All three of the involved programs use either the /tmp directory (under Linux) or the %TEMP% directory (under Windows) to store temporary files. Depending on the configuration of the host workstation, this directory may be a link to another directory on another filesystem. If the filesystem containing the system temporary directory has less than 4 MB of free space, the success of the archive and bind operation could be affected. In Linux, issue the following commands to determine the amount of space under /tmp:

    cd /tmp ; df .
    

    The df program will issue several lines of information regarding the filesystem containing /tmp; the amount of available disk space appears under the “avail” column (this value is stated in kilobytes or 512-byte blocks, as indicated by the output banner). If the amount of available temporary space is less than 4 MB, contact your system administrator about increasing this space by removing unnecessary files or by setting up a link to another filesystem with more free space.

    In Windows, determine the system temporary directory and issue the dir command to determine the amount of available disk space on its drive.

Problem

An executing simulation eventually freezes, displaying a fixed message in the Message Display, and it makes no further progress.

Solution

  • Check Attribute Definitions – If the displayed message is “Loading Phase / Installing modules and connections.”, the simulation is probably seeking environment attribute assignments interactively in the shell that spawned Modeler. To continue the simulation, move the Modeler window out of the way, bring the shell window to the foreground, and enter a value for each requested attribute. A typical attribute assignment prompting message is shown below:

      	--------------Unset Environment Attribute----------------
      	    * top.cct_net.f_1.gen.interarrival args: <string>
      	    * Desc:
      	    * Press <return> to select default: 1.0
    
      	    Enter value> 2.0
      	---------------------------------------------------------
    

    The simulation is seeking a value for an attribute value because it has not been properly defined in the models or the simulation sequence. In the context of this manual, the most probable cause for undefined attribute values is the omission of an assignment for a attribute in a simulation set object. Carefully compare the attribute assignment in your model against the specifications of the tutorial.

  • Terminate Simulation (due to Internal Logic Problem) – If the message displayed by the frozen simulation is not as described in the last hint, there is probably a deeper problem with the simulation internal logic, and the simulation should be terminated. This can be accomplished by killing the Modeler program using the window system action menu that is accessible when the cursor is placed over the Modeler window header strip and the appropriate mouse switch is pressed (typically, the right mouse switch). If a simulation freezes for an extended period of time, it may be:

    • stuck in an infinite or extremely large loop set up by model C code or by the configuration of state transition diagram states and transitions
    • executing chaotically after memory has been corrupted
    • using a bad attribute value that can cause run-away execution (for instance, a packet source with its interarrival time set to 0, which will cause a never-ending stream of packets at time 0.)

    The scenarios described above should be investigated in the context of the current tutorial models. One way to narrow in on the error is via the “Simulation Debugger (ODB)”. In brief, ODB is accessed by running the simulation with the “debug” preference set to “true” (this can be done in the GUI, but the resulting ODB interactive environment is set up in the shell window that spawned the modeler program).

Problem

The simulation stops unexpectedly and prints one of the following error messages:

program abort -- bus error
program abort -- floating point exception
program abort -- segmentation violation

Solution

  • Run op_vuerr Program – The simulation has encountered a fatal internal error, probably embedded in the newly-entered tutorial C code. A quick understanding of the location of the error can be achieved by exiting Modeler, and executing the op_vuerr program. This utility extracts and prints the function call stack corresponding to the last error that was logged by a Modeler program (in this case, a simulation). Example output of op_vuerr is shown on the next page.

Figure 572: Example output from op_vuerr

extracted the following messages from ‘err_log’ file:
<<< Program Fault >>>
*    Time:       Thu Mar 21 11:57:53 1996
*    Program:    op_runsim (Version 3.0.A)
*    Package:    process (router_mgmt) at module (top.hub_net.hub.Mgmt)
*    Function:   vos_ai_manager (int_type, src_handle)
*    Error:      program abort -- segmentation violation
               T (21.1947), EV (108), MOD (top.hub_net.hub.Mgmt), PROC (router_mgmt)

* 	Function call stack: (builds down)
	------------------------------------------------------------
	Call   Block
	Count  Line#  Function
	------------------------------------------------------------
	0)          1    267  main (argc, argv, envp)
	1)          1    204  sim_init (argc, argv, envp)
	2)          1    363  sim_ev_loop ()
	3)         88    381  sim_obj_qps_intrpt (simev_ptr)
	4)         88      9  router_mgmt () [OAM Processing enter execs]
	............................................................
	5)          1    435  *vos_signal_default_handler (sig)
	6)          1    419  vos_ai_manager (int_type, src_handle)
	7)          1    200  Vos_Error_Print (level, package, error0, error1, error2)
	------------------------------------------------------------

In this example, the simulation has encountered a segmentation fault. By looking at the function immediately preceding the dotted separator in the function call stack, it can be determined that the fault occurred in the router_mgmt() function, which corresponds to the router_mgmt process model. The error occurred during the 88th invocation of the process model and in enter executives of the state OAM Processing in the block of code starting on line 9. Other information that can be obtained is that the fault occurred at time 21.1947 seconds into the simulation, during event 108, at the Mgmt module within node hub in the hub_net subnet. This information can be very useful in tracking down the source of the fault within the Simulation Debugger (ODB).

In many cases, simple transcription errors in process model code can cause a simulation program abort which can be readily tracked down via op_vuerr. In other cases, the abort occurs at a different location in process model code, and cannot be as readily mapped back to the error. In these cases, ODB can provide insight into the dynamic operation of the simulation prior to the fault.

Problem

When running a simulation model, the simulation halts and the following error message is issued: Program Abort: no true transitions from state <state_name>.

Solution

  • Check Transition Statement Syntax – The process model indicated in the error message has received an interrupt while located in the state whose name is given. However, none of the transitions leading out of that state have associated condition statements that evaluate “true” at the current time. In the context of this manual, this error indicates that one of the transition condition statements, or possibly one of the statements within an executive block has been mistyped. A common cause of this error is the entry of one “=” instead of the C operator “==”. It is also possible that a transition has been omitted. Check the model against the manual's descriptions for accuracy.

Problem

When running a simulation model, the simulation halts and the following error message is issued: Program Abort: multiple true transitions from state <state_name>.

Solution

  • Check Transition Statement Syntax – The process model indicated in the error message has received an interrupt while located in the state whose name is given. However, more than one of the transitions leading out of that state have associated condition statements that evaluate “true” at the current time. In the context of this manual, this error indicates that one of the transition condition statements, or possibly one of the statements within an executive block has been mistyped. A common cause of this error is the entry of one “=” instead of the C operator “==”. Check the model against the manual's descriptions for accuracy.