# Stack level too deep with actionmailer

**URL:** <https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543>\
**Category:** Rails\
**Created:** [August 9, 2006, 9:25pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543 "2006-08-09T21:25:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [August 9, 2006, 9:25pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/1 "2006-08-09T21:25:24Z")

</div>

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:in`inherited’  
#{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:in`require\_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:in`require\_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:in`const\_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:in`send\_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:in`perform\_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:in`perform\_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:in`perform\_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:in`process\_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:in`process’  
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:in`handle\_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:in`service’  
D:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:in`start\_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:in`start’  
D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start' D:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:in`start’  
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:in`dispatch’  
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:in`require’  
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

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [August 10, 2006, 3:31pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/2 "2006-08-10T15:31:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [August 11, 2006, 8:44pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/3 "2006-08-11T20:44:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [August 15, 2006, 9:09pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/4 "2006-08-15T21:09:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/5 "2006-08-15T14:18:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [March 2, 2007, 5:19pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/6 "2007-03-02T17:19:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e56c9b/32.png) [@chubbard](https://www.ruby-forum.com/u/chubbard)\
**Post date:** [March 2, 2007, 8:08am UTC](https://www.ruby-forum.com/t/stack-level-too-deep-with-actionmailer/64543/7 "2007-03-02T08:08:11Z")

</div>

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
