[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bgsdev::phigs

Title:Digital PHIGS
Notice:V4.1 SSB kits -> 1000.88
Moderator:FREBRD::POEGEL
Created:Mon Feb 03 1986
Last Modified:Mon May 26 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1632
Total number of notes:6504

1630.0. "%DECPHIGS-F-ERROR_NEG_2400 " by PRSSOS::AMAURY (Karl policy et lise plan) Wed Feb 26 1997 11:28

	A customer submits a problem with the #maximum of workstations
open simultaneously .
	In fact he starts his application open phigs and then opens 
21 Workstations type 233 
	This is the maximum , because the next open give the 
fatal message:


%DECPHIGS-F-ERROR_NEG_2400, Internal PHIGS error: Memory allocation failed.
%PHIGS-F-PANIC occured.
    module   : 'com__main.c                     '
    procedure: 'configure_for_kernel            '
    status   : 0x027DCB54  "DataManager or WorkstationHandler still
installed."

 VAXGFX$SIGNAL - #41798484

	Is there a limitation in the #maximum of workstations ?

	I append in the next reply a part of the customer's code
	Built the code 
----------------------------------------------------
#!/bin/csh
# Compilation et edition des liens d'un programme Motif / DECPHIGS
#
setenv LOADLIBS "-call_shared -lPHIGSC -lMrm -lXm -lXt -lX11"
cc -o ${1} -g ${1}.c ${LOADLIBS}
----------------------------------------------------                              
and the following environnement (not useful) but used by the customer
------------------------------------------------------------
setenv PHIGSuse_standart_color_map RGB_DEFAULT_MAP
xstdcmap -default
------------------------------------------------------------

	tha application start and display a window . In the window
clicks on the button in the menubar referenced as "Nouvelle WS"
This action create a new workstation (Type 233) and repeat 21 times
to reproduce the problem. 
                   
	For info my customer 

        AlphaStation  255
        OSF 3.2D
        Open3D 3.3
        Phigs 2.6 !!!!!
	
	But I've reproduced the same problem at Home !
	AlphaStation  200 
	Digital Unix 4.0 
	Open3d 4.0
	Phigs 5.0	


	thanks for any comments 
	Regards 
	- Michel -

    
T.RTitleUserPersonal
Name
DateLines
1630.1codePRSSOS::AMAURYKarl policy et lise planWed Feb 26 1997 11:29342
/* fichier source ph_40.c :
  ---------------------- */

/* this code uses the PHIGS WorkStation 233 and create N WS */
/* 
You can ignore the following message
  " X Toolkit Warning:
      Name: menubar
      Class: XmRowColumn
      Attempt to add wrong type child to a homogeneous RowColumn widget  "

   qui peuvent etre ignores. */

#include <stdio.h>
#include <stdlib.h>

#include <PHIGS/phigs.h>
#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/MainW.h>
#include <Xm/RowColumn.h>
#include <Xm/CascadeB.h>
#include <Xm/BulletinB.h>
#include <Xm/PushB.h>
#include <Xm/PushBG.h>
#include <Mrm/MrmAppl.h>

/* Definitions pour titres et valeurs maximales */

#define PROGRAM_NAME  "Test colormap. WS n� %d"
#define PROGRAM_CLASS "TST_PHIGS"
#define ARG_MAX       10           /* Pour XtSetArg                           */
#define MAX_WS        33           /* Pour nombre maximal de WS PHIGS + 1     */
                                   /* L'index 0 utilise par le lanceur qui    */
                                   /* n'a pas de poste PHIGS associe          */

/* Part of code used by the customer to manipulate ws_id , to use it
and reuse after a close WS 
   ws_tab[i] == 0 ws free , ws_tab[i] == 1 ws used */

static Pint  ws_tab[MAX_WS - 1];        /* Workstation table                       */
static Pint  ws_tab_first[MAX_WS - 1];  /* Workstation table for open              */
static Pint  ws_tab_expose[MAX_WS - 1]; /* Workstation table for expose            */
static Pint  ws_id;                     /* Workstation identifier                  */
Pchar        conid[80];                 /* Connection identifier                   */
Pchar        wstype[80];                /* Workstation type                        */

static char  conid_str[]  = "PHIGSconid";  /* Pour setenv avant l'ouverture WS */
static char  wstype_str[] = "PHIGSwstype"; /* Pour setenv avant l'ouverture WS */

Arg          arg_list[ARG_MAX];         /* Pour XtSetArg                        */
Cardinal     arg_count;                 /* idem                                 */
Display      *display;                  /* X Display pointer                    */
Window       window;                    /* Window Id pour ouverture PHIGS       */
Widget       top_phigs_wid[MAX_WS];     /* Tableau des Widgets toplevel pour    */
                                        /* lanceur (index 0) et les WS PHIGS    */

Widget       main_wid[MAX_WS];          /* Tableau des Widgets MainWindow         */
Widget       phigs_wid[MAX_WS];         /* Tableau des Widgets BulletinBoard      */
Widget       menu_bar_wid[MAX_WS];      /* Tableau des Widgets MenuBar            */
Widget       exit_button_wid[MAX_WS];   /* Tableau des Widgets CascadeButton Exit */
Widget       phigs_output_wid[MAX_WS];  /* Tableau des Widgets PHIGS 233          */
Widget       exit_all, mem_size;        /* 2 CascadeButtons supplementaires pour  */
                                        /* lanceur: exit program et info taille   */
                                        /* memoire process                        */

XmString     label;                     /* Pour libelle des CascadeButtons        */
XtAppContext app_context;               /* Application Context                    */

/* Prototypes locales */

static void TstOuvrePhigsWs (Pint);
static void exit_cbk        (Widget, Pint, XmAnyCallbackStruct *);
static void mem_size_cbk    (Widget, Pint, XmAnyCallbackStruct *);
static void exit_all_cbk    (Widget, Pint, XmAnyCallbackStruct *);
static void expose_hnd      (Widget, Pint, XExposeEvent *);

/*  Exit from PHIGS */ 

static void exit_all_cbk (Widget widget, Pint ws_id, XmAnyCallbackStruct *data)
{
/*code removed*/
}


/* Write some information in a DECterm */

static void mem_size_cbk (Widget widget, Pint tag, XmAnyCallbackStruct *data)
{
/*code removed*/
}

/* Close Ws PHIGS. */

static void exit_cbk (Widget widget, Pint ws_id, XmAnyCallbackStruct *data)
{
/*code removed*/ 
}

/* Create a New WS . Function called after a click in the Push Button
   "Nouvelle WS". */

static void action_cbk (Widget widget, int tag, XmAnyCallbackStruct *data)
{

int found, i;

  found = 0;
  for (i = 0; i < MAX_WS - 1; i++)     /* On cherche un ID libre        */
  {
    if (ws_tab[i] == 0)
    {
      ws_tab[i] = 1;
      ws_id = i + 1;                   /* OK. i + 1 est le numero de WS */
      found = 1;
      break;
    }
  }
  if (found == 0)
  {
    printf ("Nombre de WS maximum atteint\n");
    return;
  }
  TstOuvrePhigsWs (ws_id);
}

/* Toplevel ---> Main Window
   Main Window ----> MenuBar ----> CascadeButton "Exit"
	|----------> WorkingArea -----> Id for widget PHIGS 
*/

static void expose_hnd (Widget widget, Pint ws_id, XExposeEvent *event)
{

Pint           error_ind, color_model, actual_size;
static Pint    tab_index[128];
static Pintlst indices = {128, tab_index};
Ppoint         rectangle[5*256];
Pfloat         x, y;
Pint           i, j, k, m;
Pcobundl       rep;
static int     first_time = 0;
Pint           rand, hexa_wstype;
Pescaperecord  out_esc_data, in_esc_data;
Pint           in_data_size;
Pint           out_data_size;
Pchar          **x_display_id;
Plong          *x_window_id;

  if (ws_tab_first[ws_id - 1] == 0)
  {

/* Le PHIGSconid */

    sprintf (conid, "%ld", phigs_wid[ws_id]);
    setenv (conid_str, conid, 1);

/* Le PHIGSwstype = "001000E9" 
		16 colors and type 233 */

    hexa_wstype = 0x001000e9;
    sprintf (wstype, "%ld", hexa_wstype);

    setenv (wstype_str, wstype, 1);

    if (first_time == 0)        
    {
      popenphigs (0, 0);
      first_time = 1;
    }
    popenws (ws_id, conid, hexa_wstype);

    /* Inquire the X display id and X window id */
    in_esc_data.nints = 1;
    in_esc_data.nfloats = 0;
    in_esc_data.nstrings = 0;
    in_esc_data.int_array = &ws_id;
    in_esc_data.float_array = (Pfloat *) NULL;
    in_esc_data.str_len_array = (Pint *) NULL;
    in_esc_data.str_ptr_array = (Pchar **) NULL;
    in_esc_data.npointers = 0;
    in_esc_data.ptr_ptr_array = (Pchar **) NULL;
    in_esc_data.nlongs = 0;
    in_esc_data.long_array = (Plong *) NULL;
    in_data_size = sizeof(Pescaperecord);

    out_esc_data.nints = 0;
    out_esc_data.nfloats = 0;
    out_esc_data.nstrings = 0;
    out_esc_data.int_array = (Pint *) NULL;
    out_esc_data.float_array = (Pfloat *) NULL;
    out_esc_data.str_len_array = (Pint *) NULL;
    out_esc_data.str_ptr_array = (Pchar **) NULL;
    out_esc_data.npointers = 1;
    out_esc_data.ptr_ptr_array = (Pchar **)(&display);
    out_esc_data.nlongs = 1;
    out_esc_data.long_array = (Plong *)(&window);
    out_data_size = sizeof(Pescaperecord);

    pescape (PPESC_INQ_WINDOW_IDS, &in_esc_data, in_data_size,
             &out_esc_data, &out_data_size);

    phigs_output_wid[ws_id] = XtWindowToWidget (display, window);
    XtAddEventHandler (phigs_output_wid[ws_id], ExposureMask | StructureNotifyMask, False,
                       expose_hnd, (XtPointer)ws_id);

    ws_tab_expose[ws_id - 1] = 0;
    ws_tab_first[ws_id - 1]  = 1;
  }
/* Open structure and draw 15 rectangles */

  if (ws_tab_expose[ws_id - 1] == 0)
  {
    ws_tab_expose[ws_id - 1] = 1;
    popenstruct (ws_id);			
      psetintstyle (PSOLID); 			
      rand = random () % 128 + 1;
      printf ("WS_ID : %d Facteur de repetition : %d\n", ws_id, rand);
      for (m = 0; m < rand; m++)
      {
        y = 0.0;
        for (i = 0; i < 3; i++)
        {
          x = 0.0;
          for (j = 0; j < 5; j++)
          {
            rectangle[0].x = rectangle[3].x = rectangle[4].x = x;
            rectangle[1].x = rectangle[2].x = x + 0.2;
            rectangle[0].y = rectangle[1].y = rectangle[4].y = y;
            rectangle[2].y = rectangle[3].y = y + 0.2;
            k = i * 5 + j + 1;
            psetintcolourind (k);
            pfillarea (4, rectangle);
            psetlinewidth (2.0);
            ppolyline (5, rectangle);
            x += 0.2;
          } 
          y += 0.3;
        } 
      }
    pclosestruct ();
    ppoststruct (ws_id, 1, 1.0);
    pupdatews (ws_id, PPERFORM);
  }
}

static void TstOuvrePhigsWs (Pint ws_id)
{

XmString label;
char     titre[80];

  if (ws_tab_first[ws_id - 1] == 0)
  {
    arg_count = 0;
    XtSetArg (arg_list[arg_count], XtNallowShellResize, TRUE); arg_count++;
    XtSetArg (arg_list[arg_count], XmNwidth,  (Dimension)300); arg_count++;
    XtSetArg (arg_list[arg_count], XmNheight, (Dimension)300); arg_count++;
    sprintf (titre, PROGRAM_NAME, ws_id);
    top_phigs_wid[ws_id] = XtAppCreateShell (titre, PROGRAM_CLASS,
                                             topLevelShellWidgetClass, display,
                                             arg_list, arg_count);
    arg_count = 0;
    main_wid[ws_id] = XmCreateMainWindow (top_phigs_wid[ws_id], "main",
                                          arg_list, arg_count);
    XtManageChild (main_wid[ws_id]);
    arg_count = 0;
    menu_bar_wid[ws_id] = XmCreateMenuBar (main_wid[ws_id], "menu_bar",
                                           arg_list, arg_count);
    XtManageChild (menu_bar_wid[ws_id]);
    label = XmStringCreateLtoR ("Exit", "");
    arg_count = 0;
    XtSetArg (arg_list[arg_count], XmNlabelString, label); arg_count++;
    exit_button_wid[ws_id] = XmCreatePushButton (menu_bar_wid[ws_id], "exitbutton",
                                                 arg_list, arg_count);
    XmStringFree (label);
    XtAddCallback (exit_button_wid[ws_id], XmNactivateCallback, exit_cbk, ws_id);
    XtManageChild (exit_button_wid[ws_id]);
    arg_count = 0;
    XtSetArg (arg_list[arg_count], XmNmarginWidth, 0); arg_count++;
    XtSetArg (arg_list[arg_count], XmNmarginHeight, 0); arg_count++;
    phigs_wid[ws_id] = XmCreateBulletinBoard (main_wid[ws_id], "phigs",
                                              arg_list, arg_count);
    XtManageChild (phigs_wid[ws_id]);
    XmMainWindowSetAreas (main_wid[ws_id], menu_bar_wid[ws_id],
                          NULL, NULL, NULL, phigs_wid[ws_id]);
    XtAddEventHandler (phigs_wid[ws_id], ExposureMask, False,
                       expose_hnd, (XtPointer)ws_id);
  }

  XtRealizeWidget (top_phigs_wid[ws_id]);
}

/* Initialisation du lanceur */

main (int argc, char *argv[])
{

int    min_cmaps, max_cmaps;
Screen *ecran;

  top_phigs_wid[0] = XtVaAppInitialize (&app_context, PROGRAM_CLASS, NULL, 0,
                                        &argc, argv, NULL, NULL);
  display = XtDisplay (top_phigs_wid[0]);
  main_wid[0] = XtVaCreateManagedWidget ("main_w", xmMainWindowWidgetClass,
                                         top_phigs_wid[0], NULL);
 
  menu_bar_wid[0] = XmCreateMenuBar (main_wid[0], "menubar", NULL, 0);
  label = XmStringCreateLtoR ("Nouvelle WS", "");
  arg_count = 0;
  XtSetArg (arg_list[arg_count], XmNlabelString, label); arg_count++;
  exit_button_wid[0] = XmCreateCascadeButton (menu_bar_wid[0], "actionbutton",
                                           arg_list, arg_count);
  XmStringFree (label);
  XtAddCallback (exit_button_wid[0], XmNactivateCallback, action_cbk, 0);
  XtManageChild (exit_button_wid[0]);

  label = XmStringCreateLtoR ("Taille Process", "");
  arg_count = 0;
  XtSetArg (arg_list[arg_count], XmNlabelString, label); arg_count++;
  mem_size = XmCreateCascadeButton (menu_bar_wid[0], "memsize",
                                 arg_list, arg_count);
  XmStringFree (label);
  XtAddCallback (mem_size, XmNactivateCallback, mem_size_cbk, 0);
  XtManageChild (mem_size);

  label = XmStringCreateLtoR ("Exit Test", "");
  arg_count = 0;
  XtSetArg (arg_list[arg_count], XmNlabelString, label); arg_count++;
  exit_all = XmCreateCascadeButton (menu_bar_wid[0], "exitall",
                                 arg_list, arg_count);
  XmStringFree (label);
  XtAddCallback (exit_all, XmNactivateCallback, exit_all_cbk, 0);
  XtManageChild (exit_all);

  XtManageChild (menu_bar_wid[0]);
  XtRealizeWidget (top_phigs_wid[0]);

  XtAppMainLoop (app_context);
}
    
1630.2BGSDEV::POEGELWed Feb 26 1997 13:1018
>>        <<< Note 1630.0 by PRSSOS::AMAURY "Karl policy et lise plan" >>>
>>                        -< %DECPHIGS-F-ERROR_NEG_2400  >-


>>%DECPHIGS-F-ERROR_NEG_2400, Internal PHIGS error: Memory allocation failed.
>>%PHIGS-F-PANIC occured.

So what is the problem?   PHIGS ran out of virtual memory and told you
about it.  Have you tried increasing your memory limits?  The secondary
error is just because of when the allocation failed.
I wouldn't recommend creating that many workstation if you can help it.
Workstations consume alot of memory for internal data structures and also
take a considerable amount of computes to initialize.

Garry


1630.3PRSSOS::AMAURYKarl policy et lise planThu Feb 27 1997 08:5031

	Hi Garry ,

	Thanks for your reply .

	
	First I agree with your remark about the number of workstations
" I wouldn't recommend creating that many workstation if you can help it "

	But in other hand I've some real remarks from the customer

	- the Phigs-specific message -2400 Internal PHIGS error: 
Memory allocation failed is described in the documentation with
the following user action : Submit an SPR .

	- This error code is a FATAL message . There is no way to trap
this condition through a status = popenws (ws_id,....) . As this
is a fatal message there is no return status .

	- In final , customer needs to be inform (in the application
it self) that PHIGS can't allocate any additionnal Workstations.
Instead of crash the application , have a real message to inform
it that no more memory ressources are available ?

	Is this utopian .
	Thanks for your reply

	- Michel -

    
1630.4check against "INQUIRE PHIGS FACILITIES"GYPOS3::EIBLReinhard Eibl @FKR, DTN 865-4027Fri Feb 28 1997 04:319
Michel,

i remember a long time ago in GKS or PHIGS there have been limitations to
the maximum number of simultaneously open workstations. To avoid running
over the limits there is an inquiry function: INQUIRE PHIGS FACILITIES
one of the return values is: maximum number of simultaneously open workstations
Let your customer check this value.

/Reinhard
1630.5BGSDEV::POEGELFri Feb 28 1997 08:5219
>>     <<< Note 1630.4 by GYPOS3::EIBL "Reinhard Eibl @FKR, DTN 865-4027" >>>
>>                 -< check against "INQUIRE PHIGS FACILITIES" >-

Inquire PHIGS facilities won't help too much as it should return a
the number 30.

This all comes down to running out of memory.  There isn't any good way
to recover from the error.  There are cases where running out of memory
will just ACCVIO/core dump and that's because there isn't even enough
memory left to write out an error message.  We made the code as robus as
we can to give an error message when it can.

As for the documentation's suggestion to file an SPR in response to
that error message,  that's probably not too helpful.  The real solution
is to expand the virtual memory limits of the system.

Garry