01498: Quiet redirects fail intermittently

Summary: Quiet redirects fail intermittently
Created: 2024-01-25 04:48
Status: Closed, fixed for 2.3.31
Category: Bug
From: Petko
Version: 2.3.30

Description: Moved from PageDirectives-Talk: Redirect not working properly. I link a menu page to a page that redirects to another page. Clicking the menu link the redirect works. Clicking it a second time and it works. Clicking it a third time and it fails.

In my local/config.php

    $EnableRedirectQuiet = 2;
    $PageRedirectFmt = '' ;

First try works:


Second try works:


Third try fails:


Failed output:

  (:redirect Rush.Tears:)


There seems to be an unexpected incompatibility with $EnableIMSCaching. You can either disable this, or better, link to the actual page and not to the redirect. I'll see if I can fix this in the next few days. --Petko

Amazing that you found this so fast! I commented out $EnableIMSCaching and it works. I sure hope you can fix the IMSCaching now. :)

Petko said: "better, link to the actual page". IMHO I gotta disagree. If I give the computer a command to redirect, the page should redirect, not just redirect the first 2 times.


I think I've fixed this, it will be good if you can test the pre-release with $EnableIMSCaching and confirm. --Petko

Not fixed. I commented in the $EnableIMSCaching and installed the latest nightly. It appears like its fixed, but it is not. Repeatedly clicking the menu link, if the link fails once it fails continuously. I clicked the same menu link like 10 times, and it failed like on the 11th time. Sometimes It took 27 clicks. After that any click on the same link fails. In other words, the link always fails and becomes completely unusable. --gnuzoo

I could only experience this when middle-clicking on the redirect link multiple times within 2 seconds, then some tabs redirected correctly, others didn't (with or without $EnableIMSCaching). The reason is a specific COOKIE that indicates the request comes from a redirect can be reused by another tab before it is deleted or invalidated. Nevertheless, this can be unexpected and shouldn't happen.

I rewrote the "redirect quiet" code to relay the information with ?from=Group.Page&quiet=1 in the URL, and that part is removed when the target page is reached (by pub/pmwiki-utils.js). Again, please test the pre-release -- pmwiki.php, scripts/utils.php, and pub/pmwiki-utils.js changed. --Petko

It appears to be totally fixed !!!!!! I could not get the redirect to fail. I do not know about the middle click, my mouse only has a normal click on the left and a right click. Thank you very much! --gnuzoo

Thanks for your testing and reports. Middle-click is pressing on the scroll wheel, if it is on a link, it opens in a new tab. This way I could open the same link multiple times in different tabs that load at close but not the same time. This exposed the bug with the cookie. --Petko