getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Changing the slug of a page with an irrelevant .lock file causes PHP to completely hang (Panel just spins until server times out) #2516

Closed neildaniels closed 3 years ago

neildaniels commented 4 years ago

Describe the bug
When a page's content folder has a .lock file that isn't actually for the current page, attempting to change the slug of the page cause the server the become unresponsive and timeout.

This "irrelevant" .lock file can occur by at least 3 ways:

  1. You duplicate a page in Panel that has changes. #2514
  2. You manually duplicate an existing page (with a lock file) through the filesystem. Because it's a hidden file, it's probably non-obvious that this is happening.
  3. You manually create one with the contents such as:
    /some/page:
    lock:
    user: pP0pSZTr
    time: 1583954482

To Reproduce
Steps to reproduce the behavior:

  1. Prepare a page's folder to have a .lock file that isn't actually relevant for the page (choose one of the ways above)
  2. Go to that page in the Panel
  3. Settings > Change URL
  4. Put in some different slug
  5. Click the "Change" button
  6. Panel just spins seemingly forever and then my server times out
  7. Note: the rename actually does happen at the filesystem level, it just never finishes the AJAX call to tell the panel to redirect.

Expected behavior
Panel refreshes to the new page.

Screenshots

Screen Shot 2020-03-11 at 12 16 38 PM

Kirby Version
3.3.3 and 3.3.5-rc.1

Desktop (please complete the following information):

Additional context
This is on a multi-lang setup.

afbora commented 4 years ago

When #2514 was solved, I saw that this issue was solved (At least there is no error in my tests.). Is it true @neildaniels ?

neildaniels commented 4 years ago

I don't think that's necessarily true, unless duplicating a page and changing the slug share the same code.

2514 just highlights the most obvious way that this issue could be encountered. Manually duplicating a folder on the filesystem is a realistic scenario and I assume would still cause issues.

afbora commented 4 years ago

I also get an error if it is related to the page.

To Reproduce:

  1. Go any page that have images
  2. Edit any image meta data without save
  3. Go back to page details
  4. Change page URL
  5. See error

The source of the error is: if there is no page id (copied another page or files of page id) in the lock file, kirby thinks the page has no lock file and an error occurs while moving.

afbora commented 4 years ago

I made several tests and improvements. I have solved the lock files related to the file but it seems very difficult to confirm the old data on the pages copied by manual 🤔

foxacid commented 3 years ago

We've experienced this issue on 3.5.1. It was reported by our client who said that they "changed the page title" before it happened. I was not able to reproduce it, however. I tried to reproduce it via the 5 steps above but no issues here...

bastianallgeier commented 3 years ago

As a nice side effect of our Fiber architecture, this is now solved.