Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browse by Issued Date hangs #2808

Closed
bkeese opened this issue Feb 14, 2024 · 16 comments · Fixed by #2832
Closed

Browse by Issued Date hangs #2808

bkeese opened this issue Feb 14, 2024 · 16 comments · Fixed by #2832
Assignees
Labels
bug component: Discovery related to discovery search or browse system
Milestone

Comments

@bkeese
Copy link

bkeese commented Feb 14, 2024

Describe the bug
Chrome Version 112.0.5615.165
Dspace 7.6

When trying to browse by Issued Date on the entire repository or on a Collection with many items, the page hangs with a "Loading page..." message. This can be seen in all of Indiana University's DSpace 7 instances. For example:

https://scholarworks.iu.edu/iuswrtest/browse/dateissued
or
https://scholarworks.iu.edu/iuswrtest/browse/dateissued?scope=0f9dddb2-9f11-415a-82dc-59723f1dd88f

An example of it working as expected on a smaller collection:
https://scholarworks.iu.edu/iuswrtest/browse/dateissued?scope=21bf014b-0e1b-45f9-a6dc-acf3cf9fdcc6

To Reproduce
Click on the first link above.
Observe that the page never finishes displaying the list of items or the starts-with-date filter component.
In the browser dev tools, observe that the items are returned as expected by the API.

Expected behavior
The items should be displayed along with the date filter.

Related work

@bkeese bkeese added bug needs triage New issue needs triage and/or scheduling labels Feb 14, 2024
@tdonohue
Copy link
Member

@bkeese : This isn't reproducible on our demo site (currently running pre-7.6.2): https://demo.dspace.org/

That implies to me that it may be caused by an error on your end, or perhaps "bad data". There was an older issue in 7.2 related to bad dates causing this same issue (but it was fixed in 7.3): #1523

My suspicion is you may have an error occurring somewhere and this isn't a bug in DSpace itself. See our troubleshooting guide for details of how to locate such errors: https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-DSpace7.x(orabove)

If none of that helps, you also might get more information about an error by spinning up the UI in development mode and point it at your production backend. It's possible the UI in dev mode will give additional error information.

@tdonohue tdonohue added component: Discovery related to discovery search or browse system cannot reproduce Unable to reproduce at this time, so the ticket either needs more information or needs closing labels Feb 14, 2024
@bkeese
Copy link
Author

bkeese commented Feb 14, 2024

Thanks. I wonder if the demo instance doesn't have enough data to trigger the problem.

Anyway, I have been trying to start the UI in development mode by changing NODE_ENV to "development" in the pm2 config json, but the UI still seems to spin up in production mode. Is there a doc somewhere with instructions that I am missing?

@tdonohue
Copy link
Member

tdonohue commented Feb 14, 2024

@bkeese : While you are correct that the demo site isn't massive, if this was a global problem / major bug in DSpace, I suspect we would have heard about this on all our mailing lists. So far, you seem to be the only institution reporting this issue. That doesn't mean it isn't a bug...it just means it's much less likely to be a bug until we can reproduce it elsewhere.

By "development mode", I mean just spinning it up via yarn start like the basic instructions in the README: https://github.com/DSpace/dspace-angular/blob/main/README.md#running-the-app

You should be able to run it from an entirely separate machine (even your local machine) and simply configure it to point at the production backend to see if that provides more details.

@tdonohue tdonohue removed the needs triage New issue needs triage and/or scheduling label Feb 14, 2024
@alexandrevryghem
Copy link
Member

alexandrevryghem commented Feb 14, 2024

@bkeese: This was indeed an issue, but it has been fixed by PR #2722. This new code has already been redeployed on the sandbox.dspace.org website, but it is still reproducible for now on demo.dspace.org.

This was a race condition bug, so that's why it isn't always reproducible (I did notice that it happend more often when there were no results, because the response is processed earlier)

@tdonohue
Copy link
Member

@alexandrevryghem : Thanks for making that connection.. I didn't realize this might be related to #2722. Do you see any way to "backport" that smaller fix to the dspace-7_x branch if this is still a race condition there? Or is it too dependent on the other changes in #2722?

@bkeese
Copy link
Author

bkeese commented Feb 14, 2024

I have been able to track down the cause of this issue in our specific case. It is not caused by the referenced race condition, but rather by a bug in the logic of setting the lower limit of year choices for the date filter. If the earliest issued by date is empty, it will default to the current year instead of the lower limit. This results in the lower limit being higher (or equal to) than the upper limit, which yields zero year options for the filter. To fix it, I changed this line:


to:
return new Date(limit).getUTCFullYear();

@tdonohue
Copy link
Member

@bkeese : Excellent work. That is a new one. Would you be willing to send us a tiny PR with that fix? It looks like that same line of code exists in the main branch (pre-8.0), so it may be a bug there in that specific scenario too.

@tdonohue tdonohue removed the cannot reproduce Unable to reproduce at this time, so the ticket either needs more information or needs closing label Feb 14, 2024
@tdonohue tdonohue added this to the 7.6.2 milestone Feb 14, 2024
@tdonohue
Copy link
Member

tdonohue commented Feb 15, 2024

@bkeese : I've analyzed this in a big more detail today, but have found that your fix in #2809 doesn't appear to work for me?

First, I tried to verify the bug you reported by removing the dc.date.issued metadata field from an item in my DSpace.

However, when I tested your PR #2809, this had no impact on the dspace-7_x branch of code. The Browse by Issue Date page still hangs on "Loading page..." and the same behavior happens in the Collection's "Browse by Issue Date" where that Item (with no dc.date.issued field) exists. (All other Collection's Browse by Issue Date works fine though as all their Items have dc.date.issued fields)

So, I'm a bit confused. I definitely agree this bug exists on 7.x as I have found I can reproduce it. But, your fix doesn't seem to work for me. It could be that we need to figure out what fixed this on our main branch and backport it to dspace-7_x.

@alexandrevryghem
Copy link
Member

@tdonohue: This was the commit in which I fixed the bug that I referenced. I'll try to open a PR for this on dspace-7_x if I have some time this week/early next week.

@bkeese
Copy link
Author

bkeese commented Feb 15, 2024

I will do more digging. My PR fixes the case where dc.issued.date exists but is empty. I just removed that empty field and the page hangs again trying to construct that date picker component.
And also... The page sometimes still hangs even after successfully building the date picker. I suspect this is the result of the race condition mentioned above.

@tdonohue
Copy link
Member

@bkeese : Before you dig much further, I'd recommend trying the fix that @alexandrevryghem points to in his comment above. It's possible we just need to port that over to 7.x (dspace-7_x) branch.

I'll also see if I can try @alexandrevryghem fix a bit later today on the dspace-7_x branch.

@tdonohue
Copy link
Member

I've discovered that, unfortunately commit 6f51bd8 won't apply cleanly to dspace-7_x as these components were renamed between 7.x and main.

It'll require a manual port PR. I don't have time for that today, but would be glad to quickly test it if someone else finds time in the coming days. There's still plenty of time to backport to 7.x, as it's a bug fix.

@alexandrevryghem : Adding you as the assignee for this ticket in case you can find time to backport this fix in the coming days or so. If not, I might be able to get back to this eventually to help out.

@alanorth
Copy link
Contributor

alanorth commented Mar 1, 2024

I'm wondering if this is the same issue. I have over 100,000 items in the repository, and my "browse by issue date" only shows the current year in the drop down menu.

2024-03-01T09:52:10,729426012+03:00

I'm not sure because the page doesn't "hang", but I have an obviously incorrect list of years in the drop down menu.

@alexandrevryghem
Copy link
Member

@alanorth: I don't think that that's the same issue, but if you want to try it out you can run this branch with your backend to check if somehow this fixes it

@alanorth alanorth closed this as completed Mar 1, 2024
@alanorth alanorth reopened this Mar 1, 2024
@alanorth
Copy link
Contributor

alanorth commented Mar 1, 2024

Thanks @alexandrevryghem. With your branch I get two date values now, but it is also not correct:

Screenshot from 2024-03-01 17-12-07

I don't want to detract from this "hanging" page issue here since this seems to be something else... perhaps I should open a new issue.

@tdonohue tdonohue linked a pull request Mar 1, 2024 that will close this issue
@tdonohue
Copy link
Member

Closing as this has been fixed by:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: Discovery related to discovery search or browse system
Projects
4 participants