You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2014/09/23 00:12:06 UTC

git commit: Add a FAQ entry about serializability errors

Repository: incubator-flink
Updated Branches:
  refs/heads/master 1e137be52 -> 8d8372167


Add a FAQ entry about serializability errors


Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/8d837216
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/8d837216
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/8d837216

Branch: refs/heads/master
Commit: 8d8372167bf5e3a7a23cf7e8462bec676ef81d9a
Parents: 1e137be
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Sep 23 00:10:58 2014 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Tue Sep 23 00:10:58 2014 +0200

----------------------------------------------------------------------
 docs/faq.md | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/8d837216/docs/faq.md
----------------------------------------------------------------------
diff --git a/docs/faq.md b/docs/faq.md
index 1008499..2480a4e 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -46,7 +46,7 @@ changes of all operators as the program progresses through the operations.
 
 ### How can I figure out why a program failed?
 
-- Thw JobManager web frontend (by default on port 8081) displays the exceptions
+- The JobManager web frontend (by default on port 8081) displays the exceptions
 of failed tasks.
 - If you run the program from the command-line, task exceptions are printed to
 the standard error stream and shown on the console.
@@ -69,6 +69,20 @@ execution.
 
 ## Errors
 
+### Why am I getting a "NonSerializableException" ?
+
+All functions in Flink must be serializable, as defined by [java.io.Serializable](http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html).
+Since all function interfaces are serializable, the exception means that one
+of the fields used in your function is not serializable.
+
+In particular, if your function is an inner class, or anonymous inner class,
+it contains a hidden reference to the enclosing class (usually called `this$0`, if you look
+at the function in the debugger). If the enclosing class is not serializable, this is probably
+the source of the error. Solutions are to
+- make the function a standalone class, or a static inner class (no more reference to the enclosing class)
+- make the enclosing class serializable
+- use a Java 8 lambda function.
+
 ### I get an error message saying that not enough buffers are available. How do I fix this?
 
 If you run Flink in a massively parallel setting (100+ parallel threads),