NaturalHistoryMuseum / scratchpads2

Scratchpads 2.0
http://scratchpads.org
GNU General Public License v2.0
200 stars 84 forks source link

Cannot attach PDF to biblio node - bio.acousti.ca #6560

Open edwbaker opened 2 years ago

edwbaker commented 2 years ago

Biblio node: https://bio.acousti.ca/content/notes-underground-exploration-burying-beetle-thermal-ecology-sound-production-and-reception

PDf file: https://bio.acousti.ca/sites/default/files/Ward2022.pdf#overlay-context=content/notes-underground-exploration-burying-beetle-thermal-ecology-sound-production-and-reception

File uploaded OK but cannot attach it to the biblio node.

therobyouknow commented 2 years ago

Ongoing analysis

Looking into this for you.

Thank you for raising the ticket @edwbaker

Sorry for the delay of nearly 1 month following this up.

I will carry out the same steps to see what happens when attempting to attach. Then I will use that info for troubleshooting.

As well as my own observations to come, I'd be interested to know more about what you saw: What did you see when attempting to attach the pdf? Was there an error shown, or was something missing or greyed out that stopped the attach attempt being successful?

therobyouknow commented 2 years ago

Ongoing analysis

Linking potentially similar issue about attachments problem: https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6452 to see if a solution can fix both.

therobyouknow commented 2 years ago

Ongoing analysis

A raiser of a similar issue, https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6452 reports it now working as required. Can you advise if what you wanted to do now works please @edwbaker Thank you!

therobyouknow commented 2 years ago

Ongoing analysis

next steps for Rob: try to do this on staging - attach a PDF. If works, close issue advising user to re-open if issue.

therobyouknow commented 2 years ago

Ongoing analysis

Confirming problem still exists

list of files here: https://bio.acousti.ca/admin/file/application

Confirmed problem by going through steps below to attempt to attach it:

Go to edit mode of that biblio node: https://bio.acousti.ca/content/notes-underground-exploration-burying-beetle-thermal-ecology-sound-production-and-reception#overlay=node/58464/edit

Click 'Select Media'

image

image

Ward2022.pdf is available from the 'Library' tab

image

image

Click Submit in that pop-up, the pop-up disappears but no file shown as attached, nothing listed below 'File Attachments'

image

therobyouknow commented 2 years ago

Ongoing analysis

Turning on 'Database logging' / dblog module to see watchdogs logs to start diagnostics...

(this won't affect the site. But I will want to turn it off when done to maximise server performance for the site itself)

therobyouknow commented 2 years ago

question for you please: @edwbaker @archilegt

Did this ever work for you? Or did it work in the past but now stopped working.

If it did work for you in the past @edwbaker then can you give me a URL to node content with attachments please?

therobyouknow commented 2 years ago

dev notes in ongoing analysis

I can see that an experimental sandbox module is being used to handle the file upload - media_multiselect .

I have looked for updates to this module since the version we have of it. I fetched a copy of the latest version of this module using: git clone https://git.drupalcode.org/sandbox/fangel-1652676.git media_multiselect and compared it with the version in our code base.

This beyond compare summary shows there are changes since the version of media_multiselect we have:

image

The module's project page mentions 2 updates under Changelog: https://www.drupal.org/sandbox/fangel/1652676

Nov 6th 2012: Added code that improves the behavior of the 'Remove'-buttons, so that the widget is ajax-reloaded with the item removed, instead of just blanking out the values. Nov 8th 2012: Added support for multiple-fixed cardinality (ie 2, 3, 4, 5, .., 9).

These changes don't appear to address the issue we are having but I will test the latest version of media_multiselect with bio.acousti.ca on my personal local setup.

But ultimately, why are we using this media_multiselect sandbox module?! plupload is better

Presumably we needed something before plupload came out for the ability to bulk upload multiple files / drag drop. https://www.drupal.org/project/plupload

If testing the updated media_multiselect doesn't fix the issue then I would be inclined to install plupload (and any requied associated modules) and add a new field with type that makes use of this. I think there is limited return on investment debugging a sandbox module over using an established community contrib module such as plupload

edwbaker commented 2 years ago

It has previously worked, although not always reliably. https://bio.acousti.ca/content/old-sound-recording-new-species-genus-horatosphaga%C2%A0orthoptera-tettigonioidea-phaneropterinae?destination=node/50819 Has a pdf attached if you log in

therobyouknow commented 2 years ago

Pausing this ticket because need to find out how to get site database for personal dev setup to troubleshoot issue further. Hosted separately so need to determine steps.

therobyouknow commented 2 years ago

ongoing analysis and question

@edwbaker @benscott do you know how to get a copy of the bio.acousti.ca database?

Note that I will attempt the attach on a plain vanilla test scratchpads site and locally and debug, but also using your site data would improve test coverage and confirm the solution works for you.

therobyouknow commented 2 years ago

ongoing analysis, above question answered

Thanks @benscott for these:

docker exec -i scratchpads.apache drush sql-dump > 'dump.sql'

docker exec -i scratchpads.apache drush command

This answers my previous comment: https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6560#issuecomment-1192312291

therobyouknow commented 2 years ago

ongoing analysis and question

Testing on test scratchpad site works.

Question for @edwbaker - did bio.acousti.ca always live on its own server instance?

I ask because I wonder if the attachment worked on it before it was on its own server instance. My thinking is that given that some testing on a test scratchpads site works on the usual server infrastructure, I'm wondering if the permissions on the stand alone need adjusting.

I wonder if the example you gave where it did work was before the site was on its own server instance.

notes about testing on test site so far

On test scratchpad site, adding pdf works with drag and drop https://test1.myspecies.info/node/1.

image

Drag and drop doesn't work was also tried with bio.acousti.ca but didn't work so I would regard the drag and drop test as one of the tests relevant for checking this issue.

edwbaker commented 2 years ago

No, it was moved sometime after 2017. I have posted several issues since and it has never been resolved. At one point some PDFs could be attached and others couldn't - not sure if this is still the case.

edwbaker commented 2 years ago

For reference these are the issues:

https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6009 https://github.com/NaturalHistoryMuseum/scratchpads2/issues/5994 (apparently waiting for release but that was in 2020) https://github.com/NaturalHistoryMuseum/scratchpads2/issues/5723 (apparently fixed using some env variable)

therobyouknow commented 2 years ago

ongoing analysis

Thanks Ed.

Selecting uploaded media on the test site also works.

https://test1.myspecies.info/node/1/edit

image

image

therobyouknow commented 2 years ago

ongoing analysis

given that some tests so far show the pdf attach as working on the test site but those same tests not working on bio.acousti.ca I'll create a copy of bio.acousti.ca (i.e. using the site db) on my personal dev setup and xdebug.

therobyouknow commented 2 years ago

ongoing analysis

https://bio.acousti.ca/#overlay=admin/reports/dblog gives an error, can't see dblogs yet

image

therobyouknow commented 2 years ago

ongoing analysis

turn on php E_all - could the db error and upload have the same cause? reviewed progress with Ben Scott

therobyouknow commented 2 years ago

ongoing analysis

on local personal dev setup:

these 2 points illustrated:

image

same attach tests as before - working on local personal dev

db logs / watchdog admin/reports/dblog

image

Conclusion: on the basis that they work locally and on test site, this indicates that issue has an environmental basis on the production docker setup.

therobyouknow commented 2 years ago

ongoing analysis, dev notes

this ticket now BLOCKED - need further assistance

I attempted to turn on full php error output, as I said I would in https://github.com/NaturalHistoryMuseum/scratchpads2/issues/6560#issuecomment-1193822582 but I am unsuccessful.

Here's what I did:

as root on bio.acousti.ca server, connected into scratchpads.apache Docker container and ran a shell: docker exec -it scratchpads.apache /bin/bash

installed vim editor ( https://stackoverflow.com/a/58267453/227926 ) and used vim to edit the /usr/local/etc/php/php.ini file to have

display_errors = 1
display_startup_errors = 1
error_reporting = E_ALL

Based on https://stackoverflow.com/a/21429652/227926

Then exited the container's shell so as to be back in the host server shell as before to be able to restart the container, which I did, so that the updated php.ini settings would take effect.

docker restart scratchpads.apache

Then visited https://bio.acousti.ca/admin/reports/dblog (logged in) and got the same fatal unexpected error but without any php error output.

image

Rest of site still working OK - other pages.

I also tried to look at the apache error log (in folder /var/log/apache2 ) inside the container, scratchpads.apache. But this seems to be a chain of symlinks - not something I am familiar with.

I've moved this ticket to 'Blocked' column to denote I cannot proceed further, I need help from @benscott and @edwbaker regarding the Docker setup for bio.acousti.ca.

therobyouknow commented 2 years ago

Also checked the file system free space on the bio.acousti.ca site, with df -h - largest figure reported is 75% used - i.e. 25% free. So file system being full up doesn't appear to be the issue.

therobyouknow commented 2 years ago

Assigned @benscott thank you for taking this on.