I have a fairly complicated setup using cluster client, sharding and 
singleton all together. I have been struggling with putting together a 
multi-jvm test for this setup. I have succeeded in the sense that I have 
test cases which I can run with my cluster setup, and these tests do pass 
but not always. 

As far as I can tell, the inconsistency is because of the cluster 
singleton. I have read the posts regarding the long delays for singleton 
startup, and I am aware of issue https://github.com/akka/akka/issues/13869. 
I was able to successfully run my first test case by increasing the amount 
of time I wait for a response, hence allowing time for the singleton to 
start. However, when I added a second test case, I ran into the same 
problem and I had to increase the wait time even more to finally pass the 
test. Furthermore, this was not consistent - the test sometimes passes and 
sometimes fails due to the singleton. I am reasoning that the problem is 
the singleton because of the following message in the log:

DEBUG a.c.pattern.ClusterSingletonProxy - No singleton available, stashing 
message [my message to the singleton]

Sometime later, I get the Singleton identified message in the log and the 
stashed message is forwarded, but it is too late, I have an error in my 
application logic. When the test passes, I don’t have any of these messages 
in the log. Increasing the wait time seems to help, but it looks like there 
is something else going on which interferes with the process as well.

If anyone has any ideas/suggestions regarding the above issue, that would 
be great. I can share my test code if it will help.

In the meantime, I am trying to debug further and figure out the problem 
myself, but I am having difficulties since there isn’t a lot of 
documentation on the cluster contributions or multi-jvm testing. Hence, I 
am posting here in the hope of getting some clarification on the following 
areas:

a) If I use runOn(node1), the enclosed code is executed in the 
corresponding node and its jvm - ok. If in my base spec, there is no other 
code specified for node1, does this mean that the node will be shut down 
even if other code is still being executed on other nodes? As a more 
specific example, if I have one node acting as my cluster client and other 
nodes as part of my cluster, do I have to do anything extra to keep them up 
in the background since I will be using runOn(client) only?

b) Is there any way to make all my test cases dependent on my singleton 
being started? If I need to implement this myself, how do I go about it? I 
guess I can listen to the cluster for some event that signifies that the 
singleton is up, but I still don’t know enough. For example, does the 
singleton start itself automatically or is it initiated in a lazy manner? 
Which event should I listen for?

c) Is it possible to use enter barriers to control both of the above? Yet, 
I could not find any documentation at all regarding enter barriers. How do 
they work? Is there any difference between placing them inside or outside a 
runOn block?

Thanks a lot,

Sinan


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to