[PolyORB-users] STORAGE_ERROR in polyorb.orb

Manuel Giollo eva01iol at hotmail.com
Thu Nov 5 13:23:46 CET 2009





Actually I'm taking lesson at the university, so I can't tell you what is the reason for the exception in s-intman.adb file at line 142, and I can't run the 'ulimit" command (this evening I will check all you asked for).
Anyway, I'm working in ubuntu 8.4 (virtualized inside win xp with virtual box tool), with Gnat GPL 2009 (20090519) and PolyORB GPL 2009 (20090519).
The polyorb.conf is empty (since the tasking parameter don't worked, I've removed them too), so PolyORB run with default parameters (I know, I'm really a newbie ;-) ).


The system use the client-server architecture, and moreover the java server application is a pure server (that's why I've chosen for asynch call from the client to the server). Basically the client create a single communication channel CC (see below for the code), and it read some configuration file that describe the F1 competition, and it dinamically create N thread (N=number of car in the competition), so there are no partition in the application; when all of them are built and ready in the startng grid, the competition begin, and every M meters traveled in the road each thread send its state using CC.
This is the code of the communication module (with the protected resource that I mentioned before, for solving the problem):

f1_system-remote_communication.ads

with F1_System.Communication;
with F1_System;

--with CORBA.ORB;

with PolyORB.Setup.Client;
--pragma Warnings (Off, PolyORB.Setup.Client);


package F1_System.Remote_Communication is

   --the variable enable/disable the remote communication; setted to false whenever there is a connection problem
   Allow_Remote_Communication : Boolean:=True;

   --The function bind the Client_Connection variable to the remote object
   --IOR: the location where the remote object is
   --Return true if the system was able to connect to the remote object
   function Connect(IOR : in String)
                    return Boolean;

   --The function inform the control system about the configuration of the competition
   --Configuration: the details of the competition
   --Return true if the communication was successfully performed
   function Send_Configuration(Configuration : F1_System.F1_Configuration)
                               return boolean;

   --The function notify to the control system all the changes in the state of
   --a car due to the race
   --Car_Name: the name of the car whom the information are talking about
   --State: the acutal state of the car
   --Terminating: inform if this is the last communication from the car
   --Return true if the communication was successfully performed
   function Send_Car_State(Car_Name : string;
                           State : F1_System.Car_Actual_State;
                           Terminating : Boolean)
                           return boolean;

   --The function send a text to the control system; it is usefull to send general message
   --Message: the text to send
   function Send_Message(Message : String)
                         return boolean;

private

   --A PR used to avoid race condition when calling the remote object
   protected Communication_Manager is
      --ask the possibility to invoke the remote procedure
      entry Ask;
      --notify that the remote call is done
      procedure Free;
   private
      --the PR is open
      Is_Open:Boolean:=True;
   end Communication_Manager;


   --The reference to the corba type useful to manage remote call
   Client_Connection : F1_System.Communication.Ref;

end F1_System.Remote_Communication;







f1_system-remote_communication.adb

with Ada.Text_IO;
use Ada.Text_IO;

with CORBA.ORB;

package body F1_System.Remote_Communication is

   --The function check if the package variable Client_Connection is binded to
   --the remote object
   --Return true if the variable is binded
   function Is_Connected return Boolean is
   begin
      if F1_System.Communication.Is_Nil(Client_Connection) then
         return False;
      end if;
      return True;
   end Is_COnnected;

   --The procedure print some useful information necessary to understand problem
   --related to the remote method calling
   --Problem: the exception
   procedure Print_Exception(Memb : CORBA.System_Exception_Members) is
   begin
      Put ("received exception transient, minor");
      Put (CORBA.Unsigned_Long'Image (Memb.Minor));
      Put (", completion status: ");
      Put_Line (CORBA.Completion_Status'Image (Memb.Completed));
   end Print_Exception;


   function Connect(IOR : in String)
                    return Boolean is
   begin
      if Allow_Remote_Communication=False then
         return True;
      end if;

      CORBA.ORB.Initialize ("ORB");

      --Getting the CORBA.Object; as side effect, the package variable contain
      --the reference to the remote bject
      CORBA.ORB.String_To_Object(CORBA.To_CORBA_String (IOR), Client_Connection);
      return Is_Connected;

   exception
         --Here we print some information in case of problem
      when E : CORBA.Transient =>
         declare
            Memb :  CORBA.System_Exception_Members;
         begin
            CORBA.Get_Members (E, Memb);
            Print_Exception(Memb);
            return False;
         end;
      when EO : others =>
         begin
            --disable the remote communication
            Allow_Remote_Communication:=False;
            return False;
         end;
   end Connect;


   function Send_Configuration(Configuration : F1_System.F1_Configuration)
                               return boolean is
   begin
      if Allow_Remote_Communication=False then
         return True;
      end if;
      --first we chech if there exist a connection to a remote object, then we send the information
      if Is_Connected then
         Communication_Manager.Ask;
         F1_System.Communication.Send_Configuration(Client_Connection, Configuration);
         Communication_Manager.Free;
         return True;
      end if;

      return False;

   exception
      --Here we print some information in case of problem
      when E : CORBA.Transient =>
         declare
            Memb :  CORBA.System_Exception_Members;
         begin
            CORBA.Get_Members (E, Memb);
            Print_Exception(Memb);
            Communication_Manager.Free;
            return False;
         end;
      when EO : others =>
         begin
            --free the PR
            Communication_Manager.Free;
            --disable the remote communication
            Allow_Remote_Communication:=False;
            return False;
         end;
   end Send_Configuration;


   function Send_Car_State(Car_Name : string;
                           State : F1_System.Car_Actual_State;
                          Terminating : Boolean)
                           return boolean is
   begin
      if Allow_Remote_Communication=False then
         return True;
      end if;
      --first we chech if there exist a connection to a remote object, then we send the information
      if Is_Connected then
         Communication_Manager.Ask;<--if I remove this (the protected resource), the exception is raised
         F1_System.Communication.Send_Car_State(Client_Connection,
                                                CORBA.To_CORBA_String(Car_Name),
                                                State,
                                                CORBA.Boolean(Terminating));
         Communication_Manager.Free;<--if I remove this, the exception is raised
         return True;
      end if;
      return False;

   exception
      --Here we print some information in case of problem
      when E : CORBA.Transient =>
         declare
            Memb :  CORBA.System_Exception_Members;
         begin
            CORBA.Get_Members (E, Memb);
            Print_Exception(Memb);
            Communication_Manager.Free;
            return False;
         end;
      when EO : others =>
         begin
            --free the PR
            Communication_Manager.Free;
            --disable the remote communication
            Allow_Remote_Communication:=False;
            return False;
         end;

   end Send_Car_State;


   function Send_Message(Message : String)
                         return boolean is
   begin
      if Allow_Remote_Communication=False then
         return True;
      end if;
      --first we chech if there exist a connection to a remote object, then we send the information
      if Is_Connected then
         Communication_Manager.Ask;
         F1_System.Communication.Send_Message(Client_Connection, CORBA.To_CORBA_String(Message));
         Communication_Manager.Free;
         return True;
      end if;

      return False;

   exception
      --Here we print some information in case of problem
      when E : CORBA.Transient =>
         declare
            Memb :  CORBA.System_Exception_Members;
         begin
            CORBA.Get_Members (E, Memb);
            Print_Exception(Memb);
            Communication_Manager.Free;
            return False;
         end;
      when EO : others =>
         begin
            --free the PR
            Communication_Manager.Free;
            --disable the remote communication
            Allow_Remote_Communication:=False;
            return False;
         end;

   end Send_Message;

   protected body Communication_Manager is

      entry Ask when Is_Open=True is
      begin
         --avoiding to each other the possibility to gain the RP
         Is_Open:=False;
      end Ask;

      procedure Free is
      begin
         --opening the guard
         Is_Open:=True;
      end Free;

   end Communication_Manager;

end F1_System.Remote_Communication;




All the car invoke the Send_Car_State method to be able to communicate their own state (and assuming that the communication to the server is already established). That's all, I hope to have been clear enough.

Completely out of topic, is http://www.adacore.com/wp-content/files/auto_update/polyorb-docs/polyorb_ug.html/ the only documentation for the library? I found it a little poor..
Thanks
                                        Manuel Giollo

 		 	   		  
_________________________________________________________________
Messenger su ogni PC, prova la Web Bar!
http://www.messenger.it/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/polyorb-users/attachments/20091105/aa6a35bf/attachment-0001.htm 


More information about the PolyORB-users mailing list