Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] [Windows] Sync folder on UNC-symlinked network storage is not working anymore #5633

Closed
bOOT-CoDe opened this issue Mar 20, 2017 · 40 comments
Assignees
Labels

Comments

@bOOT-CoDe
Copy link

bOOT-CoDe commented Mar 20, 2017

Expected behaviour

Synchromize sync folder.

Actual behaviour

An error about not accessible folder is repeated.

Steps to reproduce

  1. set the sync folder to network drive
  2. or set the sync folder to symlink on local drive, symlink's target is on the network drive (this worked in the client release 2.2.4.6408)
  3. try to synchronize

Client configuration

Client version:
2.3.0.6780
Operating system:
Windows Vista Home 32-bit
Windos 7 Enterprise 64-bit

@bOOT-CoDe bOOT-CoDe changed the title Client 2.3.0.6780: Network storage is not Client 2.3.0.6780: Sync folder on network storage is not working anymore Mar 20, 2017
@SamuAlfageme
Copy link
Contributor

Hey @bOOT-CoDe! thanks for reporting!

I've just done a few tests with a similar setup (syncing my Z:\\ drive, a network-mounted drive) with client version 2.3 and everything seemed to work properly:

smb

Do you have any client logs or more info (e.g. which kind of filesystem runs, if the disk is encryped, etc.) to provide that could help us reproduce the issue you are running into? Thanks!

@bOOT-CoDe
Copy link
Author

Hi @SamuAlfageme,
my setup is little bit different, I have so many drive letters used therefore I am using UNC paths too. Because I was unabl to settup direct UNC path as the sync folder in ownCloud client I use symlink to folder on network drive, see the screenshot. There is another advantage, I can move sync folder to different path (e.g. another network storage) and then just update symlink to point to a new target.
image
Target network disk is not encypted, it is some Synology NAS accessed over SAMBA, local and remote file systems are both NTFS. This setup is working with older ownCloud clients.

@SamuAlfageme SamuAlfageme changed the title Client 2.3.0.6780: Sync folder on network storage is not working anymore [Windows] Sync folder on UNC-symlinked network storage is not working anymore May 8, 2017
@SamuAlfageme
Copy link
Contributor

@bOOT-CoDe I see, that's a bit more complex scenario, I will try to reproduce.

An error about not accessible folder is repeated.

Can you provide some client logs and the error string the client is displaying?

Thanks a lot!

@NM78
Copy link

NM78 commented May 15, 2017

@SamuAlfageme SamuAlfageme self-assigned this May 15, 2017
@SamuAlfageme
Copy link
Contributor

@bOOT-CoDe @NM78 I've tested different network shares (not SMB, though) using both Windows' shortcuts and .symlinks and so far I'm unable to reproduce with oC 10.0 nor 9.1.4.

Because I was unabl to settup direct UNC path as the sync folder in ownCloud client I use symlink to folder on network drive,

Also, I was able to use the UNC path directly in the setup wizard. Did you experience otherwise?

Do you guys have any additional steps that could be leading to this issue?. Also, client logs will be really helpful to track what's happening under the client's hood.

@NM78
Copy link

NM78 commented May 15, 2017

@SamuAlfageme

Thx 4 your fast answer! Here is my log:

