Investigate fork API failure
Why
An error regarding forking was reported here: Error 500 , while executing API call to restor... (#576046)
Pool repository management is connected to the forking process, so there's a chance that investigating this forking error could yield insight into how we are ending up with a small number of pool_repositories that do not have a source_project_id
. The error message being reported ActiveRecord::RecordNotSaved: Failed to remove the existing associated fork_network_member. The record failed to save after its foreign key was set to nil.
seems like it could be related.
The summary in #490484 has more details about the missing source_project_id
s on pool_repositories
.
While we have one issue focused on data resolution here: https://gitlab.com/gitlab-org/gitlab/-/issues/573591, I'd like this issue to focus on the root cause and see if we can figure out why we end up in this situation, and fix it.
DRI to-dos for this issue
-
reproduce the issue -
try doing it locally -
document steps on this issue of how to reproduce -
try writing a spec that reproduces the failure. If possible, post diff in issue
-
-
understand the root cause of the error reported above -
document backtraces -
document relevant code paths -
if able to spike a fix, post rough draft or diff on this issue
-
-
check pool_repositories to see if reproducing the error results in pool_repository
records with nosource_project_id
-
create a implementation issue for the fix and refine it so it's workflowready for development
DRI resources
Logs
- kibana logs to recent errors: https://log.gprd.gitlab.net/app/r/s/oapgI
Backtrace
Backtrace for one of the errors:
Click to expand
app/services/projects/fork_service.rb:130:in `build_fork_network_member',
app/services/projects/fork_service.rb:49:in `link_existing_project',
ee/app/services/ee/projects/fork_service.rb:40:in `link_existing_project',
app/services/projects/fork_service.rb:6:in `execute',
lib/api/projects.rb:776:in `block (2 levels) in <class:Projects>',
lib/api/api_guard.rb:272:in `call',
lib/gitlab/middleware/ip_address.rb:14:in `block in call',
lib/gitlab/ip_address_state.rb:11:in `with',
lib/gitlab/middleware/ip_address.rb:13:in `call',
lib/api/api_guard.rb:272:in `call',
config/initializers/action_dispatch_journey_router.rb:52:in `block in find_routes',
config/initializers/action_dispatch_journey_router.rb:25:in `map!',
config/initializers/action_dispatch_journey_router.rb:25:in `find_routes',
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/sidekiq_shard_awareness_validation.rb:20:in `block in call',
lib/gitlab/sidekiq_sharding/validator.rb:42:in `enabled',
lib/gitlab/middleware/sidekiq_shard_awareness_validation.rb:20:in `call',
lib/gitlab/middleware/memory_report.rb:13:in `call',
lib/gitlab/middleware/speedscope.rb:13:in `call',
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call',
lib/gitlab/middleware/rails_queue_duration.rb:33:in `call',
lib/gitlab/etag_caching/middleware.rb:21:in `call',
lib/gitlab/metrics/rack_middleware.rb:16:in `block in call',
lib/gitlab/metrics/web_transaction.rb:46:in `run',
lib/gitlab/metrics/rack_middleware.rb:16:in `call',
lib/gitlab/middleware/go.rb:21:in `call',
lib/gitlab/middleware/query_analyzer.rb:11:in `block in call',
lib/gitlab/database/query_analyzer.rb:83:in `within',
lib/gitlab/middleware/query_analyzer.rb:11:in `call',
lib/ci/job_token/middleware.rb:11:in `call',
lib/gitlab/middleware/multipart.rb:174:in `call',
lib/gitlab/middleware/read_only/controller.rb:40:in `call',
lib/gitlab/middleware/read_only.rb:18:in `call',
lib/gitlab/middleware/unauthenticated_session_expiry.rb:18:in `call',
lib/gitlab/middleware/secure_headers.rb:11:in `call',
lib/gitlab/middleware/same_site_cookies.rb:27:in `call',
lib/gitlab/middleware/path_traversal_check.rb:40:in `call',
lib/gitlab/middleware/handle_malformed_strings.rb:19:in `call',
lib/gitlab/middleware/json_validation.rb:177:in `allow_if_validated',
lib/gitlab/middleware/json_validation.rb:158: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:15:in `call',
lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call',
config/initializers/fix_local_cache_middleware.rb:11:in `call',
lib/gitlab/middleware/compressed_json.rb:44:in `call',
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call',
lib/gitlab/metrics/requests_rack_middleware.rb:83:in `call',
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call',
lib/gitlab/middleware/release_env.rb:12:in `call'