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

SystemStackError (stack level too deep) #29

Closed
dafevara opened this issue Mar 27, 2011 · 18 comments
Closed

SystemStackError (stack level too deep) #29

dafevara opened this issue Mar 27, 2011 · 18 comments

Comments

@dafevara
Copy link

after follow installation guide, i reinit mongrel server and then i got this:
SystemStackError (stack level too deep)
/home/dafevara/proyectos/publientrega/pec/vendor/plugins/wicked_pdf/lib/pdf_helper.rb:16:in render_with_wicked_pdf' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/base.rb:1326:indefault_render'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/base.rb:1332:in perform_action' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/filters.rb:617:incall_filters'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in perform_action_with_filters' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:inblock in perform_action_with_benchmark'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in block in ms' /usr/lib/ruby/1.9.1/benchmark.rb:309:inrealtime'
/usr/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in ms' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:inperform_action_with_benchmark'
any body can help me?
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in perform_action_with_rescue' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:inperform_action_with_flash'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in process' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:inprocess_with_filters'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in process' /usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:incall'
/usr/lib/ruby/gems/1.9.1/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in `call'

my environment is:
Ruby 1.9.1
Ubuntu 9.10

@unixmonkey
Copy link
Collaborator

Can you paste your controller code?, line 16 of pdf_helper is being called because your call to render doesn't have the :pdf key like so:

render :pdf => 'name_of_pdf'

@dafevara
Copy link
Author

unixmonkey: thanks for your answaer. I just follow the install guide and reinit the mongrel server and then i got the error, I've not written a single code line yet.

thanks in advance for your help.

@dafevara
Copy link
Author

i've installed in a centos 5.5 over a amd64 box, the old instalation was in a i386 box and i got the same problem. Did i miss something ? i just follow the install guide, reinit and the problem comes out.

@unixmonkey
Copy link
Collaborator

I'm trying. I installed 1.9.1 and Rails 3 & wicked_pdf and its at least booting here.
Rails 2.3.11 and Webrick are working too, but I can't get mongrel to even build on 1.9.1

What version of Rails, and which wkhtmltopdf binary do you have?

@dafevara
Copy link
Author

im using rails 2.3.8 and wkhtmltopdf 10

Daniel.

On Wed, Mar 30, 2011 at 6:07 PM, unixmonkey <
reply@reply.github.com>wrote:

I'm trying. I installed 1.9.1 and Rails 3 & wicked_pdf and its at least
booting here.
Rails 2.3.11 and Webrick are working too, but I can't get mongrel to even
build on 1.9.1

What version of Rails, and which wkhtmltopdf binary do you have?

Reply to this email directly or view it on GitHub:
#29 (comment)

@clifton
Copy link

clifton commented Apr 5, 2011

This error is always raised with Ruby 1.9.2-p180.

render_without_wicked_pdf(options, *args, &block)

That line triggers it.

@clifton
Copy link

clifton commented Apr 5, 2011

Edit: Rails 2.3.8 and 2.3.11

@DevL
Copy link

DevL commented Apr 12, 2011

I can confirm that Wicked PDF does not work with the following on OS X 10.6.7, Rails 3.0.6 and wkhtmltopdf 0.9.9:

ruby 1.9.2.-p180
ruby 1.9.1-p376

In both cases I get a "SystemStackError (stack level too deep)". The relevant controller code used is:

  format.pdf  {
    render :pdf => @horse.name,      # .pdf is automatically appended by Wicked PDF
           :template => 'horses/show.pdf.erb',
           :layout => 'pdf.html',
           :footer => {
              :center => "Center",
              :left => "Left",
              :right => "Right"
           }
  }

The template and layout exists and everything works just fine with ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0].

@penguincoder
Copy link
Contributor

I am experiencing the same issue with Ruby 1.9.2-p180

After much spelunking, it looks like it is failing, very specifically, at:

html_string = render_to_string(:template => options[:template], :layout => options[:layout])

in make_pdf in lib/pdf_helper.rb.

I am beginning to suspect that it keeps calling itself because there might be some other plugin aliasing render and causing some sort of conflict. As it turns out, i am using inherit_views and inherited_resources which i know for sure that inherit_views aliases render. I will post more when i figure out exactly how to fix this.

@clifton
Copy link

clifton commented Apr 14, 2011

right on, nice work penguin. post again when you find a fix.

@penguincoder
Copy link
Contributor

I found the fix, but there is still another issue i have not yet worked out having to do with Ruby19 and character encodings.

I am out for the evening; the Predators are playing the Ducks and i have to go get my McRinne jersey and watch the game. I will look into the encoding issue tomorrow.

@unixmonkey
Copy link
Collaborator

I've merged penguincoder's work into master. Please let me know if this helps.

@DevL
Copy link

DevL commented Apr 18, 2011

Just tested your latest version with OS X 10.6.7, RVM, Ruby 1.9.2 and the issue is resolved. Great work everyone!

@clifton
Copy link

clifton commented Apr 18, 2011

Failed to execute /usr/local/bin/wkhtmltopdf: undefined method `capture3' for Open3:Module

In Ruby 1.8.7

Looks like a call to RUBY_VERSION is in order to penguincoder's commit.

@DevL
Copy link

DevL commented Apr 18, 2011

No problem running it on OS X 10.6.7 with standard 1.8.7.

Also tried RVM versions of REE and 1.8.7-p334 apart from the earlier testing of 1.9.2-p180.

No issues with my testapp over at https://github.com/DevL/shownotes/tree/master/SHRUG_2011-04-13_PDF/wicked

@penguincoder
Copy link
Contributor

Hey guys, look at this (from $RUBYHOME/lib/open3.rb in 1.9.2)

popen3(*cmd, opts) {|i, o, e, t|
  if binmode
    i.binmode
    o.binmode
    e.binmode
  end
  out_reader = Thread.new { o.read }
  err_reader = Thread.new { e.read }
  i.write stdin_data
  i.close
  [out_reader.value, err_reader.value, t.value]
}

If we just call binmode on the stdout variable, it should work with the old code.

@unixmonkey
Copy link
Collaborator

@clifton, you are right, capture3 isn't in older 1.8.7, I missed that being on ree-1.8.7-2010.02, but it definitely isn't in p160

@penguincoder, I saw that and backported it to wicked_pdf's call to popen3.

@DevL, Thanks for the presentation link. I used it to make sure the encoding stuff works. Also, you don't need to specify the template if its named after the action; and a better way to install wkhtmltopdf for a rails app these days is just add "gem 'wkhtmltopdf-binary'" to the Gemfile.

All, thanks for your help. Please let me know if there are any further issues.

@clifton
Copy link

clifton commented Apr 18, 2011

Right on. Thanks for giving this issue attention. I'll update
wicked_pdf on our application when its working in 1.8.7 and 1.9.2.
This was an issue holding back our code migration to 1.9.2.

On Mon, Apr 18, 2011 at 2:53 PM, unixmonkey
reply@reply.github.com
wrote:

@clifton, you are right, capture3 isn't in older 1.8.7, I missed that being on ree-1.8.7-2010.02, but it definitely isn't in p160

@penguincoder, I saw that and backported it to wicked_pdf's call to popen3.

All, thanks for your help. Please let me know if there are any further issues.

Reply to this email directly or view it on GitHub:
#29 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants