Re: [Gnoga-list] SYSTEM.ASSERTIONS.ASSERT_FAILURE : Position cursor of Next is bad

2019-08-24 Thread Pascal via Gnoga-list

> Le 11 août 2019 à 23:37, Jeremiah Breeden  a 
> écrit :
> 
> I always felt like my suggestion to restart on exception was more of a 
> bandaid.  I really wonder if honestly it just needs a look at the design.  Is 
> it really a good idea to give two independent tasks delete power on the 
> container?  I feel like it is a design problem that the ping operation can 
> delete cursors.  So I would choose option (e), look at the design and see if 
> it can be reorganized.  If not, option (b) would be my second choice, but 
> that's without really knowing how the implementation would work out

Hello Jere,

Regarding option (e), raisons for socket to be created or to be removed are 
multiple and completely asynchrone as they can come from the user (browser 
closing window for instance) or the program (server stoping for instance).
Thus, I try the option (b). It appears to be short, see:
https://sourceforge.net/p/gnoga/code/ci/4663af3a99f0336c650eb872bc9e4a6186f770a9/

If Ping deletes a connection, it is deleted on the main maps and not the 
iterated maps, no ping is sent to the deleted socket and next can be safe on 
the iterated maps.
It can do the job while finding a more complete fix.
I hope this has not yet introduced memory leaks or new side effects.

Feel free to make intensive tests and send feedbacks on the list.

Thanks, Pascal.
http://blady.pagesperso-orange.fr




___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list


Re: [Gnoga-list] SYSTEM.ASSERTIONS.ASSERT_FAILURE : Position cursor of Next is bad

2019-08-11 Thread Jeremiah Breeden
I always felt like my suggestion to restart on exception was more of a
bandaid.  I really wonder if honestly it just needs a look at the design.
Is it really a good idea to give two independent tasks delete power on the
container?  I feel like it is a design problem that the ping operation can
delete cursors.  So I would choose option (e), look at the design and see
if it can be reorganized.  If not, option (b) would be my second choice,
but that's without really knowing how the implementation would work out.

On Sun, Jul 21, 2019 at 11:57 AM Pascal via Gnoga-list <
gnoga-list@lists.sourceforge.net> wrote:

> Hello,
>
> Time from time the following exception occurs:
> 2019-03-01 20:22:56.99 : raised SYSTEM.ASSERTIONS.ASSERT_FAILURE :
> Position cursor of Next is bad
> [bin/adablog]
> System.Assertions.Raise_Assert_Failure at s-assert.adb:46
> Gnoga.Server.Connection.Socket_Maps.NextXnn at a-coorma.adb:1075
> Gnoga.Server.Connection.Connection_Manager.NextN at
> gnoga-server-connection.adb:1085
> Gnoga.Server.Connection.Connection_Manager.NextP at
> gnoga-server-connection.adb:1082
> Gnoga.Server.Connection.Watchdog_TypeT at gnoga-server-connection.adb:1268
>
> Watchdog piece of code:
> Connection_Manager.First (ID);
> while ID /= 0 loop
>Ping (ID);
>Connection_Manager.Next (ID);   --> exception raised
> end loop;
>
> I guess it fails when Current_Socket has been previous deleted:
>   procedure Next (ID : out Gnoga.Types.Connection_ID) is
>  use type Socket_Maps.Cursor;
>   begin
>  Current_Socket := Socket_Maps.Next (Current_Socket); -->
> exception raised
>  if Current_Socket /= Socket_Maps.No_Element then
> ID := Socket_Maps.Key (Current_Socket);
>  else
> ID := 0;
>  end if;
>   end Next;
>
> This issue has been discussed last year from Gautier ping issue:
>
> https://sourceforge.net/p/gnoga/mailman/gnoga-list/thread/2b62e268-6f8a-8bec-c249-4e90753fab1e%40adalog.fr/#msg36384899
>
> And Jere had opened a ticket and a discussion about a similar issue with
> the ID closing loop:
> https://sourceforge.net/p/gnoga/tickets/41/
> https://sourceforge.net/p/gnoga/mailman/message/36357020/
>
> Let's sum up ideas:
> a) include the watchdog loop into the protected object Connection_Manager,
> as Jeff proposed for Jere issue,
> What could possible side effects for watchdog case?
> b) declare a shadow socket container in the protected object
> Connection_Manager and clone active socket container into the shadow one
> when calling First and then iterating on the shadow container which will be
> safe, as Jeff proposed too,
> c) Add to the ID loop an exception handler which rewind the cursor to
> first, as Jere proposed,
> What could possible side effects for watchdog case?
> d) do nothing ;-)
>
> In my opinion, b) is a safer choice, c) is simple choice.
> What is your feedback?
>
> Thanks, Pascal.
> http://blady.pagesperso-orange.fr
>
>
>
>
> ___
> Gnoga-list mailing list
> Gnoga-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gnoga-list
>
___
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list