WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 months ago

#28288 new defect (bug)

New Post overwriting a previously published post

Reported by: jackreichert Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Posts, Post Types Keywords: needs-patch
Focuses: administration Cc:
PR Number:

Description

This was seen on wordpress.com, a user had multiple draft windows open. At one point when saving one draft, it wrote over another previously published post.

I believe that it was caused by a race condition that has to do with the environment being hosted on multiple servers.

To reproduce:

  1. Open in quick succession multiple draft windows.
  2. Check in developer tools for post_id duplicate.

I believe that a possible solution would be to enhance post-locking to include if a post is open in duplicate windows by the same user.

Attachments (3)

28288-post.diff (545 bytes) - added by jackreichert 5 years ago.
Removes user check so that filelock will happen if the same post is opened in two separate windows.
28288.diff (539 bytes) - added by adamsilverstein 5 years ago.
rebase patch from trunk
28288.2.diff (731 bytes) - added by adamsilverstein 5 years ago.
doc bloc update to match functional change; add missing brackets

Download all attachments as: .zip

Change History (13)

@jackreichert
5 years ago

Removes user check so that filelock will happen if the same post is opened in two separate windows.

#1 @SergeyBiryukov
5 years ago

  • Version changed from 3.9.1 to 2.5

Introduced in [7103], modified in [16901].

@adamsilverstein
5 years ago

rebase patch from trunk

#3 @adamsilverstein
5 years ago

I think this fix makes sense!

Since we are doing post locking you shouldn't be able to edit the same post from two locations, even you are the same user. The whole point of post locking is to prevent the strange things that happen when two sessions edit the same post (autosaves esp. - see #28378) - being the same user doesn't help the situation.

Am I missing a use case where one user should be able to edit a post from two windows or locations?

@adamsilverstein
5 years ago

doc bloc update to match functional change; add missing brackets

#4 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 4.0

Moving for investigation.

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.


5 years ago

#6 @adamsilverstein
5 years ago

  • Keywords dev-feedback added

The patch still applies cleanly and I think is good to go for 4.0.

Maybe @azaozz can review to verify sanity of change?

#7 @adamsilverstein
5 years ago

After some discussion with azaozz and some further testing, its clear this will not work - the post lock is never cleared and when saving, auto-saving or even reloading you are locked out.

Here is a screencast showing the issue (with the patch applied).

Last edited 5 years ago by adamsilverstein (previous) (diff)

#8 @adamsilverstein
5 years ago

  • Keywords close added; dev-feedback removed

#9 @helen
5 years ago

  • Keywords close removed
  • Milestone changed from 4.0 to Awaiting Review

Probably still an issue worth investigating, but a punt for 4.0, given that we don't have a viable approach.

#10 @chriscct7
4 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.