cs3org / wopiserver

A vendor-neutral application gateway compatible with the WOPI specifications.
Apache License 2.0
55 stars 26 forks source link

Implemented forced eviction of locks #106

Closed glpatcern closed 1 year ago

glpatcern commented 1 year ago

This PR introduces a feature to compensate an issue with the Microsoft Office cloud. It should hopefully be reverted once the issue is fixed with MS support.

The issue concerns a mishandling of collaborative sessions: it may happen that a new user trying to join an editing session is prevented from doing so because the existing session appears to be "forgotten" by the Microsoft cloud, whilst it is continuously being refreshed (therefore holding a valid WOPI lock). Typically this is the case when the existing session is not actively used, that is there has been no recent PutFile operation.

Here we introduce a configuration parameter evictlocktime and an evictlock additional query parameter on /wopi/iop/openinapp: if evictlock=1 on the open call AND the file was saved more than evictlocktime seconds ago, then the existing and valid lock is evicted in favour of the new one. The net result is that the new user is allowed to edit the document, and the previous (presumably idle) user will get a "Session expired" message, requiring to reload. By default the evictlocktime value is -1, meaning that the feature is disabled.