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

Item Counts (webui.strengths): Live Counts Break the Community List #9437

Open
AmyBW opened this issue Mar 26, 2024 · 5 comments · May be fixed by #9583
Open

Item Counts (webui.strengths): Live Counts Break the Community List #9437

AmyBW opened this issue Mar 26, 2024 · 5 comments · May be fixed by #9583
Assignees
Labels
bug component: Discovery Related to Discovery search or browse system high priority testathon Reported by a tester during Community Testathon

Comments

@AmyBW
Copy link

AmyBW commented Mar 26, 2024

Describe the bug
Live item counts prevent the community list from loading in 7.6.1

To Reproduce
Steps to reproduce the behavior:

  1. Enable live item counts in the config file (set webui.strengths.show = true and webui.strengths.cache=false) and restart Tomcat.
  2. Reload the home page.
  3. Communities & collections will not load, although recent submissions do load as expected.
  • GUI errors include: "Error fetching collection" and "error.top-level-communities".
  • Console and dspace.log state:
java.lang.NullPointerException: Cannot invoke "org.dspace.core.DBConnection.getSession()" because the return value of "org.dspace.core.Context.getDBConnection()" is null
        at org.dspace.core.AbstractHibernateDAO.getHibernateSession(AbstractHibernateDAO.java:59) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.core.AbstractHibernateDAO.createQuery(AbstractHibernateDAO.java:137) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.content.dao.impl.ItemDAOImpl.countItems(ItemDAOImpl.java:395) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.content.ItemServiceImpl.countItems(ItemServiceImpl.java:1589) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.browse.ItemCounter.getCount(ItemCounter.java:131) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.content.CommunityServiceImpl.countArchivedItems(CommunityServiceImpl.java:723) ~[dspace-api-7.6.1.jar:7.6.1]
        at org.dspace.content.Community.countArchivedItems(Community.java:275) ~[dspace-api-7.6.1.jar:7.6.1] ...

(etc)

Expected behavior
Normal home page should load showing top-level communities and accurate item-count badges.

Related work
Cached item counts are inaccurate but the system is still useable: #9434

@AmyBW AmyBW added bug needs triage New issue needs triage and/or scheduling labels Mar 26, 2024
@likebirds
Copy link

The other issue is that the count does not 'automatically' count, even after item addition, and for publicly accessible items. Read somewhere that it requires one to restart Tomcat, I have not tried it.

@AmyBW
Copy link
Author

AmyBW commented Apr 4, 2024

The other issue is that the count does not 'automatically' count, even after item addition, and for publicly accessible items. Read somewhere that it requires one to restart Tomcat, I have not tried it.

@likebirds that is correct, and it's filed as a separate issue/bug report: #9434

@cervacsaba
Copy link

cervacsaba commented Apr 12, 2024

Hi

As webui.strengths.cache=true is not working the way I expected, - I want to have counted and shown the count of all items in every collections, not only the ones with public access (this is the way that dspace 7 is working now) - I needed to set webui.strengths.cache=false. I got the the same error as mentioned here, but after a while, I found a temporary solution, waiting for the experts to solve both problems a better way. So, I made some changes in
dspace-api/src/main/java/org/dspace/core/AbstractHibernateDAO.java.

Checking the existence of active db connection and repairing if it is null:

/*******************/
import org.dspace.utils.DSpace;
import org.dspace.services.factory.DSpaceServicesFactory;
.
.
private DBConnection dbConnection;


    protected Session getHibernateSession(Context context) throws SQLException {
        if (context.getDBConnection() == null) dbConnection = new DSpace().getServiceManager().getServiceByName(null, DBConnection.class);
        else dbConnection = context.getDBConnection();
        return ((Session) dbConnection.getSession());
    }
 /***************/

@alanorth
Copy link
Contributor

alanorth commented Apr 15, 2024

@AmyBW thank you for the bug report! I can reproduce it locally on DSpace 7.6.1. When webui.strengths.cache = false in dspace.cfg the frontend is completely broken.

Community list never loads:

Screenshot 2024-04-15 at 15-54-31 CGSpace Community List

Community page throws the error "Error fetching community":

Screenshot 2024-04-15 at 15-54-45 DSpace

And collection pages give an obscure "No item found for the identifier" error:

Screenshot 2024-04-15 at 15-56-31 DSpace

@alanorth alanorth added component: Discovery Related to Discovery search or browse system and removed needs triage New issue needs triage and/or scheduling labels Apr 15, 2024
@tdonohue tdonohue added testathon Reported by a tester during Community Testathon help wanted Needs a volunteer to claim to move forward labels Apr 15, 2024
@tdonohue tdonohue self-assigned this May 9, 2024
@tdonohue tdonohue removed the help wanted Needs a volunteer to claim to move forward label May 15, 2024
@tdonohue
Copy link
Member

Fix for this issue now available in #9583. This PR is under review for 8.0 and 7.6.2. If anyone wants to help test it, I'd appreciate it.

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 high priority testathon Reported by a tester during Community Testathon
Projects
Archived in project
5 participants