My application uses this API from GAE:
URLFetchServiceFactory.getURLFetchService().fetch
Which works running on devserver
but after 30 to 60 minutes (time varies) it starts throwing StackOverflowError
.
In what way that a call to fetch
to a standard web URL could actually cause URLFetchServiceFactory.getURLFetchService().fetch
to throw SO error.
Here's the complete log: https://pastebin.com/WCcmXCH3 (long)
I have found the culprit of the StackOverflowError after several hours of digging, apparently the for-loop before the call to fetch is causing this, here:
Whereas, the
cachedLinks
contains thousands of String values. Removing the for-loop stopped the throwing ofStackOverflowError
.Maybe a Java guru can better explain this phenomenon better and why the for-loop above the call to
fetch
call.The stack depth in the complete log has a very suspicious value of 1025 = 1024 +1.
A closer look reveals that you have this repeating recursive call sequence:
I'm not a Java user, but if I interpret it correctly it appears you may be processing a directory structure too deep.
If so, either re-arrange the directory structure or modify your code to limit how deep it goes into it in one-shot.