New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializer for org.opencv.core.Mat #110
Comments
It seems like a Kryo issue. Could you try to separate the issue from Akka? I.e. can you try to create/obtain the Kryo instance and see if you can serialize/deserialize your data using it, but without using Akka or trying to send anything over the network? |
Thanks for getting back to me, @romix! I followed your suggestion and separated the issue from Akka what turned out to work fine. The following shows serialization/deserialization of a case class, an "empty" Mat and a Mat representing a video frame. Sorry for not providing a complete MWE but that seems impossible due to compiling OpenCV.
Coming back to my original situation, I realized that the code works when running the two actor systems in a single JVM on two different ports. Putting them on two different machines lets the serialization of a Mat holding a video frame fail but not the "empty" Mat. Does that make any sense? |
@romix, please don't waste any more thoughts on that for now... I'm not 100% sure yet what I have changed but I came up with a working solution that sends one Mat object to an actor in a different actor system running on a different machine using |
@toaditoad Thanks for trying to isolate the issue.
|
|
Yes. That's what I meant.
UnsafeInput/UnsafeOutput should not be used in this case. But I'd check anyways that it is really the case ;-) I'm just trying to exclude as many possibilities as possible. One more thing to check: In your original trace I can see this: |
Thanks for your support, @romix. Unfortunately, I cannot reproduce the issue any more. Today I tried the version that had worked using two macOS machines on the original machines (Windows and macOS) and it worked just fine... By now, I can only take wild guesses what has changed.
Yes, that is the correct address of one of the actor systems. I doubt that there is a connection issue because right before sending the video frame, the two systems communicate with each other - that is why I thought it is rather an issue with Kryo than with Akka itself. But as said, I cannot reproduce the issue any more. Thanks again for your great work and I really appreciate your support! I'm attaching the current code snippets for future reference. Please note that in contrast to the original post, this version serializes objects of
|
I discovered that the behavior is not very consistent what is not an issue with Kryo but rather with the network itself. I should also point out that these video frames are retrieved from a 4k video recording resulting in pretty large mat objects (even when converted into greyscale). Sending such an object (even when compressed with lz4 or deflate) is pretty time-consuming and causes Akka to skip/lose heartbeats. I found a working but not nice way to make the communication work by increasing the
Obviously, this is not a good approach and I will investigate other options in order to avoid sending such large messages. I would like to perform some basic measurements to support my statement that it is not an option and was wondering how to get the message size after serialization. Is |
@toaditoad , there is a new remoting transport (search for Akka Artery) that should solve this problem (head of the line blocking) by maintaining different streams for user and system messages. There is also a provision for large messages stream that may fit your case. |
@luben, thank you for pointing Akka Artery out! I have heard about it but haven't had the chance to look at it in detail. You're right, it sounds promising. After figuring out that the |
I'm having trouble to implement a serializer for a org.opencv.core.Mat object representing e.g. a frame of a video file. The idea is that a system A sends a video frame in greyscale to a system B in order to detect objects in it. For that purpose, the frame of type Mat has to be serialized and sent over the network.
However, it seems that it is never actually sent and/or it stops the actor of sending heartbeats what causes the system to fail.
Any ideas what to do about it?
I also asked it on Stackoverflow: http://stackoverflow.com/questions/41957087/akka-remoting-custom-serializer-for-org-opencv-core-mat
configuration.conf (on system A and B)
de.itd.util.KryoInit.scala (on system A and B)
de.itd.util.MatKryoSerializer (on system A and B)
Log of system A (sending a frame to system B)
Log of system B (should receive a frame from system A)
The text was updated successfully, but these errors were encountered: