Hi Tim,


On Sun, Feb 21, 2016 at 1:23 PM, Tim Pigden <tim.pig...@optrak.com> wrote:

> Ok, light at the end of the tunnel, this is what fails.
> I'd call that silently swallows.
> Essentially the only indication of anything wrong is that the persistence
> stores nothing.
>

Ah, so the in-memory journal does not log an issue if serialization fails?
Can y


>
> I think this is a plugin bug in the in-memory plugin and a thus by
> implication TCK issue. Should I raise the TCK issue?
>

I don't know about the TCK part, but if the in-mem journal doesn't signal
such failures properly then please open a ticket with a small reproducer.

Thanks
-Endre


>
> Switching to postgres aysnc and I do get a proper error message. It
> doesn't tell me why but it does tell me it went wrong.
>
>
> package com.optrak.vrp.ddd
>
> import akka.actor.{ActorLogging, PoisonPill, Props}
> import akka.persistence.PersistentActor
> import com.optrak.opkakka.test.TestSupport.AkkaTestkitContext
> import com.optrak.vrp.ddd.SimplePersistor.PersistMe
> import org.specs2.mutable.Specification
>
> /**
>   * Created by tim on 21/02/16.
>   */
>
> object SimplePersistor {
>   case class PersistMe(k: AnyRef)
>
>   case class GotBack(kOpt: Option[AnyRef])
>
>   case object Request
>
>   def props[K] = Props(new SimplePersistor)
> }
> import SimplePersistor._
>
> class SimplePersistor extends PersistentActor with ActorLogging {
>
>   var local: Option[AnyRef] = None
>
>   def handler(msg: PersistMe) = {
>     local = Some(msg.k)
>   }
>   override def receiveRecover: Receive = {
>     case pm: PersistMe =>
>       local = Some(pm.k)
>   }
>
>   override def receiveCommand: Receive = {
>     case pm: PersistMe =>
>       persist(pm)(handler)
>     case Request =>
>       sender ! GotBack(local)
>
>   }
>
>   override def persistenceId: String = "simplePeristor"
> }
>
> class TestAkkaSerializability extends Specification {
>   sequential //our set always has the same persistence id, so have to
>
>   trait Checkit extends AkkaTestkitContext {
>
>     def checkItOut(k: AnyRef) = {
>       val persy1 = system.actorOf(SimplePersistor.props)
>       persy1 ! Request
>       expectMsg(GotBack(None))
>
>       persy1 ! PersistMe(k)
>       persy1 ! Request
>       expectMsg(GotBack(Some(k)))
>
>       persy1 ! PoisonPill
>       Thread.sleep(200)
>
>       val persy2 = system.actorOf(SimplePersistor.props)
>       persy2 ! Request
>       expectMsg(GotBack(Some(k)))
>
>     }
>   }
>
>   "persistent set" should {
>     "work with String" in new Checkit()  {
>       checkItOut("ho")
>     }
>
>     "fails with unserializable" in new Checkit() {
>       val x = 1
>       case class Thing(y: Int)
>       val tricky = new Thing(2) {
>         def xMe = x
>       }
>
>       checkItOut(tricky)
>
>     }
>
>   }
>
> }
>
>
>
> assertion failed: expected GotBack(Some(Thing(2))), found GotBack(None)
> java.lang.AssertionError: assertion failed: expected
> GotBack(Some(Thing(2))), found GotBack(None)
>
> my log file
>
> 2016-02-21 12:08:42,871 - INFO - from akka.event.slf4j.Slf4jLogger 
> Slf4jLogger started
> 2016-02-21 12:08:43,160 - WARN - from 
> akka.serialization.Serialization(akka://default) Using the default Java 
> serializer for class [com.optrak.vrp.ddd.SimplePersistor$PersistMe] which is 
> not recommended because of performance implications. Use another serializer 
> or disable this warning using the setting 
> 'akka.actor.warn-about-java-serializer-usage'
> 2016-02-21 12:08:43,572 - INFO - from akka.event.slf4j.Slf4jLogger 
> Slf4jLogger started
> 2016-02-21 12:08:43,604 - WARN - from 
> akka.serialization.Serialization(akka://default) Using the default Java 
> serializer for class [com.optrak.vrp.ddd.SimplePersistor$PersistMe] which is 
> not recommended because of performance implications. Use another serializer 
> or disable this warning using the setting 
> 'akka.actor.warn-about-java-serializer-usage'
>
>
> relevant bit of config
>
> akka {
>   loglevel = DEBUG
>   logger-startup-timeout = 30s
>   logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
>   actor.debug.fsm = true
>   loggers = ["akka.event.slf4j.Slf4jLogger"]
>
>   extensions = 
> ["com.romix.akka.serialization.kryo.KryoSerializationExtension$"]
>
>   persistence {
>     //    journal.plugin = "akka-persistence-sql-async.journal"
>     //    snapshot-store.plugin = "akka-persistence-sql-async.snapshot-store"
>     journal.plugin = "inmemory-journal"
>     snapshot-store.plugin = "inmemory-snapshot-store"
>     journal-plugin-fallback {
>       replay-filter {
>         mode = fail
>       }
>     }
>   }
>
>   //----------------- Kryo config ----------------------
>
>   actor {
>     serialize-messages = off
>
>     serializers {
>       java = "akka.serialization.JavaSerializer"
>       # Define kryo serializer
>       kryo = "com.romix.akka.serialization.kryo.KryoSerializer"
>     }
>
>     serialization-bindings {
>       "java.io.Serializable" = java
>     }
>
>     kryo {
>       type = "nograph"
>       idstrategy = "default"
>       kyro-trace = true
>     }
>   }
> }
>
>
>
>
>
> On Sunday, February 21, 2016 at 9:52:57 AM UTC, Tim Pigden wrote:
>>
>> I've just spent a few hours tracking down a mysterious failure in
>> previously working code that used akka persistence.
>> Eventually I tracked it down to the fact that akka persistence silently
>> swallows non-serializable messages with no warning.
>> Now I appreciate that
>> serialize-message = on
>> is a documented setting and it does the job.
>>
>> But it's kinda hidden way down the serialization page in the docs.
>> And since at least 2 serializers (default java and contributed kyro) need
>> no configuration, and there's a big red warning not to use it in
>> production, it is quite likely that people will not see it or not think to
>> turn it on.
>>
>> So firstly, is it that hard to efficiently report on a failed attempt at
>> serialization at run time, for normal use? After all - it's got to be a
>> programming error hasn't it? At least in akka-persistence.
>> Secondly, perhaps users of akka persistence should get a strong
>> recommendation in the docs to turn it on in their tests.
>>
>> ------------------------------------
>> “But the plans were on display…”
>> “On display? I eventually had to go down to the cellar to find them.”
>> “That’s the display department.”
>> “With a flashlight.”
>> “Ah, well, the lights had probably gone.”
>> “So had the stairs.”
>> “But look, you found the notice, didn’t you?”
>> “Yes,” said Arthur, “yes I did. It was on display in the bottom of a
>> locked filing cabinet stuck in a disused lavatory with a sign on the door
>> saying ‘Beware of the Leopard.”
>> The Hitchhiker's Guide to the Galaxy
>>
>>
>> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to