Create Epic fails with "duplicate iid" error
Reported by @axil. According to logs, the create epic button failed on two separate occasionas, raising a 500.
In the error, it claims the epic iid
already exists. Using Canary.
Error:
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_epics_on_group_id_and_iid"
DETAIL: Key (group_id, iid)=(9970, 5014) already exists.
backtrace
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:88:in `block in write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:84:in `block in read_write',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:130:in `retry_with_backoff',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:83:in `read_write',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:82:in `write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:56:in `block (2 levels) in <class:ConnectionProxy>',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:88:in `block in write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:84:in `block in read_write',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:130:in `retry_with_backoff',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:83:in `read_write',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:82:in `write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:56:in `block (2 levels) in <class:ConnectionProxy>',
app/services/issuable_base_service.rb:153:in `block in create',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:88:in `block in write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:84:in `block in read_write',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:130:in `retry_with_backoff',
ee/lib/gitlab/database/load_balancing/load_balancer.rb:83:in `read_write',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:82:in `write_using_load_balancer',
ee/lib/gitlab/database/load_balancing/connection_proxy.rb:56:in `block (2 levels) in <class:ConnectionProxy>',
app/services/issuable_base_service.rb:152:in `create',
ee/app/services/epics/create_service.rb:9:in `execute',
ee/app/controllers/groups/epics_controller.rb:42:in `create',
ee/lib/gitlab/ip_address_state.rb:10:in `with',
ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address',
app/controllers/application_controller.rb:499:in `set_current_admin',
lib/gitlab/session.rb:11:in `with_session',
app/controllers/application_controller.rb:490:in `set_session_storage',
lib/gitlab/i18n.rb:73:in `with_locale',
lib/gitlab/i18n.rb:79:in `with_user_locale',
app/controllers/application_controller.rb:484:in `set_locale',
lib/gitlab/error_tracking.rb:52:in `with_context',
app/controllers/application_controller.rb:549:in `sentry_context',
app/controllers/application_controller.rb:477:in `block in set_current_context',
lib/gitlab/application_context.rb:54:in `block in use',
lib/gitlab/application_context.rb:54:in `use',
lib/gitlab/application_context.rb:21:in `with_context',
app/controllers/application_controller.rb:469:in `set_current_context',
ee/lib/omni_auth/strategies/group_saml.rb:41:in `other_phase',
lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in `call',
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call',
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call',
lib/gitlab/metrics/transaction.rb:61:in `run',
lib/gitlab/metrics/rack_middleware.rb:16:in `call',
lib/gitlab/request_profiler/middleware.rb:17:in `call',
ee/lib/gitlab/database/load_balancing/rack_middleware.rb:39:in `call',
lib/gitlab/jira/middleware.rb:19:in `call',
lib/gitlab/middleware/go.rb:20:in `call',
lib/gitlab/etag_caching/middleware.rb:21:in `call',
lib/gitlab/middleware/multipart.rb:234:in `call',
lib/gitlab/middleware/read_only/controller.rb:50:in `call',
lib/gitlab/middleware/read_only.rb:18:in `call',
lib/gitlab/middleware/same_site_cookies.rb:27:in `call',
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call',
lib/gitlab/middleware/basic_health_check.rb:25:in `call',
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call',
lib/gitlab/middleware/request_context.rb:23:in `call',
config/initializers/fix_local_cache_middleware.rb:9:in `call',
lib/gitlab/metrics/requests_rack_middleware.rb:76:in `call',
lib/gitlab/middleware/release_env.rb:12:in `call'
Workaround
Create an issue for now, and promote to an epic when this issue has been fixed. (thank you @fcatteau !)
Edited by charlie ablett