fairyhawk / protostuff

Automatically exported from code.google.com/p/protostuff
Apache License 2.0
0 stars 0 forks source link

Runtime Error with Generic & RuntimeSchema #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
-- What steps will reproduce the problem? --
1.
Run the attached. When schemaA is defined as in the comment, both schemaA and 
schemaB fail with a nasty java.lang.StackOverflowError.

-- What is the expected output? What do you see instead? --
Prints the object if schemaA = null, else 

Exception in thread "main" java.lang.StackOverflowError
    at com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:743)
    at com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:893)
...

-- What version of the product are you using? On what operating system? --

Win XP SP3, protostuff-api-1.0.0

-- Please provide any additional information below. --

Not sure if this is just my ugly code or this case can and should be addressed. 
It did happen to me in a legitimate application code :P

Original issue reported on code.google.com by erezd...@gmail.com on 19 Jul 2011 at 9:42

GoogleCodeExporter commented 8 years ago
From the email exchange:

Its looking like a race condition on classloading.
When the object was instantiated, the runtime schema started inspecting the 
inner generic object field without it being 
fully loaded.
That's my guess at least.
When its fully loaded, protostuff-runtime used RuntimeObjectField for the inner 
message.
When not, protostuff-runtime used a RuntimeDerivativeField. (there were 
DerivativeSchema printlns from the stackoverflow).

-David

Original comment by david.yu...@gmail.com on 21 Jul 2011 at 8:45

GoogleCodeExporter commented 8 years ago
I had the same problem, but it was because of a loop in my object graph (a 
child class held a reference to the parent). Removing this loop got ride of the 
stackoverflow error for me. You might want to double-check the structure of 
your object graph.

Original comment by mtakem...@gmail.com on 22 Oct 2011 at 12:37

GoogleCodeExporter commented 8 years ago

Original comment by erezd...@gmail.com on 12 Apr 2014 at 4:05

Attachments: