hyrax: Ldp::Conflict occurring on all new works once it starts
Descriptive summary
In Hyrax 2.1.0, I am able to create a bunch of works. At some point, creating a new work starts getting an Ldp::Conflict, "Can't call create on an existing resource"
error. After that, all new works get this error. I am able to clear the problem by using ActiveFedora::Cleaner. This is not a viable solution if this occurs in production.
Steps to reproduce the behavior
Unfortunately, I do not have a sense of what starts triggering the Ldp::Conflict
error to start. Once it does, you can see it with every attempt to create a new work.
Related work
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 54 (33 by maintainers)
Commits related to this issue
- Fix a spec that was failing intermittently. Story #273 There is a known problem with Hyrax apps that causes Ldp errors. There is a working group that will fix the problem in future versions of Hyrax... — committed to curationexperts/cypripedium by val99erie 6 years ago
- Always be able to mint ids, even after a crash This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. We encou... — committed to UCLALibrary/californica by bess 6 years ago
- Always be able to mint ids, even after a crash This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. We encou... — committed to UCLALibrary/californica by bess 6 years ago
- Always be able to mint ids This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. See samvera/hyrax#3128 for m... — committed to samvera-labs/nurax-pre2023 by bess 5 years ago
- Recover rolled back minter state on actor stack failure When the actor stack fails, a database transaction rolls back. When the DB-based NOID minter is in use, this rolls back the minter state. Howev... — committed to samvera/hyrax by no-reply 5 years ago
- Add failing test for ActorStack minter state bug This test reproduces #3128. — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Remove `Hyrax::Actors::TransactionalRequest` from default middleware The actor stack involves writing to several diffrent persistence layers; at least: - ActiveRecord - ActiveFedora (Fedora/Solr... — committed to samvera/hyrax by no-reply 5 years ago
- Always be able to mint ids This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. See samvera/hyrax#3128 for m... — committed to curationexperts-deprecated/tenejo-v1 by bess 5 years ago
- Always be able to mint ids This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. See samvera/hyrax#3128 for m... — committed to curationexperts-deprecated/tenejo-v1 by bess 5 years ago
- Always be able to mint ids This is a fix for a bug in Hyrax where under certain circumstances the minter stops issuing new IDs, preventing new objects from being created. See samvera/hyrax#3128 for m... — committed to curationexperts/cypripedium by bess 5 years ago
@no-reply In case it helps … I just encountered this error on my workstation in our Hyrax-based app. I attempted to create an object through the UI but, due to an error in some new actor code I had just written, an exception was thrown. I corrected the code error and tried again. This time, I got the
Ldp::Conflict
error. I opened a rails console and typed the command you listed above; namely,[::Noid::Rails::Service.new.minter.mint, ::Noid::Rails::Service.new.minter.mint]
. I got["5999n337h", "rf55z7713"]
. (I actually then ran the command again and got two different id’s, but I think that’s probably irrelevant to the issue at hand.) I then restarted my rails server and again attempted to add a new work through the UI. That time, it succeeded. So, in response to the question you posed above, at least in this case, when theLdp::Conflict
occurred, I was able to successfully mint new ids outside of the actor stack and that seems to have caused the problem to go away.Fun fact - this also appears to clear up an issue with minters taking forever to get their lock - since in postgresql the lock stays open until the transaction is over. we’ve seen a big improvement with multiple workers with this fix.
@orangewolf that all seems congruent with my understanding.
I’ve looked at adding a separate transaction for the minter; the thing is that it already has one: https://github.com/samvera/noid-rails/blob/master/lib/noid/rails/minter/db.rb#L58-L63
The Actor Stack’s transaction wrapper creates a nested transaction. If we aim to keep the stack wrapped in a transaction, there are two possible behaviors:
requires_new: true
: the nested transaction is treated as a check point. if it the minter transaction fails, the actor stack transaction may still succeed without it. in this case, the nested transaction still does not succeed when the parent transaction fails. i have tested this withsqllite3
.As far as I can tell, there’s just no way to make a sub-transaction succeed independent of its parent.
Increasingly, I’m convinced that making the stack transactional is just a bad idea. Unless we can neatly couple them with robust rollback of
ActiveFedora
changes, it seems better to let the database collect cruft along with Fedora/Solr. @orangewolf: if you have an in-development app you are currently working with, I might suggest you remove theTransactionalRequest
actor and see if that introduces new problems for you.The other issue is that we’re still not making any progress on identifying the causes of the Stack failures. Within the stack, this issue should only happen when a Work has been successfully created, but some other failure has blown up the stack. This is really nasty behavior, however the transactionality is handled. This is why I’m eager to see reproducible errors. It would be best if we could identify the kinds of
env
states that give rise to this and reject them much earlier in the creation process.I haven’t been able to reproduce locally, and I’m still not clear on whether you’re able to successfully mint new ids outside of the actor stack.
Could you post the output of:
[::Noid::Rails::Service.new.minter.mint, ::Noid::Rails::Service.new.minter.mint]
Also, that LibreOffice is implicated suggests that derivatives jobs are running inline. Have you setup a production job queuing system (you can check with:
ActiveJob::Base.queue_adapter
). See also: https://github.com/samvera/hyrax/wiki/Background-Workers. This is unrelated to the minter issue, but may be a serious issue in your production configuration besides.