Skip to content
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

"StackOverflowError" and "Unable to create a random instance of type class <Compiled Protobuf Class>" #136

Open
grimsi opened this issue Oct 15, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@grimsi
Copy link

grimsi commented Oct 15, 2022

First of all thanks for this plugin, it seems to be really helpful!

Sadly I have some problems to get it working in my project, I always get the following error message:
org.jeasy.random.ObjectCreationException: Unable to create a random instance of type class com.igdb.proto.Igdb$InvolvedCompany

I uploaded a small sample project to reproduce this error here: https://github.com/grimsi/easyrandom-protobuf-test
Simply running a mvn clean install will result in a Stack-Overflow and "Unable to create a random instance of type class XXX".

I am using the official protobuf file from IGDB and it works fine in my project: https://api.igdb.com/v4/igdbapi.proto
I am using the protoc-jar-maven-plugin to compile the .proto file to Java classes.
My project is using Java 18 (maybe that's an issue?).

If you need any further assistance just tell me and I will give my best to support you.

@murdos
Copy link
Owner

murdos commented Jul 23, 2023

@grimsi : sorry for the (very) late answer. Could you try with the 1.0.0 snapshot version?
I've done a internal rewrite with #170 that might resolve your issue.

@murdos murdos added the bug Something isn't working label Jul 23, 2023
@murdos murdos changed the title [Bug] "StackOverflowError" and "Unable to create a random instance of type class <Compiled Protobuf Class>" "StackOverflowError" and "Unable to create a random instance of type class <Compiled Protobuf Class>" Jul 23, 2023
@grimsi
Copy link
Author

grimsi commented Jul 25, 2023

Thanks for replying!
Sadly the bug is still present. I tested it using my grimsi/easyrandom-protobuf-test repository.

With easy-random-protobuf 1.0.0-SNAPTHOT and easy-random-core 6.0.0-SNAPSHOT I get the same error as before (StackOverflow).

With easy-random-protobuf 1.0.0-SNAPSHOT and easy-random-core 5.0.0 I get the following error:
Cannot invoke "org.jeasy.random.api.RandomizerProvider.getRandomizerByType(java.lang.Class, org.jeasy.random.api.RandomizerContext)" because the return value of "org.jeasy.random.EasyRandomParameters.getRandomizerProvider()" is null

@murdos
Copy link
Owner

murdos commented Jul 27, 2023

Thanks. I've been able to reproduce the issue and created a minimal test case that illustrates the infinite recursion issue.
See #177.
However the fix it still doesn't work on your test case although it now behaves differently (the object generation never ends...)
To be continued...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants