mdedetrich commented on PR #371:
URL: https://github.com/apache/incubator-pekko/pull/371#issuecomment-1582068983

   > @He-Pin [akka/akka#31912](https://github.com/akka/akka/pull/31912) looks 
like a viable approach. Is there any way that a unit test could be developed?
   
   So I had a look at this in more detail and I don't think this would solve 
the specific problem we are dealing with here. Unless I misunderstood, this is 
solving the issue where you can have multiple in flight requests with the same 
id where as I am dealing with the issue where we don't want to generate 
multiple ids by checking in flight transactions.
   
   While the difference is subtle its somewhat critical here, the solution in 
https://github.com/akka/akka/pull/31912 involves putting guards around 
`inflightRequests` within `DnsClient` itself where as the problem we have is 
that we have an external `AsyncDnsResolver` actor that needs to access the 
state of `DnsClient.
   
   If `inflightTransactions` was hypothetically inside of `AsyncDnsResolver` we 
wouldn't even be having this issue  and the solution would be done by now and 
this is what I alluded to when I made this earlier statement
   
   > Initially I thought it would have been possible to just have a currentIds 
collection inside of AsyncDnsResolver, adding id's is easy since nextId() is 
also defined inside of AsyncDnsResolver, the problematic part is removing the 
id's. If you check occurrences of inflightRequests -= <ID> you can see there 
are 3 cases where id's are removed (i.e. dropped requests, failed UDP packets 
etc etc) and only in one of those cases (specifically DropRequest) does 
AsyncDnsResolver have context of this.
   
   A hypothetical solution to this issue would be to reverse the problem, i.e. 
for the other cases where `inflightRequests -= <ID>` occurs in Actors outside 
of `AsyncDnsResolver`, those actors could send a message to `AsyncDnsResolver` 
stating that an id has been dropped but the problem here is this would create a 
cyclic dependency because the relationship is currently the opposite way 
around, i.e. `AsyncDnsResolver` keeps track of the other actors (such as 
`DnsClient`) and not the other way around (`DnsClient` does not have any actor 
references to `AsyncDnsResolver`)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to