OCC::FolderMan::slotScheduleFolderByTime: ** scheduling folder "1" , the last 1 syncs failed , anotherSyncNeeded 0 , last status: "Error" , time since last sync: 12916
OCC::FolderMan::scheduleFolder: Schedule folder  "1"  to sync!
OCC::SocketApi::slotUpdateFolderView: Not sending UPDATE_VIEW for "1" because status() is 1
OCC::ownCloudGui::slotSyncStateChange: Sync state changed for folder  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/" :  "Not yet Started"
OCC::ActivitySettings::slotRefresh: void OCC::ActivitySettings::slotRefresh(OCC::AccountState*) do not check as last check is only secs ago:  13
OCC::FolderMan::startScheduledSyncSoon: Starting the next scheduled sync in 0 seconds
OCC::FolderMan::slotStartScheduledFolderSync: XX slotScheduleFolderSync: folderQueue size:  1
OCC::SocketListener::sendMessage: SocketApi:  Sending message:  "UPDATE_VIEW:\\\\qnap-01\\Alle_Firmen\\Datenbanken\\OwnCloud"
OCC::ownCloudGui::slotSyncStateChange: Sync state changed for folder  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/" :  "SyncPrepare"
OCC::Folder::startSync: *** Start syncing  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/"  - client version 2.3.2 (build 6928)
OCC::Folder::setIgnoredFiles: ==== adding system ignore list to csync: "C:/Program Files (x86)/ownCloud/sync-exclude.lst"
OCC::Folder::setIgnoredFiles: ==== adding user defined ignore list to csync: "C:/Users/nico/AppData/Local/ownCloud/sync-exclude.lst"
[...]
OCC::FolderMan::slotFolderSyncStarted: >===================================== sync started for  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/"
OCC::SyncEngine::startSync: There are 2194728050688 bytes available at "//qnap-01/Alle_Firmen/Datenbanken/OwnCloud/" and at least 50000000 are required
OCC::SyncEngine::startSync: ===== new sync (no sync journal exists)
OCC::SyncEngine::startSync: "===== Using Qt 5.6.2 SSL library OpenSSL 1.0.2h  3 May 2016 on Windows 10"
OCC::SqlDatabase::openHelper: Error: "unable to open database file" for "//qnap-01/Alle_Firmen/Datenbanken/OwnCloud/._sync_9e589af46803.db"
OCC::SyncJournalDb::checkConnect: Error opening the db:  "unable to open database file"
OCC::SyncEngine::startSync: No way to create a sync journal!
OCC::SyncJournalDb::close: void OCC::SyncJournalDb::close() "//qnap-01/Alle_Firmen/Datenbanken/OwnCloud/._sync_9e589af46803.db"
OCC::SyncJournalDb::commitTransaction: No database Transaction to commit
OCC::SyncEngine::finalize: CSync run took  0
OCC::Folder::slotSyncFinished:  - client version 2.3.2 (build 6928)  Qt 5.6.2  SSL  OpenSSL 1.0.2h  3 May 2016
OCC::Folder::slotSyncFinished: -> SyncEngine finished with ERROR
OCC::Folder::showSyncResultPopup: OO folder slotSyncFinished: result:  2
OCC::Folder::slotSyncFinished:     * owncloud csync thread finished with error
OCC::Folder::slotSyncFinished: the last 2 syncs failed
OCC::SocketListener::sendMessage: SocketApi:  Sending message:  "UPDATE_VIEW:\\\\qnap-01\\Alle_Firmen\\Datenbanken\\OwnCloud"
OCC::ownCloudGui::slotSyncStateChange: Sync state changed for folder  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/" :  "Error"
OCC::FolderWatcher::pathIsIgnored: * Ignoring file "//qnap-01/Alle_Firmen/Datenbanken/OwnCloud/.owncloudsync.log"
OCC::FolderMan::slotFolderSyncFinished: <===================================== sync finished for  "https://mydomain.net/owncloud/remote.php/dav/files/myuser/"
OCC::ConnectionValidator::checkAuthentication: # Check whether authenticated propfind works.
OCC::AbstractNetworkJob::start: !!! OCC::PropfindJob created for "https://mydomain.net/owncloud" + "/" "OCC::ConnectionValidator"
OCC::AbstractNetworkJob::start: !!! OCC::PropfindJob created for "https://mydomain.net/owncloud" + "/" "OCC::QuotaInfo"

The win 2.3.2 client shows a red message "Synchronisationsbericht konnte nicht initialisiert werden."

I know, we had a similar issue some years (maybe 2?) ago. But i could not find a link to this anywhere.

EDIT: Sorry, 4 the horrorbly formated Log Code, i used the "insert code" tag for this and dont know how to do this better.

@SamuAlfageme
Copy link
Contributor

SamuAlfageme commented May 16, 2017

