CSC/ECE 517 Fall 2017/E1773 Investigate and Fix Expertiza Production Version Runtime Exceptions.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 34: Line 34:


     [[File:Error1.png|thumb|left|600px|pic1]][[File:Error11.png|600px|pic2]]
     [[File:Error1.png|thumb|left|600px|pic1]][[File:Error11.png|600px|pic2]]
<br/>




Line 40: Line 39:
     After investigating this error by going to the error causing url,as shown in pic1, given by airbrake under development environment,  
     After investigating this error by going to the error causing url,as shown in pic1, given by airbrake under development environment,  
     http://localhost:3000/response/view?id=91251, the error does not appear again. The last time this error occurred was 5 months ago.
     http://localhost:3000/response/view?id=91251, the error does not appear again. The last time this error occurred was 5 months ago.
     Note, the link is only accessible to super admin account.
     Note, the link is only accessible to super admin account. As you may have noticed, the picture on the right shows the passenger gem
    is called and traced, which we could file such a gem installed in the current gemfile.


''' NoMethodError: undefined method 'uniq' for nil:NilClass is one similar error that occurs during run-time '''
''' NoMethodError: undefined method 'uniq' for nil:NilClass is one similar error that occurs during run-time '''


     Similarly, by going to the error cause url(https://expertiza.ncsu.edu/sign_up_sheet/set_priority) again under development environment, there is no such page exist.
     Similarly, by going to the error cause url(https://expertiza.ncsu.edu/sign_up_sheet/set_priority) again under development environment, there is no such page exist.

Revision as of 02:01, 26 October 2017

Introduction

Background

Expertizais a open-source ruby-on-rails project on github. It constructs a peer-review system by enabling interactions among users and instructors. Students can sign up for a class, view assignments, submit assignments and give peer reviews using expertiza. Instructors can publish assignments, surveys, and reviews, view statistical results and make announcements. The website is created and currently maintained mainly by the students and faculties from NCSU.

Motivation

Airbrake is a online debugging tool for rails projects that is currently incorporated in Expertiza. Thus, Expertiza production errors at run time are tracked and reported statistically to Airbrake for reviewing and debugging. Our goal for this OSS project is to fix the top 10 run time exceptions ranked by occurrences reported to Airbrake. You can check the 10 most ranked exceptions by click on the previous hyperlink.

Airbrake Run-time Exceptions and Fixes

By investigating into the top 10 errors from airbrake, we can divide them into different categories by the root of their causes.

1. NoMethodError: undefined method for nil:NilClass (4 out of 10)
2. AbstractController::ActionNotFound (4 out of 10)
3. ActionController::InvalidAuthenticityToken (1 out of 10)
4. ActiveRecord::RecordNotFound: Couldn't find Participant without an ID (1 out of 10)

As we have discovered, the same fix can be used to fix each and every different category, which is how we categorized these exceptions initially.

Files Modified

/config/routes.rb

Exception 1. NoMethodError: undefined method 'call' for nil:NilClass

   Fix
   From the Airbrake issue page, we could find out that the problem is actually caused by a gem called passenger.
   Although we couldn't find any sign of passenger gem in the recent master branch, but there is a clear sign we 
 found during our review of other errors that some developers had used passenger.
   The gem might be under the production path `/home/rails/.rvm/gems/ruby-2.1.5/gems/passenger-5.0.16/' 
 So the solution might be just to remove the gem passenger from production environment. 
   For more information, please check here

NoMethodError: undefined method 'role' for nil:NilClass is one similar error that occurs during run-time

pic1

pic2


   After investigating this error by going to the error causing url,as shown in pic1, given by airbrake under development environment, 
   http://localhost:3000/response/view?id=91251, the error does not appear again. The last time this error occurred was 5 months ago.
   Note, the link is only accessible to super admin account. As you may have noticed, the picture on the right shows the passenger gem
   is called and traced, which we could file such a gem installed in the current gemfile.

NoMethodError: undefined method 'uniq' for nil:NilClass is one similar error that occurs during run-time

   Similarly, by going to the error cause url(https://expertiza.ncsu.edu/sign_up_sheet/set_priority) again under development environment, there is no such page exist.