ruby-rdf / rdf

RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.
http://rubygems.org/gems/rdf
The Unlicense
382 stars 92 forks source link

Strange "file missing" error with 3.1.14 release #426

Closed ijdickinson closed 3 years ago

ijdickinson commented 3 years ago

I have a strange issue that I want to report, even though I don't have a complete characterisation yet.

I've just done a bundle update on one of our Rails apps, and that pulled in rdf 3.1.14. At which point, the app failed to start with this stacktrace (trimmed for brevity) in the log file:

App 17289 output: Error: The application encountered the following error: No such file to load -- rdf/model/literal.rb (LoadError)
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `require'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `block in require'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:291:in `load_dependency'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `require'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/uri.rb:732:in `=='
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/uri.rb:757:in `==='
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:182:in `process_iri'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:214:in `prefix'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:294:in `block (2 levels) in read_directive'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:559:in `prod'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:287:in `block in read_directive'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:559:in `prod'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:265:in `read_directive'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:249:in `block in read_statement'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:559:in `prod'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:245:in `read_statement'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:136:in `each_statement'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:322:in `block in insert_statements'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/enumerable.rb:171:in `each'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/enumerable.rb:171:in `each'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/enumerable.rb:171:in `each_statement'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/writable.rb:129:in `insert_statements'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/writable.rb:64:in `block in insert'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/util/coercions.rb:38:in `block in coerce_statements'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/util/coercions.rb:35:in `map'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/util/coercions.rb:35:in `coerce_statements'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/writable.rb:64:in `insert'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/mutable.rb:96:in `insert'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:328:in `insert_statements'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/mutable.rb:54:in `block in load'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:113:in `block in initialize'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/reader.rb:319:in `instance_eval'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/reader.rb:319:in `initialize'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:93:in `initialize'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-turtle-3.1.3/lib/rdf/turtle/reader.rb:65:in `new'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/reader.rb:244:in `block in open'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/util/file.rb:340:in `open_file'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/reader.rb:221:in `open'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/reader.rb:212:in `open'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/mixin/mutable.rb:44:in `load'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:78:in `block in load'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:121:in `initialize'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:77:in `new'
App 17289 output:     /var/www/fsa-alerts/editor/shared/bundle/ruby/2.5.0/gems/rdf-3.1.14/lib/rdf/model/graph.rb:77:in `load'
...

If I coerce the version to stay below 3.1.14:

gem 'rdf', '<= 3.1.13'

the app starts up as normal.

What puzzles me is that, as far as I can see, rdf/models/literal.rb has been installed as part of the bundle install, so I don't really understand where the error is arising from.

Would welcome any suggestions, or probes to try!

gkellogg commented 3 years ago

My guess is that something is failing to require 'rdf', which brings in the auto-load for rdf/model/literal. It will take some work to see what might have changed to affect this dependency chain. You might try adding a require 'rdf' in your app setup.

What explicit requires are done to RDF gems?

no-reply commented 3 years ago

i'm seeing reports from users of https://github.com/samvera/hyrax that this is happening during install processes.

i haven't tried to reproduce yet, but can give it a look and see whether i can identify the root cause.

gkellogg commented 3 years ago

Installing the gem, it looks like a file permission problem; the file is there, but it is 600. Must be some problem in packaging the gem. Best is probably to re-release and yank 3.1.14.

[rdf] ls -l ~/.rvm/gems/ruby-3.0.1/gems/rdf-3.1.14/lib/rdf/model/
total 304
-rw-r--r--   1 gregg  staff   3556 Jun 14 09:50 dataset.rb
-rw-r--r--   1 gregg  staff  11066 Jun 14 09:50 graph.rb
-rw-r--r--   1 gregg  staff  28937 Jun 14 09:50 list.rb
drwxr-xr-x  11 gregg  staff    352 Jun 14 09:50 literal
-rw-------   1 gregg  staff  19706 Jun 14 09:50 literal.rb
-rw-r--r--   1 gregg  staff   4846 Jun 14 09:50 node.rb
-rw-r--r--   1 gregg  staff    615 Jun 14 09:50 resource.rb
-rw-r--r--   1 gregg  staff  14581 Jun 14 09:50 statement.rb
-rw-r--r--   1 gregg  staff   2861 Jun 14 09:50 term.rb
-rw-r--r--   1 gregg  staff  44983 Jun 14 09:50 uri.rb
-rw-r--r--   1 gregg  staff   6697 Jun 14 09:50 value.rb
gkellogg commented 3 years ago

I released 3.1.15 and yanked 3.1.14. A local install verifies the proper permissions (at least for literal.rb). Not sure how permissions might have been messed up.

Let me know if that solves the problem.

ijdickinson commented 3 years ago

Thanks @gkellogg, I'll give that a go tomorrow!

ijdickinson commented 3 years ago

Confirm that the issue we were seeing is fixed by 3.1.15. Thanks for the quick resolution, @gkellogg and @no-reply .