dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Opening the simple item page of a withdrawn item when logged in as administrator stalls the frontend instance

Open MW3000 opened this issue 1 year ago • 5 comments
trafficstars

Describe the bug

In DSpace 8.x, opening the simple item page of a withdrawn item when logged in as administrator stalls the frontend instance for about 10 to 15 minutes, making it unresponsive, then continues to display the simple item page.

To Reproduce

Steps to reproduce the behavior:

  1. Login as an administrator
  2. Withdraw an item
  3. Go the withdrawn item's simple item page, eg. by clicking the item in the breadcrumbs, searching for a withdrawn item in administrative search or because you copied the url beforehand.
  4. The whole frontend instance stalls for about 10 to 15 minutes. After that time, the simple item page is displayed.

You can easily reproduce this on the DSpace Demo Website

Expected behavior

The simple item page should come up immediately

MW3000 avatar Oct 09 '24 13:10 MW3000

Hi, I looked a bit deeper into this and figured, it might be a problem with the cache of the authorization information:

  showReinstateButton$(): Observable<boolean>  {
    const correction$ = this.correctionTypeDataService.findByItem(this.item.uuid, true).pipe(
      getFirstCompletedRemoteData(),
      map((correctionTypeRD: RemoteData<PaginatedList<CorrectionType>>) => correctionTypeRD.hasSucceeded ? correctionTypeRD.payload.page : []),
    );
    const isAdmin$ = this.authService.isAuthorized(FeatureID.AdministratorOf);
    return combineLatest([isAdmin$, correction$]).pipe(
      map(([isAdmin, correction]) => {
        return !isAdmin && correction.some((correctionType) => correctionType.topic === REQUEST_REINSTATE);
      },
      ));
  }

If I force the authService not to use the cached version, it works for me, otherwise it seems to return undefined.

    const isAdmin$ = this.authService.isAuthorized(FeatureID.AdministratorOf, undefined, undefined, false);

EikLoe avatar Oct 10 '24 08:10 EikLoe

@Leano1998: The problem is most likely that the template always recreates a new Observable every time the template is rerenderd. I already have a branch with similar fixes on other places that I was going to contribute, I can add that fix to that branch too 🤷 https://github.com/DSpace/dspace-angular/blob/8cc45e8cbed8b6d1f101c3b15be1de63ba1ed083/src/app/item-page/alerts/item-alerts.component.html#L11

alexandrevryghem avatar Oct 10 '24 08:10 alexandrevryghem

@alexandrevryghem : Yes, I noticed this behavior in the browser console. Thank you for the adding the fix!

EikLoe avatar Oct 10 '24 10:10 EikLoe

Interesting... I haven't noticed this on DSpace 7.6.x. We have many withdrawn items so I would have definitely run into this.

alanorth avatar Oct 14 '24 05:10 alanorth

Indeed, only dspace-8_x and main are affected since this originates from this PR, which hasn't been backported to dspace-7_x.

alexandrevryghem avatar Oct 14 '24 07:10 alexandrevryghem

I know that I said 7.6.x wasn't affected, but a comment on Slack regarding thumbnails reminded me that we do seem to have some glitch with withdrawn items as well. See this video:

Screencast From 2024-11-04 15-58-11.webm

This item has a thumbnail in its THUMBNAIL bundle and I am logged in as an administrator. I see the spinning indicator for the thumbnail, and in the console I see an HTTP 401 for the content. Interestingly, when I move the cursor over the "edit item" button the placeholder appears. Sometimes I see the thumbnail appear, though I can't figure out the sequence of events to reproduce it.

alanorth avatar Nov 04 '24 13:11 alanorth

@alanorth: This makes me think of an old fix that I made once but haven't contributed yet, could you try testing if this fix fixes your issue. It has been in my backlog for a while so I'm not 100% sure if it's even necessary anymore 😅

alexandrevryghem avatar Nov 04 '24 13:11 alexandrevryghem

This bug could be related to the bug described in issue https://github.com/DSpace/dspace-angular/issues/3584.

saschaszott avatar Nov 08 '24 13:11 saschaszott

Can we reopen this issue? It is still a bug in the latest DSpace 8.1-Snapshot and it affects current DSpace 8 users.

MW3000 avatar Nov 27 '24 13:11 MW3000

@MW3000: Are you sure it's related to opening an item page of withdrawn item and not simply this issue: #3584

alexandrevryghem avatar Nov 27 '24 16:11 alexandrevryghem

@alexandrevryghem It might be related to #3584. But I just read above, it is marked as completed by #3585, which is not ported yet to DSpace 8?

tdonohue closed this as completed in https://github.com/DSpace/dspace-angular/pull/3585 [2 weeks ago]

As the bugreport was for DSpace 8 and our users are still experiencing the bug, I thought it would be good to have the issue open until fixed in DSpace 8?

MW3000 avatar Nov 28 '24 09:11 MW3000

@MW3000 : Closing this again as it's fixed in the codebase (for 9.0)... once a bug is fixed, the linked bug ticket will auto-close as this is an indication to developers that it's been verified to be fixed (but it still may not yet be released, obviously).

However, I've added a reminder to @alexandrevryghem on #3585 that we need to backport it to both dspace-8_x (and dspace-7_x if applicable). So, this bug will be fixed in 8.x as well, but it still requires (manual) backporting.

@alexandrevryghem if you can find time to backport this sooner (rather than later), I'd appreciate it. I can gladly review, and perhaps @MW3000 can help us to test the backport. We need to include this fix in 8.1.

tdonohue avatar Dec 02 '24 15:12 tdonohue

@tdonohue I did test the port to 8.x https://github.com/DSpace/dspace-angular/pull/3738 and left a comment.

MW3000 avatar Dec 17 '24 10:12 MW3000