# \[WOPI\]\[integration\]: "Unlock" requests are called before "putFile" requests

**URL:** <https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568>\
**Category:** Development\
**Tags:** answered\
**Created:** [January 19, 2023, 9:57am UTC](https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568 "2023-01-19T09:57:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienfastre](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@julienfastre](https://forum.collaboraonline.com/u/julienfastre)\
**Post date:** [January 19, 2023, 9:57am UTC](https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568/1 "2023-01-19T09:57:41Z")

</div>

I encounter problems with a Collabora Online intregation the users get the message that the document cannot be recovered.

I analyzed the log and I see that, some time, the unlock comes **before** the putFile request. And the putFile requests fails, because the lock does not exists any more.

This is an extract of the log for the same document. They all use the same access token (the end user does not reload the editor page). As our app is load-balanced, the host may be different for each request:

| timestamp | host | ctxt\_route | |
| --- | --- | --- | --- |
| {InstantSeconds=1674046477},ISO,Z resolved to 2023-01-18T12:54:37.843851 | chill-5dcd7b4d55-5t849 | chill\_wopi\_file\_edit | ← the end user opens the editor page |
| {InstantSeconds=1674046479},ISO,Z resolved to 2023-01-18T12:54:39.705799 | chill-5dcd7b4d55-gvgvq | checkFileInfo | ← load the page |
| {InstantSeconds=1674046480},ISO,Z resolved to 2023-01-18T12:54:40.247943 | chill-5dcd7b4d55-b7nh5 | getFile | |
| {InstantSeconds=1674046481},ISO,Z resolved to 2023-01-18T12:54:41.465522 | chill-5dcd7b4d55-5t849 | lock | |
| {InstantSeconds=1674046794},ISO,Z resolved to 2023-01-18T12:59:54.882569 | chill-5dcd7b4d55-gvgvq | putFile | |
| {InstantSeconds=1674047038},ISO,Z resolved to 2023-01-18T13:03:58.787539 | chill-5dcd7b4d55-gvgvq | unlock | |
| {InstantSeconds=1674047040},ISO,Z resolved to 2023-01-18T13:04:00.424865 | chill-5dcd7b4d55-gvgvq | putFile | ← the problem happens here, the request is rejected because the document is unlocked |
| {InstantSeconds=1674047165},ISO,Z resolved to 2023-01-18T13:06:05.579083 | chill-5dcd7b4d55-b7nh5 | checkFileInfo | |
| {InstantSeconds=1674047165},ISO,Z resolved to 2023-01-18T13:06:05.909414 | chill-5dcd7b4d55-5t849 | getFile | |
| {InstantSeconds=1674047166},ISO,Z resolved to 2023-01-18T13:06:06.263681 | chill-5dcd7b4d55-5t849 | lock | |
| {InstantSeconds=1674047185},ISO,Z resolved to 2023-01-18T13:06:25.541099 | chill-5dcd7b4d55-gvgvq | putFile | |
| {InstantSeconds=1674047291},ISO,Z resolved to 2023-01-18T13:08:11.857386 | chill-5dcd7b4d55-b7nh5 | putFile | |
| {InstantSeconds=1674048070},ISO,Z resolved to 2023-01-18T13:21:10.813988 | chill-5dcd7b4d55-5t849 | lock | |
| {InstantSeconds=1674048975},ISO,Z resolved to 2023-01-18T13:36:15.956676 | chill-5dcd7b4d55-b7nh5 | lock | |
| {InstantSeconds=1674049171},ISO,Z resolved to 2023-01-18T13:39:31.752212 | chill-5dcd7b4d55-5t849 | putFile | |
| {InstantSeconds=1674049173},ISO,Z resolved to 2023-01-18T13:39:33.622750 | chill-5dcd7b4d55-5t849 | unlock | ← ok, correct order |

This happens ~10% of the document views (20-30 times a day, for 400-500 documents opened)

I think I will try to solve this problem by introducing a delay in unlock of a couple of seconds (5 seconds). So that, if a putFile request will still find a lock if they happens in this delay time.

My questions are:

- should I open a ticket [here](https://github.com/CollaboraOnline/online/issues) ? Is this “normal”, or a bug ?

- Do you think that adding this delay will solve this problem without any side effect ?

Thanks

---

<div class="post-metadata">

**Author:** ![bearon](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bearon](https://forum.collaboraonline.com/u/bearon)\
**Post date:** [January 22, 2023, 4:49am UTC](https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568/2 "2023-01-22T04:49:51Z")

</div>

Which version are you using? This bug should be fixed in 22.05.8.4, if you have an older version, I’d suggest updating and checking again.

---

<div class="post-metadata">

**Author:** ![julienfastre](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@julienfastre](https://forum.collaboraonline.com/u/julienfastre)\
**Post date:** [January 23, 2023, 1:05pm UTC](https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568/3 "2023-01-23T13:05:50Z")

</div>

Indeed, this is version 21.11.8.3

I will do the upgrade soon.

Thanks!

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [August 6, 2024, 10:14am UTC](https://forum.collaboraonline.com/t/wopi-integration-unlock-requests-are-called-before-putfile-requests/1568/4 "2024-08-06T10:14:31Z")

</div>


