Comments (8)
Hi, Andreas! I checked your issue.
- It looks like the original protobuf-net can't save your object (the same recursion exception).
- I fixed the problem with AsReferenceDefault not being used correctly.
- The serialization goes in a recursive way. Your objects have a similar to linked list structure. That means the whole list is processed in a recursive way which leads to StackOverflowException. I don't see how it can be fixed right now as the architecture assumes depth-first graph traversal.
from aqlaserializer.
Hello,
first thanks a lot for your very quick reply!
- Yes, that's correct - the reason I'm searching for another serialization project. ;-)
- A very good start! :-)
- I understand that protobuf-net has problems with it as it obviously does not handle object references correctly. But as you fixed that I don't understand why the StackOverflowException when serializing graphs cannot be fixed:
you can just "stop processing" when you reach the same object (= reference equal) again.
I just build this small example project now to reproduce it more easily without my database:
http://www.ab-tools.com/temp/AqlaSerializerTest.zip
It works fine if you reduce the node count to e. g. only 1000, but with 10000 you get the StackOverflowException. So it obviously works fine also with recursion as long as not too many objects are involved.
Best regards and again thanks for the quick response
Andreas
from aqlaserializer.
@ab-tools
3. "you can just "stop processing" when you reach the same object" this is already done but it's not your case. Your serialization path looks like Airport => Waypoints => Airports => ... Airport => Waypoints => Airports ... Because objects graph is traversed not in wide but in depth. Of course similar references are not traversed second time but it doesn't help when there are objects referencing other different objects referencing other different objects ... The whole "list" is traversed recursively.
There is a workaround but you need to change your structure: remove Waypoint.Airports from serialization but add Dictionary of Waypoint, Airport[] somewhere in the root instead so there will be no more "Waypoints => Airports" part.
from aqlaserializer.
Yes, I know - that's how I do it with protobuf-net right now (and then iterating through all Airways at program start and adding the Waypoint => Airways references manually again), but I really would like to get rid of all these work-arounds.
I guess I would need less work-arounds than with protobuf-net with your serializer already (due to the reference issue to be fixed), but it would be great to have a serialization solution that just can handle a graph structure correctly without any work-arounds. ;-)
You marked it for V2:
when you expect to have a first version of V2 to be usable?
Agains thanks for the very quick replies!
Andreas
from aqlaserializer.
V2 is a "big bright future". I plan to rewrite core things but it's really big task and is not going to happen soon. I wouldn't wait for that :)
from aqlaserializer.
OK, see - that's bad.
But anyway, AqlaSerializer seems to be the best serializer right now as protobuf-net obviously is dead.
So I'll probably switch to your solution for this project. :-)
Thanks again for this great support
Andreas
from aqlaserializer.
@ab-tools
I have another workaround for you. Just create a separate thread with big stack size.
new Thread(s => Serialize(), 1024 * 1024 * 50).Start();
Download the newest release otherwise you'll get recursion exception.
from aqlaserializer.
That's a good idea, thanks for this suggestion!
I just gave it a try:
you need to do the same for deserialization, too, of course, but then it works fine. The application does require full trust then though (for changing the stack size of the new thread), but as my application should not be run over network or similar, I think that's OK (although I need to test a bit more with it as I never needed to change the stack size of a thread till now ;-) ).
I will add a suggestion/feature request in another issue now, but again thanks for your great support regarding this issue here
Andreas
from aqlaserializer.
Related Issues (20)
- RuntimeTypeModel.Default.CompileInPlace is too slow HOT 5
- Non-public member cannot be used with full dll compilation HOT 12
- AqlaSerializer.ProtoException: Trap count > 1, will be mismatched with next NoteObject HOT 15
- Dynamic type is not a contract-type
- Un-defined enum values HOT 1
- Unexpected sub-type HOT 4
- How to setup Aqla for complicated object relationships HOT 4
- Wrong group was ended
- Recursion depth exceeded safe limit HOT 2
- "Unable to determine member" when running obfuscated code HOT 1
- A deferred key does not have a value yet (NoteObject call missed?) HOT 10
- How to unregister or re-register a type? HOT 6
- Can you please publish the latest code?
- Failed to clone a dictionary with enum value
- Unable to Serialize a string object dictionary containing a string array as object
- Is Aqla's metadata inspection thread-safe? HOT 2
- Is there a way to re-compile the runtime type model as a dll? HOT 2
- Can we reformat the source code? HOT 1
- Reference tracking error message only for release build but not for debug build
- When a SortedDictionary is serialized, does Aqla keep the "Comparer" of it? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqlaserializer.