Hi Martin,

Thanks for clearing that up.

Another solution could be to write a special end marker to the snapshot file 
and only try to deserialize if the marker is there.

I've opened a ticket to make the local file snapshot store more robust.

B/

On 16 May 2014 at 12:13:01, Martin Krasser ([email protected]) wrote:

The local snapshot store writes snapshots asynchronously and there's no 
graceful shutdown implemented (i.e. it doesn't wait for the snapshot being 
written successfully). This is currently a responsibility of the application, 
waiting for a SaveSnapshotSuccess message to arrive before stopping the actor.

As a consequence, there's either an empty or partially written snapshot file on 
disk. In this case, the lcoal snapshot store fails to load the snapshot 
(logging the causing exception) *but* it will try to load a next-older snapshot 
(down to a recursion level of three). If all three attempts fail, then the 
corresponding processor is recovered from scratch, otherwise from one of the 
older snapshots. If a new snapshot is saved later, after recovery, everything 
should be fine again.

Maybe the best solution to this problem is to write the snapshot to a temporary 
file and then make an atomic rename (if supported by the underlying FS) so that 
partially written snapshot files are not possible. Please not that this is 
specific to the local snapshot store. The Cassandra snapshot plugin (and maybe 
also others), for example, does atomic writes ...

Cheers,
Martin

On 16.05.14 11:43, Björn Antonsson wrote:
Hi Wolfgang,

I guess you are using the local file system store, and the problem only occurs 
if the last snapshot file is empty?

That does indeed sound like a real issue. Would you mind opening a ticket and 
add this information (with a longer more complete stack trace).

B/

On 16 May 2014 at 10:17:23, Wofr ([email protected]) wrote:

Hi

We using Akka 2.3.2 with akka-persistence in our project.
So far our experience with this new module are quite good :)
.
But recently we run into some troubles when using snapshots. In the case we 
shutdown our application we write some data
to some snapshots. Some how it happens sometimes that snapshot files are 
created but empty.

In the case of a restart of our application this empty snapshots causes this 
error.
If more revision of this snapshot are available and the last one does contain 
data, the error does not occur.

java.io.EOFException: null
        at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) 
~[na:1.7.0_25]
        at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown 
Source) ~[na:1.7.0_25]
        at java.io.ObjectInputStream.readStreamHeader(Unknown Source) 
~[na:1.7.0_25]
        at java.io.ObjectInputStream.<init>(Unknown Source) ~[na:1.7.0_25]
        at 
akka.util.ClassLoaderObjectInputStream.<init>(ClassLoaderObjectInputStream.scala:16)
 ~[akka-actor_2.10-2.3.2.jar:na]

I would expect that an empty file should not cause an exception.

Regards

Wolfgang


--
>>>>>>>>>> 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.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

JOIN US. REGISTER TODAY!
Scala
Days
June 16th-18th,
Berlin

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

--  
Martin Krasser

blog:    http://krasserm.blogspot.com
code:    http://github.com/krasserm
twitter: http://twitter.com/mrt1nz
--
>>>>>>>>>> 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.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

JOIN US. REGISTER TODAY!
Scala
Days
June 16th-18th,
Berlin

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