Stack level too deep with actionmailer

HI,

Anytime I try to send emails with actionmailer I get a stack level too
deep SystemStackError. There were several other posts related to stack
overflows, but none of them invovled actionmailer. I’m using some
plugins acts_as_taggable, acts_as_ferret, rails 1.1.4, actionmailer
1.2.3. Here is my full stack trace.

Any ideas?

D:/dev/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.2.3/lib/action_mailer/helpers.rb:96:in
inherited_without_helper' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.2.3/lib/action_mailer/helpers.rb:96:ininherited’
#{RAILS_ROOT}/app/models/notifications.rb:1
D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
load' D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:inrequire_or_load’
D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
depend_on' D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:inrequire_dependency’
D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in
const_missing' D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:inconst_missing’
D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
const_missing' #{RAILS_ROOT}/app/models/user.rb:56:insend_confirmation’
#{RAILS_ROOT}/app/controllers/user_controller.rb:65:in
resend_confirmation' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:910:inperform_action_without_filters’
D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
D:/dev/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/rescue.rb:82:in
perform_action' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/base.rb:381:inprocess_without_filters’
D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:377:in
process_without_session_management_support' D:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/session_management.rb:117:inprocess’
D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in
dispatch' D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:115:inhandle_dispatch’
D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:81:in
service' D:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
D:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:95:instart’
D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in start' D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:instart’
D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:82:in start' D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:67:indispatch’
D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/servers/webrick.rb:59
D:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' D:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
D:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30
D:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require’
script/server:3
-e:4

This error occured while loading the following files:
notifications.rb
notifications.rb

Upgrading to 1.1.5 didn’t make this go away. I recently upgraded from
1.1.2 because my machine was hit by lightening. Prior to rebuilding my
environment I had a working application. Now I have crap! Rails could
be a nice platform but all to often it breaks because it changes too
fast. I really need some help here!

Well I see that I’m getting no help. Just someone to point me in the
right direction as to why my notifications.rb file is being infinitely
included would be helpful. Anyone? I’m just going to keep bumping this
until someone sends me a reply. The traffic on this site is so high you
can’t get visibility from the people who know what they’re talking about
to make it useful.

Andrew,

Thanks for the reply. I tried your suggestion out, but it doesn’t seem
to be an infinite loop in my code. The log statements only occured
once, and the log statements I put in my ActionMailer class weren’t
logged so it’s happenning at the time when this file is loaded. I’m not
sure why this is failing. I guess I might have rails improperly
installed. I installed it using the gem install. I guess I’m goign to
try and reinstall.

Charlie

Andrew S. wrote:

I haven’t used ActionMailer so I don’t have any insight as to whether
this
could be your issue, but what I did notice in your stack trace was the
user.send_confirmation and the user_controller.resend_confirmation.
From
the method names this would leave me to believe that you are getting
caught
up in an endless loop and that would give you the StackLevelTooDeep
message. I would put some logging statements in the send/resend methods
and
trace the log to see if that is the case.

Of course this is just a wild guess and I’m just going by the method
names
and experience with the StackLevelTooDeep issues I’ve encountered.

I haven’t used ActionMailer so I don’t have any insight as to whether
this
could be your issue, but what I did notice in your stack trace was the
user.send_confirmation and the user_controller.resend_confirmation.
From
the method names this would leave me to believe that you are getting
caught
up in an endless loop and that would give you the StackLevelTooDeep
message. I would put some logging statements in the send/resend methods
and
trace the log to see if that is the case.

Of course this is just a wild guess and I’m just going by the method
names
and experience with the StackLevelTooDeep issues I’ve encountered.

Charlie H. wrote:

HI,

Anytime I try to send emails with actionmailer I get a stack level too
deep SystemStackError.

That doesn’t look like infinite recursion, so you just have to increase
the stack limit.

$ help ulimit
ulimit: ulimit [-SHacdfilmnpqstuvx] [limit]
Ulimit provides control over the resources available to processes
started by the shell, on systems that allow such control. If an
option is given, it is interpreted as follows:
(…)

Check the stack size:
$ ulimit -s
Set it to e.g. 8 MB:
$ ulimit -s 8192

Hi Charlie,

This is probably way too late to help you out, but I had the same
frustrating problem. What I had done was changed the lines in boot.rb
from:

require_gem “rails”
require_gem “rails”, “=#{version}”

to

gem “rails”
gem “rails”, “=#{version}”

Once I changed it back to “require_gem” everything started working
again.

-Bryan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs