question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] StackOverflowError: com.google.gson.internal loop error

See original GitHub issue

Hi, im testing the playwright-java maven plugin, the version 0.180.0, with JDK 1.8 and maven project in java 1.8. I have a loop error trying the example test PageScreenshot

This is the loop error:

Exception in thread "main" java.lang.StackOverflowError
	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:378)
	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:383)

       // + 750 times loop code

	at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:358)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:158)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	// + 250 times loop code
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:100)
	at com.google.gson.Gson.getAdapter(Gson.java:423)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:115)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:164)

How can I solve this? Thanks everyone for your help

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:28 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Katakurinnacommented, Feb 8, 2021

Solved! I had a similar problem with another library and here I explain the problem in detail. https://github.com/MrGraversen/rust-rcon/pull/2

The error in short, is that Gson from JDK 12 fails, even if you compile in a previous java. The solution is to go to the latest version of Gson image image

Edit: Reviewing I have seen that you have the latest version of playwright. Probably then, that you are trying to use an older version and not the latest one.

Edit 2: Ok, in the latest version you don’t define the gson version, project can try to use another version. In the new one, you do define it to the latest version.

0reactions
yury-scommented, Feb 8, 2021

Thanks for the thorough investigation!

In the current version of playwright it does not specify the required version of gson.

The version is specified the dependency management section of this pom.xml which is specified as parent project for playwright. As far as I understand this should enforce the version for all submodules but it looks like it does not happen in your case.

I’m closing this for now, but please feel free to reopen if you believe we can fix it on playwright end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gson.toJson() throws StackOverflowError - Stack Overflow
I encountered this issue when passing service object reference as context. Fix was to make the context variable static in the class that...
Read more >
Issue 440 in google-gson: Infinity loop at recursive calling com ...
New issue 440 by metricst...@gmail.com: Infinity loop at recursive calling com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
Read more >
The StackOverflowError in Java - Baeldung
This stack trace shows the line numbers that cause the problem in the two classes that are in a cyclic relationship. Line number...
Read more >
How to Fix java.lang.StackOverflowError in Java - Rollbar
The java.lang.StackOverflowError is a runtime error which points to serious problems that cannot be caught by an application. The java.lang.
Read more >
StackOverflowError in Java with examples - GeeksforGeeks
StackOverflowError is an error which Java doesn't allow to catch, for instance, stack running out of space, as it's one of the most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found