I activated logging, not much is logged. It seems it gets the dead letter log messages when it gets the items from the typed actor map:

Starting up
[DEBUG] [04/08/2014 14:39:30.238] [main] [EventStream(akka://test)] logger log1-Logging$DefaultLogger started
[DEBUG] [04/08/2014 14:39:30.239] [main] [EventStream(akka://test)] Default Loggers started
populate the map
wait till the map is fully populated
now get all items from the map
[INFO] [04/08/2014 14:39:46.578] [test-akka.actor.default-dispatcher-19] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.586] [test-akka.actor.default-dispatcher-16] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-2] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [3] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-2] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [4] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-2] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [5] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-2] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [6] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-2] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [7] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-11] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [8] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-11] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [9] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:39:46.599] [test-akka.actor.default-dispatcher-11] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#-128635841] to Actor[akka://test/deadLetters] was not delivered. [10] dead letters encountered, no more dead letters will be logged. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
and verify key<->value pairs match
also verify we got/checked 1000000 number of items
795729
925174
952431
952431
952431
952431

...


On 08/04/14 14:27, √iktor Ҡlang wrote:
If there are dead letters it means that the actor somehow terminates, turn on more detailed logging.


On Tue, Apr 8, 2014 at 3:24 PM, Konstantinos Kougios <[email protected]> wrote:
I used to have a println to verify the number of futures in the list, but also added the check, still getting the issue once say every 2 runs.

When it runs correctly, it runs without any deadletters. But when it doesn't run correctly, it logs those deadletters too and gets stuck at the final while loop.

I've attached the whole experiment in my previous email, it can be run with sbt run

Cheers


On 08/04/14 14:19, √iktor Ҡlang wrote:
I dont see anywhere where you verify that:

  val l = (1 to Iterations).par.map {
            i =>
                service(i).map {
                    s => (s, "x" + i)
                }
        }.toList

if (l.size != iterations) throw new Exception("Comparing apples to oranges")


On Tue, Apr 8, 2014 at 3:11 PM, Konstantinos Kougios <[email protected]> wrote:
I wrote a small program to verify it is all ok, sometimes it runs fully and succeeds but most times it get stuck cause it doesn't get all items that it "put" into the map.

So what it does is it adds 1 million items into this typed actor map. It then waits till the map's actual size is 1 million ( to make sure all messages were delivered to the map actor). It then gets all items from the map and compares if the key contains the correct value (this always works correctly). Finally it compares the number of gets/checks it did, but this is where it fails, many runs get less items than those were put in the map along with some deadletter logging:

package actors

import akka.actor.{TypedProps, ActorSystem, TypedActor}
import scala.concurrent.ExecutionContext.Implicits.global
import java.util.concurrent.atomic.AtomicInteger

/**
 * @author kkougios
 *         Date: 2014/04/08 10:36 AM
 */
object Main extends App
{
    println("Starting up")

    val system = ActorSystem("test")
    val typed = TypedActor(system)
    val service: MapService[Int, String] = typed.typedActorOf(TypedProps[MapServiceImpl[Int, String]])

    val Iterations = 1000000
    try {
        // populate the map using many threads
        (1 to Iterations).par.foreach {
            i =>
                service(i) = "x" + i
        }

        // wait till the map is fully populated
        while (service.size.get != Iterations) {
            println(service.size.get)
            Thread.sleep(1000)
        }


        // now get all items from the map, again using many threads
        val l = (1 to Iterations).par.map {
            i =>
                service(i).map {
                    s => (s, "x" + i)
                }
        }.toList

        // and verify key<->value pairs match
        println("looking for issues")
        val checked = new AtomicInteger
        l.foreach {
            f =>
                f.foreach {
                    case (actual, expected) =>
                        checked.incrementAndGet()
                        if (actual != expected) println("FOUND ISSUE")
                }
        }

        // also verify we got/checked "Iterations" number of items
        println("waiting for checked")
        while (checked.get != Iterations) {
            println(checked.get)
            Thread.sleep(1000)
        }
    } finally {
        typed.poisonPill(service)
        println("shutting down")
        system.shutdown()
    }
}


running this produces (usually) something like this:

Starting up
[INFO] [04/08/2014 14:04:16.919] [test-akka.actor.default-dispatcher-11] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.919] [test-akka.actor.default-dispatcher-12] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-12] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [3] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-12] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [4] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-12] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [5] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-12] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [6] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-10] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [7] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-10] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [8] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-10] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [9] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[INFO] [04/08/2014 14:04:16.920] [test-akka.actor.default-dispatcher-10] [akka://test/deadLetters] Message [java.lang.String] from Actor[akka://test/user/$a#1286986617] to Actor[akka://test/deadLetters] was not delivered. [10] dead letters encountered, no more dead letters will be logged. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
looking for issues
waiting for checked
970038
977033 <- this should be 1 million which would allow the program to exit
977033
977033
977033
977033
... goes on forever


Any ideas what might be wrong? Here is the typed actor code:

package actors

import scala.concurrent.Future

/**
 * @author kkougios
 *         Date: 2014/04/08 10:39 AM
 */

trait MapService[K, V]
{
    def update(k: K, v: V): Unit
    def apply(k:K):Future[V]

    def size:Option[Int]

}

class MapServiceImpl[K, V] extends MapService[K, V]
{
    private val m = collection.mutable.Map.empty[K, V]

    override def apply(k: K) = Future.successful(m(k))

    override def update(k: K, v: V) = m(k) = v

    override def size = Some(m.size)

}


On 08/04/14 13:26, √iktor Ҡlang wrote:
yep


On Tue, Apr 8, 2014 at 2:23 PM, Kostas kougios <[email protected]> wrote:
Thanks for the replies, so I suppose this typed actor will work just fine. Any execution of the 2 methods will occur at 1 thread at each time and state changes within the actor consists of safe publication. I run it and it looks good.

trait MapService[K, V]
{
    def update(k: K, v: V): Unit
    def apply(k:K):Future[V]
}

class MapServiceImpl[K, V] extends MapService[K, V]
{
    private val m = collection.mutable.Map.empty[K, V]

    override def apply(k: K) = Future.successful(m(k))

    override def update(k: K, v: V) = m(k) = v
}
--
>>>>>>>>>> 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.



--
Cheers,
--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/cySCeR4mcRY/unsubscribe.
To unsubscribe from this group and all its topics, 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.

--
>>>>>>>>>> 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.



--
Cheers,
--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/cySCeR4mcRY/unsubscribe.
To unsubscribe from this group and all its topics, 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.

--
>>>>>>>>>> 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.



--
Cheers,
--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/cySCeR4mcRY/unsubscribe.
To unsubscribe from this group and all its topics, 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.

--
>>>>>>>>>> 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