Writer files containing images corrupt - but with a possible twist....?

First of all - first time poster, so please go easy on me!
Seeing the common problem that’s been around for a while - odt files that contain images are getting corrupted.
I’ve read (hopefully) all the guidelines re using images and I (think) I’m largely following good protocol.
Environment:
Raspberry Pi 5, Bookworm OS - all updates applied as per June 4th 2024
Can also recreate on Raspberry Pi 400 - both on Bookworm and Bullseye (previous OS release) - again with all updates applied as per June 2024
LibreOffice Version 7.4.7.2 (Bookworm OS) 7.0.4.2 (Bullseye OS)
Saving to cifs Share on a Synology NAS (happy to supply version of DSM if that’s relevant)

Problem creation
Create several screenshots and insert in writer document using insert->Image (not cut and paste) - save file to Shared drive.
Close and reopen Writer - add additional images to file and save - repeated this several times - odt file remains readable.
Then change the size of the images in the document by selecting and dragging.
Save the file, close and re-open Writer - File is corrupted - repair fails.

Up to this point, everything sounds similar to issues that have been reported in the past.
Now for the twist. If I perform EXACTLY the same steps above, but save the file locally on the PI (to an SSD on the Pi 5 or the SD Card on the pi 400, I cannot recreate the issue!

Also, if I setup a cifs share on one of the Pis and save to that from the otherPi, I can’t recreate the issue either!
Logic dictates the issue lies with the Synology NAS, but this is quite a heavily used box and I ONLY see the issue with LibreOffice.

Also, I have taken IP packet traces of both successful and corrupt saves and I can see some very strange behaviour indeed in the SMB protocol exchanges. In summary:
Saves to a cifs share on the PI are written in one protocol write (send the data and a single SMB write request).
Saves to the Synology NAS are broken down into several SMB write requests. The byte counts on some of the writes overlap by a number of bytes (suggesting the data that was last written is being overwritten). I also see a lot of read requests between the writes. Some of these reads request data beyond what has been written, and some of them are for the last few thousand bytes of the last write request).
These behaviours are occurring during the creation/write of the .tmp file that is eventually renamed to the .odt file at the end of the save process.

So I am now stuck at where to go next.
In summary:
Can create with different OS versions (which in turn have different LibreOffice versions)
Only seems to occur when images in document are resized (or possibly having their anchor points changed)
Can only create when saving to Share on Synology NAS- not to local drive or a cifs share on another Pi.
All logic points to the Synology NAS, but this is quite a heavily used box and it ONLY happens with LibreOffice files - nothing else.
Network is solid - Packet traces are clean in that respect.
I can solidly recreate the issue - it’s not intermittent.

Any suggestions of whereto go next would be appreciated.

Go easy on me…and thanks for any help that’s forthcoming!

Update and workaround/solution

I compared packet traces of the mounts performed to both the Synology NAS and the Samba Share defined on the Pi 400. One difference in the negotiation was that the Synology did not support SMB leases- the pi 400 Samba server did.
I enabled SMB Leasing on the Synology (this is not enabled by default in Synology DSM) and the problem appears to be resolved (I need to perform some more testing).
Packet traces of the now successful save show the same behaviour as the saves to the Pi400 Samba share… The whole file is written in a single write request as opposed to several write/read requests that seem to overlap each other.
Also, the Oplock performed on the odt and tmp files has changed from Batch (x009) on the failing save to Lease (x0FF) on the successful save.

Have I uncovered something significant here or is this already a known issue/bug…? If it is a bug then what is the bug with - LO?, Samba Client?

Again - advice how to progress/report would be appreciated…

There are two bug reports related to Synology.
https://bugs.documentfoundation.org/show_bug.cgi?id=123412
https://bugs.documentfoundation.org/show_bug.cgi?id=141639
You can add a new one, then share the bug number here.

1 Like

Thank you LeroyG!
Re those two bug reports, 141639 looks like it’s related. I’m not sure about 123412 (I’ll take a closer look when I have time).

I’ve done some further testing this morning and have managed to recreate using a Samba Server that doesn’t run on Synology (on a pi 400 running Bookworm OS).
If I disable SMB leases in smb.conf with smb2 leases = no, I see the corruption.
This parm is set to yes by default, but for some reason, Synology boxes seem to come configured with it disabled for some reason.

I will raise a bug later today and share it here. If I’m able to, I’ll also add a comment to the other two bugs to say this might be a workaround.
Thanks again.

1 Like

I have raised bug 161446 for this issue

https://bugs.documentfoundation.org/show_bug.cgi?id=161446

1 Like