Closed (fixed)
Project:
Bynder
Version:
8.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Reporter:
Created:
21 Mar 2018 at 10:10 UTC
Updated:
4 Mar 2020 at 21:28 UTC
Jump to comment: Most recent, Most recent file
Ticket to track work for migration of the Bynder module to use core Media API
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 2954845-race-condition-fix.patch | 363 bytes | marcoscano |
| #24 | bynder-uploads-new.mov | 3.75 MB | jfs.csantos |
| #23 | upload_media_entity.mp4 | 4.71 MB | marcoscano |
| #22 | bynder_upload_test.mp4 | 7.63 MB | marcoscano |
| #18 | upload_error3.txt | 673 bytes | jfs.csantos |
Comments
Comment #2
marcoscanoHere a first version of the port.
In manual testing, I'm having some issues to upload files to the API, that disappear when I step through the code with the debugger, so I'm assuming some race condition must be happening. I have the same error with the current 8.x-1.x HEAD, though, so I wonder if it's due to my local setup or the testing account I'm using.
Some review, testing and feedback with this patch would be appreciated.
Comment #3
marcoscanoSimplifying the check a bit.
Comment #4
berdirshould we also specifiy that this needs 8.x-2.x here?
copy paste leftover (we shouldn't have deleted that function ;))
Comment #5
marcoscano@Berdir thanks for reviewing!
Comment #6
jfs.csantos commentedAlso, shouldn't the entity_browser be on 2.0 as well?
Comment #7
marcoscanoWe can make that a requirement to reduce confusion, but technically we don't depend on the new EB widget that was added in 2.x, so EB 1.x should work fine as well.
But it's true that if a site is using Media in core, it's probably a good idea to have all modules that deal with media entities in their 2.x branches.
Apparently, we weren't requiring Entity Browser in the info file, so I'm adding the entry with the 2.x restriction.
Thanks!
Comment #8
berdirI think the dependency to entity_browser is kind of optional and only the demo module has an explicit dependency on it?
Comment #9
marcoscanoOh that could indeed be the reason it was not required before.
However, unless I'm missing something, being the main integration with the API done through EB widgets (search / upload), I wonder what the use cases for using this module without it are? We would have a Media type (bundle) and a formatter, but all entities would need to be created through the standalone form, entering the remote UUID by hand?
Also, in the project page we state that Entity Browser is a requirement, so users probably already expect that. I believe it may make sense to include it as a hard requirement as well in the main module.
Thoughts?
Comment #10
marcoscanoJust remembered something relevant to take into account if we keep those minimum version restrictions in the info file.
Drupal doesn't parse info file versions for projects not packaged on Drupal.org, so if a site is using DropzoneJS or Entity Browser checked out from git or a -dev package, those restrictions will not be met, even if they are on the 2.x branches. Not sure if this is an issue in this case, but thought it would be worth mentioning here.
Comment #11
marcoscanoThis prevents the race condition issue I experienced in some scenarios with the upload widget.
Comment #12
jfs.csantos commented@marcoscano Just tried with both standard and lightning profiles on a fresh install and it works fine, good work mate!
Can you you try and test the update path from 8.4 -> 8.5, I'll give it a go as well.
Also, should we release this as a new 8.x-2.x branch since it's a breaking update?
Comment #13
jfs.csantos commentedJust tried to install the bynder_demo module with the Lightning and had this issue:
[error] Configuration objects (core.entity_view_mode.media.thumbnail) provided by bynder_demo already exist in active configurationApparently the lightning_media module already sets up the core.entity_view_mode.media.thumbnail, so no need to have it there.
Comment #14
marcoscanoHi!
Yes, I belive it is a good idea to release this as a 8.x-2.x branch, to make a clear difference from the existing branch. Other modules that integrate with Media Entity in contrib are doing the same for their branches compatible with media in core.
Maybe instead of removing the file, we could move it into the
modules/demo/config/optional/instead? This way sites not using the lightning profile would get it, and it wouldn't be installed if already present.Comment #15
marcoscanoHere's a patch that implements the suggestion in #14
Comment #16
jfs.csantos commented@marcoscano The upgrade path is fine, I just couldn't get the bynder_demo module to install on a clean site though. I tried with the latest patch and it still complains.
[error] Configuration objects provided by <em class="placeholder">bynder_demo</em> have unmet dependencies: <em class="placeholder">core.entity_view_display.media.bynder.thumbnail (core.entity_view_mode.media.thumbnail)</em>Is this because the config in optional is only set up after the install one? I'm not sure how can we re-arrange the imports here.
Comment #17
marcoscanoThanks for the feedback!
Yep, the order is important here... moving all of them to optional seems to be enough to have all of them enabled at the same time, and they won't try to override an existing config object that may exist with the same name.
Comment #18
jfs.csantos commentedI don't think that worked Marco. It does install the module without any problems, but now there's an issue during the upload. Basically the file is uploaded and the media is added to the library, but it fails to add it to the field. See errors attached.
Can you test installing the bynder_demo module and uploading a file before submitting the new version please?
Comment #19
marcoscanoHi João,
I'm trying to reproduce the issue, but I'm not being able to connect to the API. Is there any connectivity issue at this moment?
Thanks!
Comment #20
marcoscanoCould you please share steps to reproduce?
I have just tested again in a new install (standard profile), and although I still have the API errors like:
which prevent the upload from finishing, I don't experience the errors you mentioned in #18. Any additional info to help reproducing it would be appreciated.
Thanks!
Comment #21
jfs.csantos commentedHi there Marcos,
I don't think we had any API issues, these are the steps to reproduce the errors found:
Can you try this once again? I'm also giving it another go to make sure it's not a problem with my environment.
Comment #22
marcoscanoHi João, I'm still getting the error 500 today. Could you please double-check?
Here is what I'm doing: video
Could it be something related to the test account we are using? Could you please try with the same test account so we can see the differences?
Thanks!
(Note: on the video, when I type "dcdr", this is an alias for "drush" in my environment)
Comment #23
marcoscanoThanks for solving the issue with the API account!
Now I can indeed reproduce the issue, and apparently it's due to the same racing condition we were experiencing above. In this issue we have introduced a workaround in #11 to avoid it in some scenarios, but it appears that now when it happens (trying to save the entity twice, with a duplicate UUID error message), we avoid that error but both transactions are rolled back somehow and the Entity Browser widget ends up not saving the entity, passing NULL to the field widget, which ultimately produces the error you described above.
However, as I mentioned before, I can reproduce the same racing conditions while testing with the current 8.x-1.x (without the patch): video
Could you please test and see if it also happens for you in the current dev version of the module? (i.e. using Media Entity contrib)
Thanks!
Comment #24
jfs.csantos commentedHi there Marcos.
I just finished testing with both Drupal 8.4.6 and 8.5.1, Media Entity 1.x and Bynder 8.x-1.x...the error doesn't happen to me.
Not sure how this is happening to you if we are all in the same versions.
Comment #25
marcoscanoSo this is the patch that should fix the race conditions. It should apply to both 1.x (current code) and 2.x (after patch #17).
Comment #26
jfs.csantos commentedGreat Marcos, this looks good to go. Do you have permissions to create the 2.x branch and push this?
Comment #27
berdirI can. Committed the conversion patch to the new 8.x-2.x branch/release, as well as comitting the race condition fix to both branches.
https://www.drupal.org/project/bynder/releases/8.x-2.x-dev
Comment #29
dave reidA side effect of moving all the config to /optional, is that we have an install profile that depends on the bynder module and adds fields to the media type, but we get an order issue:
https://lightning.acquia.com/blog/optional-config-weirdness-drupal-8
I've moved any config that requires the Bynder media entity to our own /optional directories, which seems to resolve it, but it doesn't seem ideal. Maybe we should be copying and installing that confirm from our install profile itself instead of relying on the Bynder module's configuration?