@NM78 thanks a lot for the logs! Is your network folder an SMB share as @bOOT-CoDe? maybe we can isolate the issue in those. However, even with that share I'm not being able to reproduce:

  1. Create a SMB share in a macOS 10.12 and a guest Windows 7 VM - Grant write permissions to the user you'll use to connect.
  2. Map it as Network Drive (\\host\share)
  3. Create a .symlink on the desktop pointing to the UNC path of the share.
  4. Use either, the drive letter or the symlink to set up the local sync folder.

What are the logs saying:

OCC::SyncEngine::startSync: No way to create a sync journal!:

(syncengine.cpp)

qCWarning(lcEngine) << "No way to create a sync journal!";
emit csyncError(tr("Unable to open or create the local sync database. Make sure you have write access in the sync folder."));

So, first thing to check is whether you have write permissions on the network share. This also match the red message you're seeing on the client:

Read & Write Permissions Read-Only Permissions
w_permissions wo_permissions

OCC::SyncEngine::startSync: ===== new sync (no sync journal exists)

Even though, this says otherwise, I have to ask if there was an already existing and working (with client 2.2.4) sync folder on the shared drive? and the update started causing this problems?. This could be a permissions issue on the .db file (the migration strategy: https://github.com/owncloud/client/blob/master/src/libsync/syncjournaldb.cpp#L64 might overlook windows-specific permissions)

Problems creating the sync journal:

In the logs these 2 functions appear as failing:

... maybe we can include more debugging messages on the logs in a testing client to see what's going on there. cc/ @guruz @ckamm what do you guys think?

Some changes introduced in 2.3.0 that might relate:

@guruz guruz added this to the 2.3.3 (Qt 5.6.2 for Linux) milestone May 16, 2017
@guruz guruz added the type:bug label May 16, 2017
@guruz guruz changed the title [Windows] Sync folder on UNC-symlinked network storage is not working anymore [Regression] [Windows] Sync folder on UNC-symlinked network storage is not working anymore May 16, 2017
@guruz
Copy link
Contributor

guruz commented May 16, 2017

@bOOT-CoDe Did you also use 2.2.x before and it worked?

I think @dragotin or me or @ckamm might have also changed something about canonical file system paths of sync folders?

@bOOT-CoDe @NM78 I'm wondering if you set the OWNCLOUD_SQLITE_JOURNAL_MODE environment variable to DELETE for the ownCloud client process, does it behave differently?

@guruz
Copy link
Contributor

guruz commented May 22, 2017

@bOOT-CoDe @NM78 Any news?

@ElpyDE
Copy link

ElpyDE commented Jun 2, 2017

Unfortunately, I can confirm this bug.

Upgraded Windows Client to Version 2.3.1 (build 8) (supplied by Nextcloud), from some 2.2.x Version (not completely sure).

Previously, I had a "local" folder at a UNC-symlinked network storage like \\fileserver\some further\path\ and it worked great. After upgrade, the client tells me "Unable to initialize a sync journal." (actually it tells me in German "Synchronisationsbericht konnte nicht initialisiert werden."

I tried and none of these worked...

  1. recreating the folder sync.
  2. syncing with a newly created UNC folder.
  3. syncing with the complete folder (on server) instead of just a subdirectory.
  4. connecting a network drive first and using this as local folder

What I found, however, was that the .owncloudsync.log is created and written into:

# timestamp | duration | file | instruction | dir | modtime | etag | size | fileId | status | errorString | http result code | other size | other modtime | other etag | other fileId | other instruction
#=#=#=# Syncrun started 2017-06-02T19:46:53
#=#=#=# Syncrun finished 2017-06-02T19:46:53 (last step: 7 msec, total: 7 msec)
#=#=#=# Syncrun started 2017-06-02T19:47:06
#=#=#=# Syncrun finished 2017-06-02T19:47:06 (last step: 7 msec, total: 7 msec)
... and so on ...

Client Log: client-log-v2.3.1.txt (after click on "continue sync" for the non-working folder sync)

Syncing with local folders on my PC works as expected.

Additional Info:

Local: Windows 8.1
Server with network share: Some Windows Server Edition
Owncloud Server(s): sciebo (ownCloud 9.0.8, Enterprise Version) and Nextcloud 10.0.5 (stable)

@ckamm
Copy link
Contributor

ckamm commented Jun 6, 2017

I've tried reproducing again, but without success.

  • Shared a folder
  • Mapped it as a network drive
  • Synced a server folder to that mapped network drive without problems.

Looking at the logs again, it seems it's sqlite3 that returns SQLITE_CANTOPEN. We did indeed update sqlite between 2.2.4 and 2.3.1. It seems we could use sqlite3_system_errno to get information about the underlying issue.

@ElpyDE @bOOT-CoDe: Would you be up for testing with a 2.4 snapshot build that has additional logging in the sync journal creation code?

@NM78
Copy link

NM78 commented Jun 6, 2017

Mapped it as a network drive

My folder isnt mapped as network drive. Its a directly path like "\ \ QNAP-01\MyFiles\OwnCloud"

This is what works in earlyer versions and in 2.2.4.

@michaelstingl
Copy link
Contributor

@NM78 Could you provide or link a quick step-by-step guide how to configure the "directly path" thingy?

@ckamm
Copy link
Contributor

ckamm commented Jun 6, 2017

@NM78 I was testing @ElpyDE's setup, direct UNC paths had worked for me with 2.3 before. The underlying cause is likely the same - it looks identical in the logs.

@ckamm
Copy link
Contributor

ckamm commented Jun 6, 2017

@NM78 @ElpyDE @bOOT-CoDe What kind of filesystem is the network drive running? Maybe that helps for reproducing the problem.

@ElpyDE
Copy link

ElpyDE commented Jun 6, 2017

Indeed, it worked on a network share on my local computer (Win 8.1, NTFS).

The non-working share is based on my institute's fileserver. My admin just told me it's some sort of Linux based OS. Filesystem there is ext4. Network share is via Samba (SMB).

Edit: The local share on my Windows PC works already with permission "change" and "read" and without "full access". Not sure if that helps anyhow.

@ckamm
Copy link
Contributor

ckamm commented Jun 6, 2017

@ElpyDE Thanks for checking with them. I've now tested a simple samba share of an ext4 directory, but it still works for me.

I hope that the extra logging added to master will allow us to pinpoint what exactly goes wrong with database creation in sqlite3. I'll ping here once a nightly with the code becomes available.

@guruz
Copy link
Contributor

guruz commented Jun 7, 2017

@bOOT-CoDe @NM78 I'm wondering if you set the OWNCLOUD_SQLITE_JOURNAL_MODE environment variable to DELETE for the ownCloud client process, does it behave differently?

@ckamm
Copy link
Contributor

ckamm commented Jun 8, 2017

@guruz Setting the environment variable should have no effect since it already fails at sqlite3_open_v2 - we only set the journal mode with a pragma afterwards.

ckamm added a commit that referenced this issue Jun 8, 2017
@ElpyDE
Copy link

ElpyDE commented Jun 14, 2017

More logs... downloaded, installed and tested with two nightly builds from https://download.owncloud.com/desktop/daily/

Version 2.3.3-nightly20170612 (build 34)

Log: ownCloud--Version 2.3.3-nightly20170612 (build 34).log.txt

Version 2.4.0-nightly20170613 (build 20)

Log: ownCloud--Version 2.4.0-nightly20170613 (build 20).log.txt

For both versions, I configured 3 folder syncs:

  • 🆗 ownCloud-test1 - local folder on my PC:
    C:/Users/mynamef/ownCloud-test1/
  • 🆗 ownCloud-test2 - local folder an SMB share, but on my Win-PC:
    \\mylocalpc\ownCloud-test2
  • ❌ ownCloud-test3 - local folder on the above mentioned Linux based fileserver
    \\FILESERVER\Some Path\Myname\ownCloud-test3

The first and second syncs worked perfectly. The third did not.

log files have been anonymized, hopefully in a meaningful way

@ckamm
Copy link
Contributor

ckamm commented Jun 14, 2017

@ElpyDE Thank you!

Most relevant:

06-14 12:26:20:700 [ warning sync.database.sql ]:	CANTOPEN extended errcode:  14
06-14 12:26:20:700 [ warning sync.database.sql ]:	CANTOPEN system errno:  2

The 14 is just SQLITE_CANTOPEN unfortunately, so sqlite doesn't have anything more to tell us. System errno 2 is ERROR_FILE_NOT_FOUND. Did we introduce this error by updating sqlite?

@guruz
Copy link
Contributor

guruz commented Jun 14, 2017

@dschmidt Could you create a Windows build from the sqlite3_revert_3161 branch and paste the .exe link here? :)

@guruz
Copy link
Contributor

guruz commented Jun 15, 2017

@ElpyDE @NM78 @bOOT-CoDe https://download.owncloud.com/desktop/daily/ownCloud-2.4.0.44git-setup.exe Should have the older sqlite3 version. Does it work better with that?

@ckamm
Copy link
Contributor

ckamm commented Jun 15, 2017

@guruz Nice turnaround! Note that as far as I can tell updating sqlite to 3.14.2 was also done for 2.3.0 (f6355e1)

@guruz
Copy link
Contributor

guruz commented Jun 15, 2017

I need to revert one more commit, @ckamm is right. Will make a build..

@guruz
Copy link
Contributor

guruz commented Jun 15, 2017

@ElpyDE
Copy link

ElpyDE commented Jun 15, 2017

Tested both builds linked by @guruz - with equal settings as above in #5633 (comment)

Unfortunately, the results are also equal: Local directory and share on Win-PC work. Share on Linux-Server (ownCloud-test3) fails.

ownCloud-2.4.0.44git-setup.exe

Log: ownCloud--Version 2.4.0git (build 44).log.txt

ownCloud-2.4.0.45git-setup.exe

Log: ownCloud--Version 2.4.0git (build 45).log.txt

Warnings like before in both builds alike, here from build 45:

06-15 15:42:39:167 [ warning sync.database.sql ]:	Error: "unable to open database file" for "//FILESERVER/Some Path/Myname/ownCloud-test3/._sync_c0ac7e6f6814.db"
06-15 15:42:39:168 [ warning sync.database.sql ]:	CANTOPEN extended errcode:  14
06-15 15:42:39:168 [ warning sync.database.sql ]:	CANTOPEN system errno:  2
06-15 15:42:39:168 [ warning sync.database ]:	Error opening the db:  "unable to open database file"
06-15 15:42:39:168 [ warning sync.engine ]:	No way to create a sync journal!

@ckamm
Copy link
Contributor

ckamm commented Jun 16, 2017

@ElpyDE Thanks again for the tests.

In that case my last suggestion would be that maybe the paths we pass to sqlite3_open differ in format between 2.2 and 2.3. It'd be surprising if that mattered, since 2.3 works for some network shares and mounted drives. I'll look at these and report here.

Besides that, the only other option I can imagine is that this particular path is somehow invalid for the network drive? @ElpyDE can you manually create a //FILESERVER/Some Path/Myname/ownCloud-test3/._sync_c0ac7e6f6815.db file?

@ckamm
Copy link
Contributor

ckamm commented Jun 16, 2017

@guruz I've now run 2.2.4 and a newer version on windows, and these paths get fed to sqlite3:

2.2.4: //mywin7/test/.csync_journal.db
2.3+ : //mywin7/test/._sync_142df90e8e0f.db

So there's no structural difference besides the different database file name.

@ElpyDE Is there anything else hidden in your "Some Path/Myname" component? Would you be up for also providing us with a log from a 2.2.4 client where it works? (you can get the 2.2.4 windows binaries from https://owncloud.org/changelog/desktop/) I assume mounting the path to a network drive leads to the same issue?

@ElpyDE
Copy link

ElpyDE commented Jun 16, 2017

Version 2.2.4 works as expected:

Log: ownCloud--Version 2.2.4 (build 6408).log.txt


@ckamm was right estimating a problem with invalid path:

I cannot create a file called ._sync_142df90e8e0f.db on the remote fileserver. Tested several methods (including saving with Notepad++, Drag&Drop a File from my Desktop, touch or mv in the Git Bash, renaming within Windows Explorer)

Some further research showed, that it is about the "._" prefix: ._something.ext cannot be created, too.

$ mv something.ext ._something.ext
mv: cannot move 'something.ext' to '._something.ext': No such file or directory

File names that work

  • .something.ext
  • _something.ext
  • .a_something.ext
  • _.something.ext
  • .csync_journal.db and .owncloudsync.log (were left over from my last tests)

File names that don't work

  • ._sync_142df90e8e0f.db
  • ._something.ext
  • ._.something.ext

@guruz
Copy link
Contributor

guruz commented Jun 16, 2017

TODO:
Is this something a file server admin would set?
Or a known Windows limitation?

@ElpyDE
Copy link

ElpyDE commented Jun 16, 2017

PS: The "don't work" file names do work on my local Windows PC.

@SamuAlfageme
Copy link
Contributor

@guruz

Is this something a file server admin would set?

https://www.lavalite.de/2008/10/12/disable-creation-of-_files-dot-underscore-files/

@guruz
Copy link
Contributor

guruz commented Jun 16, 2017

@NM78 @bOOT-CoDe Can you please also try the above filenames on your setup and also ask your sysadmin if he/she knows about this? ^^

@ckamm
Copy link
Contributor

ckamm commented Jun 16, 2017

@ElpyDE Great, we found it!

The reason the journal file has the "._" prefix is to ensure that the new journal file won't be uploaded to the server if someone switches back from client version 2.3 to 2.2. For this reason we pick a filename that will be excluded by an ignore pattern that was already present in 2.2.

It looks like this particular prefix is often forbidden by samba configurations though. There are a couple of other ignore patterns, but is seems possible that if we called the journal .sync_baaf.swp, for example, this might equally be forbidden by some admins.

So maybe the most reasonable path open to us is to give up on the nice compatibility guarantee and use .sync_baaf.db as a journal name if the "._" name fails. (also suggested by @guruz in IRC)

@ckamm ckamm assigned ckamm and unassigned SamuAlfageme Jun 16, 2017
@ckamm ckamm removed the Needs info label Jun 16, 2017
@SamuAlfageme
Copy link
Contributor

@ckamm @ElpyDE Indeed, just tried with the veto (veto files = /._*/.DS_Store/) from the link in #5633 (comment) and observed the exact same issue reproducing.

ckamm added a commit that referenced this issue Jun 16, 2017
When synchronizing a folder on a samba share, creating files that begin
with ._ is often forbidden. This prevented the client from creating
its ._sync_abcdef.db file.

Now, it'll check whether the preferred filename is creatable, and if
it isn't it'll use .sync_abcdef.db instead.

The disadvantage is that this alternative path won't be ignored by
older clients - that was the reason for the ._ prefix.
@ckamm
Copy link
Contributor

ckamm commented Jun 16, 2017

PR #5844, but still untested

@ckamm
Copy link
Contributor

ckamm commented Jun 16, 2017

@ElpyDE As a workaround, you could try opening your owncloud.cfg and changing the journalPath setting. Setting it to something like .sync_142df90e8e0f.db.swp might work.

@ElpyDE
Copy link

ElpyDE commented Jun 16, 2017

@ckamm Thanks for the workaround. Works like a charm ✔️

Thank you all for your wonderful work!

@guruz
Copy link
Contributor

guruz commented Jun 20, 2017

Closing in favour of PR. :)

@guruz guruz closed this as completed Jun 20, 2017
guruz pushed a commit that referenced this issue Jun 20, 2017
When synchronizing a folder on a samba share, creating files that begin
with ._ is often forbidden. This prevented the client from creating
its ._sync_abcdef.db file.

Now, it'll check whether the preferred filename is creatable, and if
it isn't it'll use .sync_abcdef.db instead.

The disadvantage is that this alternative path won't be ignored by
older clients - that was the reason for the ._ prefix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants