research about concurrency bugs

71 views
Skip to first unread message

Carmen Torres López

unread,
Aug 30, 2016, 7:05:11 PM8/30/16
to Akka User List
Hello,

I'm doing a research about concurrency bugs types that can be observed in languages based in actor model. I would like to know what kind of bugs can be observed frequently in Akka? Has anyone experience a behavoir such as deadlocks, livelock, starvation, race conditions, order violation, etc.? 
I will appreciate any pointer of an example code that generate these bugs.

Best regards,
Carmen

Dagny T

unread,
Sep 1, 2016, 5:36:51 PM9/1/16
to Akka User List
Hey Carmen,

I'm a Scala/Akka Newbie; but I think the idea in Scala is to use Actors to avert most concurrency bugs.

So, essentially (Akka) Actors are things that can hold their own state, like Objects in traditional OOP languages.
External Entities can Message to Actor references to signal it to change its own state, or to respond with information about itself.
The underlying Akka system handles the serialization of those immutable Messages to the Actors' 'Mailbox' or like dedicated min-message-queues.

Typically, multiple entities could concurrently message to any Actor.  So, the ordering of those incoming messages is random.
However, the Akka serialization of those messages ensures that there's no race-conditions to worry about.
This also precludes having to do locks, and therefore running into deadlocks.

I'm not sure if this means that you have to design your System such that Ordering doesn't matter (i.e. first Message to get to Actor wins); and then to handle Duplicate messages from
horizontally scalable Actor Cluster instances (i.e. one Actor crashes in mid-flow and its replacement sends a duplicate message)

Anyhow -- I'm DEFINITELY interested in seeing a good example of exercising the baseline concurrency test-cases using Akka-Testkit!  Will post that interest so that we both may get help with that answer!

Cheers!
Dagny T

Guido Medina

unread,
Sep 7, 2016, 7:28:19 AM9/7/16
to Akka User List
Hi Carmen,

The following might not have a specific example but will probably help you seeing in details the design concepts behind Akka combined with the Java Memory Model,
most of the aspects you have mentioned are avoided but maybe there is a way to reproduce one or two by contradicting the advises in the following:


HTH,

Guido.

Guido Medina

unread,
Sep 7, 2016, 7:31:55 AM9/7/16
to Akka User List
Hmm, as an example, look at end of it and try to share a mutable message.

Create a message with an ArrayList and send it to several actors,
then try to modify and iterate over such list and you will probably (eventually) get a concurrent modification exception.

That's one example I can think of, maybe too simple for your study but anyways, hope somehow it can lead you to what you need/want.

Guido.
Reply all
Reply to author
Forward
0 new messages