winfsp / sshfs-win

SSHFS For Windows
https://winfsp.dev
Other
4.92k stars 252 forks source link

Empty files are created when being called from scheduled task #156

Open t2consult opened 4 years ago

t2consult commented 4 years ago

Hi,

I have installed winfsp-1.6.20027.msi and sshfs-win-3.5.20024-x64.msi and and experiencing the following phenomena. I can reproduce this on Windows 10.0.18363.693 (Win 10 and Server 2012 R2)

When files are created trough a scheduled task and it is set to "run the task also when user is not logged on" - the files are created empty.

Steps to reproduce

Maybe that's a duplicate with #11, but there's not much information on how to solve the issue in there.

Also to be seen here: https://drive.google.com/file/d/1_r_vOYDCfS_I6iMaQb9UjDGW5Ll48JwX/view

billziss-gh commented 4 years ago

I do not have a full understanding of how the task scheduler runs tasks. However the "Map Network Drive" functionality works correctly only when the user is logged in.

To achieve what you want you may want to permanently mount the file system regardless of whether the user is logged in or not. Since you are already using the task scheduler, you may be able to setup a task to mount the file system during system startup.

t2consult commented 4 years ago

Hi Bill,

thank you for getting back to me. It's super strange as the network drive is there and the file is also being written to: But it's size is empty.

The same issue is not curring with trying with commercial products like Netdrive, ExpanDrive or nsoftware SFTP drive.

If setting any options like synchronous writing of the files would help or there is a way to enable logging - I'd be happy to help.

Best regards, Tobias

------ Originalnachricht ------ Von: "Bill Zissimopoulos" notifications@github.com An: "billziss-gh/sshfs-win" sshfs-win@noreply.github.com Cc: "t2consult" info@t2consult.net; "Author" author@noreply.github.com Gesendet: 10.03.2020 14:46:52 Betreff: Re: [billziss-gh/sshfs-win] Empty files are created when being called from scheduled task (#156)

I do not have a full understanding of how the task scheduler runs tasks. However the "Map Network Drive" functionality works correctly only when the user is logged in.

To achieve what you want you may want to permanently mount the file system regardless of whether the user is logged in or not. Since you are already using the task scheduler, you may be able to setup a task to mount the file system during system startup.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/billziss-gh/sshfs-win/issues/156?email_source=notifications&email_token=AAJJSPV6ET6W5O5KL4PHAL3RGZAEZA5CNFSM4LEYG2KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLPBEA#issuecomment-597094544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJSPU2HPBEGGUPMM6RW7TRGZAEZANCNFSM4LEYG2KA.

billziss-gh commented 4 years ago

As mentioned the "map network drive" functionality works only when a user is logged in. If I recall correctly, the file system is forcibly unmounted when the user logs out.

One possibility is that in your scenario your file system is unmounted before sshfs has the chance to flush the data to the remote server. Hence the zero-length file. However please note that this is speculation on my part.