Bug Hunting Session
Bug 75488 - Filesystem lock on shared Calc Documents in Excel-format not released
Summary: Filesystem lock on shared Calc Documents in Excel-format not released
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
: 94152 (view as bug list)
Depends on:
Blocks: Network File-Lock
  Show dependency treegraph
 
Reported: 2014-02-25 10:28 UTC by Patrick Smits
Modified: 2018-12-20 07:58 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
(Dutch) screenshot with error (19.50 KB, image/jpeg)
2014-02-25 10:28 UTC, Patrick Smits
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Smits 2014-02-25 10:28:48 UTC
Created attachment 94709 [details]
(Dutch) screenshot with error

Problem description: 

Steps to reproduce:
1. User 1 creates a shared document and saves it on a network share.
2. User 2 edits the documents and saves it.
3. User 1 tries to reopen it, which results in the error in the (Dutch) screenshot. The buttons translate as Open Read-only, Open copy, Cancel.

Current behavior:
Document is locked by User 2, so User 1 can't edit it

Expected behavior:
File system lock is released, so User 1 can edit the document.



              
Operating System: All
Version: 4.2.0.4 release
Comment 1 Cor Nouws 2014-02-25 11:29:24 UTC
Hi p,

thanks for the report.
Can you pls give details on the network, for people that want to reproduce the issue?

Best,
Cor
Comment 2 Patrick Smits 2014-02-25 12:13:08 UTC
Yep, Documents are shared via a Synology NAS. We use Windows clients.

If we use ODS as exchange format it just works. The problem occurs only with XLS.
Comment 3 Cor Nouws 2014-02-25 12:42:42 UTC
thanks,
Looks like Bug 36852, Bug 63995 are closely related.
Comment 4 raal 2014-09-30 17:52:45 UTC
I can reproduce with following configuration

LO 4.3.3, Ubuntu
LO 4.3.2, Win7 in virtualbox on the same machine
shared /tmp between Linux and Windows

When shared file is XLS, then error message appears:
        Document file 'file.xls' is locked for editing by

When shared file is XLSX, then error message is:
	This document was last saved by Excel.  Some formula cells may produce different results when recalculated.
	Do you want to recalculate all formula cells now? <YES>
	This spreadsheet is no longer in shared mode.
	Save your spreadsheet to a separate file and merge your changes to the shared spreadsheet manually.
Comment 5 tommy27 2015-06-21 19:05:22 UTC
(In reply to raal from comment #4)
> I can reproduce with following configuration
> 
> LO 4.3.3, Ubuntu
> LO 4.3.2, Win7 in virtualbox on the same machine
> shared /tmp between Linux and Windows
> 
> ...

I set status to NEW because of this confirmation.
did you try with 4.4.3.2? is the bug still present ?
Comment 6 Patrick Smits 2015-06-22 09:36:29 UTC
Yep, behavior is still the same with 4.4.3.2. However I also noticed something else.

If the shared xls is created and saved, as soon as you close the document, it no longer is shared. So even user 1 can't open the document as shared xls document anymore.
Comment 7 Christophe Lyon 2016-03-22 21:18:30 UTC
I was about to file a new bug report for a similar problem, so I'm updating this one instead.

I've noticed locking problems when I want to open LO files stored on my Synology NAS, exported via NFS. I ran LO from Linux Ubuntu clients (15.10).

When trying to open a file on the NFS server, LO shows an error message (after about 30 seconds, probably a timeout) and proposes to open the file read-only or to open a copy.

I "solved" the problem by rebooting the NAS, but it re-occurs after some time.

I've just given a quick look at LO sources, and noticed that in sal/osl/unx/file.cxx (openFilePath), locks are acquired using fcntl(F_WRLCK), but I couldn't find code to unlock the file.

There is support to unlock files in sal/osl/unx/profile.cxx (OslProfile_lockFile), but I don't know if it's actually used.

My assumption is that LO could keep acquiring locks, never releasing them, until the NAS is out of resources.

Is that plausible?
Comment 8 Christophe Lyon 2016-03-27 20:31:17 UTC
Actually I just ran
$ strace -f soffice /path/to/nfs/file |& grep LK
[pid 19093] fcntl(14, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(14, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(29, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0} <unfinished ...>
[pid 19093] fcntl(35, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(35, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(35, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(42, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19093] fcntl(42, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19096] fcntl(43, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 19107] fcntl(14, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0

I only opened the file, then quit libreoffice.

As you can see several locks are acquired, but none is released.
Comment 9 QA Administrators 2017-12-18 03:26:37 UTC Comment hidden (obsolete)
Comment 10 Christophe Lyon 2017-12-18 20:22:45 UTC
I've just run the same command as in comment #8:
$ Actually I just ran
$ strace -f soffice /path/to/nfs/file |& grep LK
[pid 19070] fcntl(15, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(15, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(24, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0} <unfinished ...>
[pid 19073] fcntl(25, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(27, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(33, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(33, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(39, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19096] fcntl(37, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(24, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(24, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19099] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
[pid 19070] fcntl(16, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0

So, as expected nothing has changed here.
This time, I used version 1:5.4.2-0ubuntu0.17.10.1 from Ubuntu 17.10

Is anyone actually looking at bug reports?
Comment 11 Buovjaga 2017-12-18 20:33:44 UTC
*** Bug 94152 has been marked as a duplicate of this bug. ***
Comment 12 QA Administrators 2018-12-20 03:55:48 UTC Comment hidden (obsolete)
Comment 13 Christophe Lyon 2018-12-20 07:58:33 UTC
Hello,

Just re-tested with libreoffice from my Ubuntu-18.04.1 machine.

Version: 6.0.7.3
Build ID: 1:6.0.7-0ubuntu0.18.04.2
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); Calc: group

Same command as in comment #8, same issue.