I've been getting a crash in my app so I went back and tried some of the demos with both 1.2b. I'm building on Mac Sierra and have tried both GNAT 2016 and 2017 and get the following when I run the adaedit demo. It happens with both Firefox and Chrome.

./adaedit
Gnoga            :1.2b
Application root :/Users/wayne/vendor/new.gnoga/gnoga-beta/
Executable at    :/Users/wayne/vendor/new.gnoga/gnoga-beta/bin/
HTML root        :/Users/wayne/vendor/new.gnoga/gnoga-beta/html/
Upload directory :/Users/wayne/vendor/new.gnoga/gnoga-beta/upload/
Templates root :/Users/wayne/vendor/new.gnoga/gnoga-beta/templates/
/js  at          :/Users/wayne/vendor/new.gnoga/gnoga-beta/js/
/css at          :/Users/wayne/vendor/new.gnoga/gnoga-beta/css/
/img at          :/Users/wayne/vendor/new.gnoga/gnoga-beta/img/
Boot file        :boot_ace.html
HTTP listen on   ::8080
Press Ctrl-C to close server.
2017-10-02 07:49:10.79 : HTTP Server Started
2017-10-02 07:49:15.04 : New long polling connection - ID 1
2017-10-02 07:49:15.17 : Swapping websocket connection  2 <=> 1
2017-10-02 07:49:15.40 : Shutting down long polling connection - 2
2017-10-02 07:50:10.79 : Ping on websocket - 1
2017-10-02 07:50:10.79 : Ping on Finalized - 2
2017-10-02 07:50:10.79 : Deleting connection - 2
2017-10-02 07:50:10.80 : Watchdog error.
2017-10-02 07:50:10.80 : raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Position cursor of Next is bad
Load address: 0x100000000
Call stack traceback locations:
0x10024b4d1 0x100087979 0x1000bf5bd 0x1000bf6a4 0x1000c12dd 0x100225155 0x7fffa4716939 0x7fffa4716885

I tracked it down to a problem in Watchdog_Type in GNOGA.Server.Connection where a connection was getting deleted while iterating through the list. The following from the beta version seems to fix the problem.

   task  body  Watchdog_Typeis
      procedure  Ping (ID      :in  Gnoga.Types.Connection_ID;
                      Deleted :out  Boolean);

      procedure  Ping (ID      :in  Gnoga.Types.Connection_ID;
                      Deleted :out  Boolean)is
         Socket : Socket_Type := Connection_Manager.Connection_Socket (ID);
      begin
         Deleted := False;
         if  Socket.Content.Finalizedthen
            if  Verbose_Outputthen
               Gnoga.Log ("Ping on Finalized -"  & ID'Img);
            end  if;
            Connection_Manager.Delete_Connection (ID);
            Deleted := True;
            Socket.Shutdown;
         elsif  Socket.Content.Connection_Type = Long_Pollingthen
            if  Verbose_Outputthen
               Gnoga.Log ("Ping on long polling -"  & ID'Img);
            end  if;

            Execute_Script (ID,"0");

         elsif  Socket.Content.Connection_Type = WebSocketthen
            if  Verbose_Outputthen
               Gnoga.Log ("Ping on websocket -"  & ID'Img);
            end  if;

            Socket.WebSocket_Send ("0");
         end  if;
      exception
         when  E : Storage_Error =>
            Gnoga.Log ("Invalid socket, Deleting ID -"  & ID'Img);
            Log (Ada.Exceptions.Exception_Information (E));
            Connection_Manager.Delete_Connection (ID);
         when  E :others  =>
            Log ("Ping"  & ID'Img &" error.");
            Log (Ada.Exceptions.Exception_Information (E));
            if  Socket.Content.Connection_Type = Long_Pollingthen
               Gnoga.Log ("Long polling error closing ID "  & ID'Img);
               Socket.Content.Finalized := True;
               Socket.Shutdown;
            else
               begin
                  delay  3.0;
                  Socket := Connection_Manager.Connection_Socket (ID);
                  Socket.WebSocket_Send ("0");
               exception
                  when  E :others  =>
                     Log ("Watchdog closed connection ID "  & ID'Img);
                     Log (Ada.Exceptions.Exception_Information (E));

                     begin
                        Connection_Manager.Delete_Connection (ID);
                        Deleted := True;
                     exception
                        when  E :others  =>
                           Log ("Watchdog ping error - "  & ID'Img);
                           Log (Ada.Exceptions.Exception_Information (E));
                     end;
               end;
            end  if;
      end  Ping;
   begin
      accept  Start;

      loop
         declare
            ID : Gnoga.Types.Connection_ID;
         begin
            Connection_Manager.First (ID);
            while  ID /=0  loop
               declare
                  Deleted     : Boolean;

               begin
                  Ping (ID, Deleted);
                  if  Deletedthen
                     Connection_Manager.First (ID);
                  else
                     Connection_Manager.Next (ID);
                  end  if;
               end;
            end  loop;
         exception
            when  E :others  =>
               Log ("Watchdog error on websocket - "  & ID'Img);
               Log (Ada.Exceptions.Exception_Information (E));
         end;

         select
            accept  Stop;
            exit;
         or
            delay  60.0;
         end  select;
      end  loop;
   end  Watchdog_Type;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to