Defect #35655

Create duplicated follows relations fails with 500 internal error

Added by Marius BALTEANU about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Issues
Target version:4.2.3
Resolution:Fixed Affected version:4.2.0

Description

It seems that the relation validations are not covering all the cases and if you try to add two duplicated follows relations, the request fails with 500 internal error. The issue reproduces only on 4.2.* versions and it's caused by #33418.

I, [2021-08-01T16:29:31.426087 #19530]  INFO -- : Completed 500 Internal Server Error in 117ms (ActiveRecord: 70.3ms | Allocations: 8146)

F, [2021-08-01T16:29:31.427135 #19530] FATAL -- :   
ActiveRecord::RecordNotUnique (Mysql2::Error: Duplicate entry '1-2' for key 'issue_relations.index_issue_relations_on_issue_from_id_and_issue_to_id'):

app/controllers/issue_relations_controller.rb:67:in `block in create'
app/controllers/issue_relations_controller.rb:51:in `each'
app/controllers/issue_relations_controller.rb:51:in `create'

33feaa6c980b9ceec151dd2fb760ff54f9b2cec1.patch Magnifier (2.36 KB) Marius BALTEANU, 2021-08-06 01:52


Related issues

Related to Redmine - Feature #33418: Bulk addition of related issues Closed

Associated revisions

Revision 21150
Added by Marius BALTEANU about 1 month ago

Fixed create duplicate follow relation fails with 500 internal error (#35655).

Revision 21153
Added by Marius BALTEANU about 1 month ago

Merged r21150 to 4.2-stable (#35655).

History

#1 Updated by Marius BALTEANU about 1 month ago

#2 Updated by Marius BALTEANU about 1 month ago

  • Subject changed from Create duplicated follows relation fails with 500 internal error to Create duplicated follows relations fails with 500 internal error

#3 Updated by Marius BALTEANU about 1 month ago

Attached a patch to fix this.

#4 Updated by Marius BALTEANU about 1 month ago

  • Status changed from New to Resolved
  • Resolution set to Fixed

Fixed in r21150.

#5 Updated by Marius BALTEANU about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF