Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.1.4
-
Fix Version/s: None
-
Component/s: Interpreter
-
Labels:None
-
Environment:Linux, Java 6
-
Number of attachments :
Description
Since rev #7457 "Modify exception construction to memoize frame details in StackTraceElement[] and not construct the Array+String-based backtrace until actually needed", stack traces can be incomplete.
Let's take that example taken from a real Rails 2.1 app were I had a raise opinion.inspect statement somewhere inside a file called app/sweepers/opinions_sweeper.rb. So I was actually raising the error myself but had not clue what was going one because of the incorrect log:
Here is the stck with JRuby after rev #7457:
RuntimeError (#<Opinion id: 254, user_id: 0, topic_id: 85, own_summary: "no", own_text: "", own_url: "", cached_score: 0.0, cached_pool_priority: 0, cached_debt_counter: 0, created_at: "2008-08-22 22:08:23", updated_at: "2008-08-22 22:08:23", cached_level1: nil, cached_level2: nil, cached_tmp_debt_counter: 0, ip_code: 2130706433>):
/vendor/rails/activerecord/lib/active_record/transactions.rb:127:in `rollback_active_record_state!'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save_with_transactions'
/app/controllers/opinions_controller.rb:73:in `create'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `call'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `respond_to'
/app/controllers/opinions_controller.rb:72:in `create'
Now, the same error running MRI or a previous JRuby version:
RuntimeError (#<Opinion id: 255, user_id: 0, topic_id: 86, own_summary: "my op", own_text: "", own_url: "", cached_score: 0.0, cached_pool_priority: 0, cached_debt_counter: 0, created_at: "2008-08-23 00:23:33", updated_at: "2008-08-23 00:23:33", cached_level1: nil, cached_level2: nil, cached_tmp_debt_counter: 0, ip_code: 2130706433>):
/app/sweepers/opinions_sweeper.rb:21:in `expire_cache_for'
/app/sweepers/opinions_sweeper.rb:8:in `after_create'
/vendor/rails/activerecord/lib/active_record/observer.rb:171:in `send'
/vendor/rails/activerecord/lib/active_record/observer.rb:171:in `update'
/usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'
/usr/lib/ruby/1.8/observer.rb:184:in `each'
/usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:309:in `notify'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:302:in `callback'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:221:in `create_without_timestamps'
/vendor/rails/activerecord/lib/active_record/timestamp.rb:29:in `create'
/vendor/rails/activerecord/lib/active_record/base.rb:2464:in `create_or_update_without_callbacks'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:207:in `create_or_update'
/vendor/rails/activerecord/lib/active_record/base.rb:2192:in `save_without_validation'
/vendor/rails/activerecord/lib/active_record/validations.rb:901:in `save_without_dirty'
/vendor/rails/activerecord/lib/active_record/dirty.rb:75:in `save_without_transactions'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:79:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:98:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `rollback_active_record_state!'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/app/controllers/opinions_controller.rb:73:in `create'
I think this regression would be better fixed before 1.1.4 or some users will have lots of headache at debugging.
Hope this helps;
Raphaël Valyi
I made some improvements in r7552 that will hopefully help this. Unfortunately it's really, really hard to find what's different without a reproducible case. Raphael, anything you can do to help confirm this would be greatly appreciated, since nobody else has reported stack trace issues in their apps yet.