Cloning to reopen as this is not fixed in 1.4.5, as the animations can still show this same behavior as reported in this ticket, but there is more damages than the animations alone that I feel previous reporters likely missed and didn't understand the 2 were related.
----------------
Better Description
----------------
If a user manages to right click a chest 2 or more times before the server has registered it and sent the user the Container Open packet, the user chest the server thinks the user has open will be the first click, where as the client will think its the second click.
This causes the server to ignore everything the user does with that chest, so any items pulled out will stay in the chest, and any items put in will stay in players inventory.
As previously reported, the chest animations get into an inverted state.
This is 100% reproduceable by simply disabling your internet connection while on SMP, click the chest 2+ times, reenable internet.
The server will catch up to your packets once your internet reconnects and trigger the issue.
For players on slower network connections, this happens accidently often, causing lots of confusion on why their items are not where they put them.
Confirmed in 1.4.5 Vanilla and Craftbukkit. This issue has existed since 1.3.1
----------------
Original Description
----------------
This happens from time to time when playing SMP with a friend on my local minecraft server.
The chest seems to remain on the open state (regarding the animation) and closes once I rightclick it to view its inventory, so basically it's inverted. The issue doesn't seem to resolve itself after relogging, so it must be a server-side issue.
It usually happens after playing for a while, after frequently using a chest. Have been able to reproduce this for a few times, so I'll provide a screenshot whenever it happens again.
Linked issues
is duplicated by
Attachments
Comments
This (when you think an item is taken/placed but it actually isn't) happened to me lots of times and it is really annoying when I don't notice it soon after, but I'm not sure if that happened when I clicked more than once on the chests. I hope this is the only bug that causes this.
Interesting. Bug appears if 2 persons use chest at same time. My bro clicked chest, I went in, deposited stuff and left to make more stuff. My bro finished and left and chest top was still up.
Maybe some sort of counter is needed. If browsing users is >= 1, lid stay up?

Why not just make the client ignore right clicks after you right click a chest until it gets a response from the server? And, if this is really the cause of the bug they say that causes items not to shift around I imagine it probably affects all containers, so why not just make it do this for all containers.
In other words, the client says, "A chest was just right-clicked." and tries to send the packet to the server, until the server responds the client just ignores all subsequent right clicks.
Thanks for the detailed bug report! I was able to reproduce and fix it, turned out the client responded with a "close container" packet when it received one, so the server would close two containers when the client only closed one.
this happens more often on slower computers when the game lags trying to run the movement and causes the player to do the accidental double click and causing this glitch