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
Require Crashes with StackOverflowError and Stack Level Too Deep #375
Comments
You'll find that this is a problem that is encountered frequently. You just require 'ruboto/util/stack' In this case, your calling thread will wait for the large-stack thread to On Thu, Mar 14, 2013 at 4:43 AM, Ashiq Alibhai notifications@github.comwrote:
|
On 2013-03-14, at 19:52, Scott Moyer notifications@github.com wrote:
Since this has been a very common case, the upcoming Ruboto 0.11.0 release has changed to load the entry scripts in a thread with 128KB stack. Have any of you had any need for more that 128KB stack when doing a require in an Activity, Service, or BroadcastReceiver? Uwe Kubosch |
I tried wrapping |
try adding an argument to with_large_stack to get even larger stack: with_large_stack(256) do
require 'gosu'
end or with_large_stack(:size => 256) do
require 'gosu'
end |
I retract my comment. It looks like Thanks! |
I found an issue that digs deep down to JRuby. Let me start from the beginning; I want to include opengl or gosu into a Ruboto app. So I generate a new ruboto template, and add
require 'opengl'
orrequire 'gosu'
.Gosu is easier, since I just drop in the source for Android-Gosu, and don't need to worry about getting the gem working (I opened another issue here about bundling gems).
This results in either
StackOverflowError: null
orStack level too deep
. The underlying issue is that requiring a bunch of stuff needs a large stack space. Stack Overflow suggests passing in something like-Xms512k
tobundle
to get around this, which we obviously can't do.So, this seems like a general bug that phones have very limited stack space, and may cause Ruboto to explode. Here's a simple repro case I distilled:
requires 'a'
requires 'b'
requires 'c'
requires 'j'
puts "You made it!'
On BlueStacks, this explodes fairly quickly. Not sure about on the Android emulator. On my phone (Samsung Galaxy Discover), this explodes on
g.rb
.Again, this is not theoretical, but a distillation of my real crash from trying to include
android-gosu
(lots ofrequire
calls) into a Ruboto app. You can read the catlog stack there. It ends with a bunch of these:Please advise.
The text was updated successfully, but these errors were encountered: