Project

General

Profile

Actions

Defect #7018

closed

'undefined method `reschedule_after' for nil:NilClass' on new issues

Added by Bruno Medeiros over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
2010-12-02
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I'm trying to use the REST API to submit some issues, but I'm getting the following error:

NoMethodError
in IssuesController#create
undefined method `reschedule_after' for nil:NilClass

This problem doesn't occurs always, but I couldn't find a pattern up to now.
It does not happen on redmine 1.0.3.

Actions #1

Updated by Bruno Medeiros over 13 years ago

I did several tests now and no pattern yet. Submitting the same xml works once, then fails, then works again. The full stack is:

/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue_relation.rb:88:in `set_issue_to_dates'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue.rb:764:in `reschedule_following_issues'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `each'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/models/issue.rb:763:in `reschedule_following_issues'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in `run'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `each'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in `run'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:in `callback'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:251:in `create_or_update'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2538:in `save_without_validation'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1078:in `save_without_dirty'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:79:in `save_without_transactions'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save'
/home/bruno.medeiros/Aptana RadRails Workspace/redmine-1.0/app/controllers/issues_controller.rb:129:in `create'

It seems that some code creates a IssueRelation with 'issue_to' nil.

Actions #2

Updated by Bruno Medeiros over 13 years ago

I did a new 1.0.4 checkout and the problem doesn't seem to be present. It's very strange, because a diff in both working copies only show unrelated files..

Is there any change that a deleted plugin caused something like that? Is there any way to reset any plugin data?

Actions #3

Updated by Bruno Medeiros over 13 years ago

Mi thoughts on previuos post were wrong, the problem happens also with the new 1.0.4 checkout.

After several hours of debugging, I tried to see if there was something wrong with my data. so I ran the following query:

select * FROM issue_relations
where issue_from_id not in
(select id from issues)
or issue_to_id not in
(select id from issues)

Surprisingly, this query returned a lot of lines!! After delete those entries, the problem was gone.

I don't understand how could invalid entries on the table issue_relation could influence the creation of a new issue, but it does indeed. I created a new issue asking for FK contraints, #7032.

Please close it as 'not a bug'.

Actions #4

Updated by Jean-Philippe Lang over 13 years ago

  • Subject changed from Issue REST API giving 'undefined method `reschedule_after' for nil:NilClass' on new issues to 'undefined method `reschedule_after' for nil:NilClass' on new issues
  • Status changed from New to Resolved
  • Target version set to 1.0.5
  • Resolution set to Fixed

r4467 will prevent this error to occur.

Actions #5

Updated by Jean-Philippe Lang about 13 years ago

  • Status changed from Resolved to Closed

Fix merged in 1.0-stable.

Actions

Also available in: Atom PDF