Description
We intermittently (a few times a week) see Errno::ENOENT
errors when calling CodeOwnership.for_file
where code ownership claims that a file we're looking up ownership for doesn't exist. It happens for different paths, not always the same path. There doesn't seem to be any obvious pattern for when this happens. The file exists and is found on 99.9% of requests. I've included the gem-specific portion of the trace below. Any ideas on how to track this down? For now we've added a begin
/rescue
block around it, but obviously that's not an ideal solution. It's really weird given that I can pass a path that definitely doesn't exist to CodeOwnership.for_file
and it doesn't error, just returns nil
.
The error has the signature Errno::ENOENT: No such file or directory @ rb_sysopen - path/to/file/that/exists.rb
.
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership/private/ownership_mappers/file_annotations.rb:86:in `foreach'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership/private/ownership_mappers/file_annotations.rb:86:in `each'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership/private/ownership_mappers/file_annotations.rb:86:in `first'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership/private/ownership_mappers/file_annotations.rb:86:in `file_annotation_based_owner'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `bind_call'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `block in create_validator_method_medium1'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership/private/ownership_mappers/file_annotations.rb:29:in `map_file_to_owner'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `bind_call'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `block in create_validator_method_medium1'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership.rb:41:in `block in for_file'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership.rb:40:in `each'
,
/app/vendor/bundle/ruby/3.3.0/gems/code_ownership-1.36.2/lib/code_ownership.rb:40:in `for_file'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `bind_call'
,
/app/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11372/lib/types/private/methods/call_validation_2_7.rb:968:in `block in create_validator_method_medium1'