From: Bezan Kapadia Date: 2009-02-10T09:28:50+09:00 Subject: Re: Got SystemStackError exception: stack level too deep I see ... My code below : The function 1 calls the function mail_system every 60 seconds. Take a look at my 2 functions below and can u suggest of what should I really change to do away with this issue require 'net/smtp' def mail_system(message,i) user=`echo $USER`.chomp recipient=user+"@gmail.com" msg = "#{message}" Net::SMTP.start('smtp.gmail.com',25) do |smtp| smtp.send_message(msg, "#{recipient}", "#{recipient}") Notification for Email Sent completion - #{message}" end rescue Timeout::Error => e $mes_trace.error("Got #{e.class} exception: #{e.message}") puts "Got #{e.class} exception: #{e.message}" exit false end def function1 ........ mail_system(message,i) rescue Exception => e $mes_trace.error("Got #{e.class} exception: #{e.message}") puts "Got #{e.class} exception: #{e.message}" end sleep(60) end Tony Arcieri wrote: > On Mon, Feb 9, 2009 at 4:12 PM, Bezan Kapadia wrote: > >> Can someone explain what does this error really mean "Got >> SystemStackError exception: stack level too deep" ? >> and if there are anything to look for or keep in mind to contain or >> prevent this error or some kind of work around etc...? >> > > It means that you have too many calls to functions which are in turn > calling > other functions before returning. A quick and easy way to cause a > similar > error is: > > def foo; foo; end > foo > > The stack trace you get with the SystemStackError will be enormously > helpful > in diagnosing this problem. Perhaps you can paste it to the list? -- Posted via http://www.ruby-forum.com/.