3
votes

I've run into a real big problem. My App is doing a few thousands SQL queries and then suddenly this error occurs. It doesn't make a difference if I exec my code via a rake task or the rails console directly.

Does anyone know what this means? Never seen this error in relation to the rails logger.

env:
ruby-2.1.2
postgres 9.3
rails 4.1.5

Could not log "sql.active_record" event. SystemStackError: stack level too deep ["/Users  /ghostrifle/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:46"]
SystemStackError: stack level too deep
from /Users/ghostrifle/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86
Maybe IRB bug!

the exception raises after 23 callers.

Here's the inspect of the SystemStackError exception

[
  "/Users/ghostrifle/Entwicklung/xxx_main/lib/tasks/tree_spot.rake:42:in `block (2 levels) in <top (required)>'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in `call'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in `each'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'",
  "/Users/ghostrifle/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/bin/rake:23:in `load'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/bin/rake:23:in `<main>'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'",
  "/Users/ghostrifle/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'"
]
1
anything in particular going on when this started happening? have you checked there's no endless recursion in your code? have a look at this dalibornasevic.com/posts/… - dabadaba
thnx for the link, I'm trying now the ulimit command - ghostrifle
well.. my stack size was 8192 huge.. but even after increasing it via "ulimit -s 16384" doesn't help. same error, and still 23 callers - ghostrifle
I can't think of another solution than going through your code and looking for possible endless recursive loops. When do you get this error exactly? - dabadaba

1 Answers

0
votes

Could you please show the code which is causing this problem. From my understanding you are keeping a stack to which your are adding data fetched from the database, but maybe you are not initializing it to []. So each time you are running your code the data is getting piled up and eventually is causing this problem.