Content
Bug OP-4090: Internal error in rescheduling when trying to delete [some] work-packages, delete fails
View differences
Updated by Oliver Günther almost 9 years ago
I am running an instance of OpenProject CE exclusively on top of a clean Ubuntu 16.04, latest patch level. OpenProject packages are standard distribution packages from *packager.io* - latest version 7.2.0.
Users recently started complaining that they could not delete certain work-packages anymore. Instead they were presented with “Internal Error” pages. The behavior is reproducible across multiple accounts with different levels of privileges all the way up to admin. The attached log file (*production.log*) shows a string of errors of two distinct types, triggered by trying to delete the work packages and, sometimes, triggered by changing their relationship to other packages.
**Type 1 looks as follows**
F, \[2017-08-17T07:13:58.264638 \#3309\] FATAL — :
F, \[2017-08-17T07:13:58.264714 \#3309\] FATAL — : NoMethodError (undefined method \`+’ for nil:NilClass):
F, \[2017-08-17T07:13:58.264741 \#3309\] FATAL — :
F, \[2017-08-17T07:13:58.264765 \#3309\] FATAL — : app/models/work\_package/scheduling\_rules.rb:56:in \`reschedule\_by’
app/models/relation.rb:137:in \`move\_target\_dates\_by’
app/models/work\_package.rb:771:in \`block in reschedule\_following\_work\_packages’
app/models/work\_package.rb:771:in \`reschedule\_following\_work\_packages’
app/models/work\_package.rb:673:in \`recalculate\_attributes\_for’
app/models/work\_package.rb:678:in \`update\_parent\_attributes’
app/models/work\_package.rb:673:in \`recalculate\_attributes\_for’
app/models/work\_package.rb:678:in \`update\_parent\_attributes’
app/controllers/work\_packages/bulk\_controller.rb:102:in \`block in destroy\_work\_packages’
app/controllers/work\_packages/bulk\_controller.rb:100:in \`destroy\_work\_packages’
app/controllers/work\_packages/bulk\_controller.rb:84:in \`destroy’
app/middleware/reset\_current\_user.rb:47:in \`call’
**Type 2 starts with**
E, \[2017-08-17T07:14:15.240076 \#3309\] ERROR — : Grape rescuing from error: API::Errors::InternalError
Original error: \#\<NoMethodError: undefined method \`+’ for nil:NilClass\>
Stacktrace:
/opt/openproject/app/models/work\_package/scheduling\_rules.rb:56:in \`reschedule\_by’
/opt/openproject/app/models/relation.rb:137:in \`move\_target\_dates\_by’
/opt/openproject/app/models/work\_package.rb:771:in \`block in reschedule\_following\_work\_packages’
\[…\]
Although I am not 100% sure as I have not managed to reproduce this yet, it seems to be related to work packages which are (or once were) located deeper in a hierarchy of work packages, at least two levels below the top level work package. The problem can be worked around, more or less, by resolving the tree of work packages, making them all top-level within the respective project, and then deleting the ones in question. After that, the tree must be rebuild.
Any suggestions on how to bisect this issue are highly appreciated.
Users recently started complaining that they could not delete certain work-packages anymore. Instead they were presented with “Internal Error” pages. The behavior is reproducible across multiple accounts with different levels of privileges all the way up to admin. The attached log file (*production.log*) shows a string of errors of two distinct types, triggered by trying to delete the work packages and, sometimes, triggered by changing their relationship to other packages.
**Type 1 looks as follows**
F, \[2017-08-17T07:13:58.264638 \#3309\] FATAL — :
F, \[2017-08-17T07:13:58.264714 \#3309\] FATAL — : NoMethodError (undefined method \`+’ for nil:NilClass):
F, \[2017-08-17T07:13:58.264741 \#3309\] FATAL — :
F, \[2017-08-17T07:13:58.264765 \#3309\] FATAL — : app/models/work\_package/scheduling\_rules.rb:56:in \`reschedule\_by’
app/models/relation.rb:137:in \`move\_target\_dates\_by’
app/models/work\_package.rb:771:in \`block in reschedule\_following\_work\_packages’
app/models/work\_package.rb:771:in \`reschedule\_following\_work\_packages’
app/models/work\_package.rb:673:in \`recalculate\_attributes\_for’
app/models/work\_package.rb:678:in \`update\_parent\_attributes’
app/models/work\_package.rb:673:in \`recalculate\_attributes\_for’
app/models/work\_package.rb:678:in \`update\_parent\_attributes’
app/controllers/work\_packages/bulk\_controller.rb:102:in \`block in destroy\_work\_packages’
app/controllers/work\_packages/bulk\_controller.rb:100:in \`destroy\_work\_packages’
app/controllers/work\_packages/bulk\_controller.rb:84:in \`destroy’
app/middleware/reset\_current\_user.rb:47:in \`call’
**Type 2 starts with**
E, \[2017-08-17T07:14:15.240076 \#3309\] ERROR — : Grape rescuing from error: API::Errors::InternalError
Original error: \#\<NoMethodError: undefined method \`+’ for nil:NilClass\>
Stacktrace:
/opt/openproject/app/models/work\_package/scheduling\_rules.rb:56:in \`reschedule\_by’
/opt/openproject/app/models/relation.rb:137:in \`move\_target\_dates\_by’
/opt/openproject/app/models/work\_package.rb:771:in \`block in reschedule\_following\_work\_packages’
\[…\]
Although I am not 100% sure as I have not managed to reproduce this yet, it seems to be related to work packages which are (or once were) located deeper in a hierarchy of work packages, at least two levels below the top level work package. The problem can be worked around, more or less, by resolving the tree of work packages, making them all top-level within the respective project, and then deleting the ones in question. After that, the tree must be rebuild.
Any suggestions on how to bisect this issue are highly appreciated.