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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gnoga-list