rodneyviana / ODSyncService

OneDrive service/DLL for Sync State
MIT License
93 stars 26 forks source link

Onedrivesync not showing status correctly #14

Closed ukreddy-erwin closed 3 years ago

ukreddy-erwin commented 4 years ago

I am using the Onedrive sync dll provided using PowerShell for checking whether files are synced or not before doing further steps. But, many times, it is showing status as "Syncing" even it is "UpToDate".

Any suggestions please?

ukreddy-erwin commented 4 years ago

Issue is same even with the latest dll: https://github.com/rodneyviana/ODSyncService/blob/master/Binaries/PowerShell/OneDriveLib.dll

fuzzysb commented 4 years ago

I have seen that this is a OneDrive client bug, it only happens when Files On Demand is enabled, but all folders under the OneDrive root folder are available Online/Offline and the root folders status still reports syncing in the availability column in File Explorer, this is where this l detects the status. for my Migration i have disabled Files on Demand via policy whilst the migration activities are proceeding, tha way the detection is 100% accurate.

ukreddy-erwin commented 4 years ago

I didn't have any files on-demand. But still getting this.

rodneyviana commented 4 years ago

I am using the Onedrive sync dll provided using PowerShell for checking whether files are synced or not before doing further steps. But, many times, it is showing status as "Syncing" even it is "UpToDate".

Any suggestions please?

Hi ukreddy,

It takes its information from the OneDrive engine. If it is informing incorrectly the tool will inform incorrectly. As fuzzyb commented, when file is on-demand the precision suffers.

ukreddy-erwin commented 4 years ago

But the UI in the taskbar is showing correctly as up to date.

rodneyviana commented 4 years ago

I added a new version with more detailed logging, Please run: Get-ODStatus -IncludeLog $true

Post the file located at %TEMP% (you can type this when using Windows Key + R or in Explorer folder). The file name will have the format OneDriveLib-YYYY-MM-DD.log. You may change any PII information like the user name in the path. For Example:

2020-08-25T16:36:09 Information Testing Type: Native.IIconError [bbacc218-34ea-4666-9d7a-c78f2274a524], Path: C:\Users\johndoe\OneDrive: False

Should be changed to:

2020-08-25T16:36:09 Information Testing Type: Native.IIconError [bbacc218-34ea-4666-9d7a-c78f2274a524], Path: C:\Users\PIIINFO\OneDrive: False

The GUID information is not PII, so no need to change it.

eduardomb08 commented 4 years ago

Hi @rodneyviana , is there any way around the OnDemand issue? (Besides unchecking it or messing with the registry to change it and closing and reopening the OneDrive app).

I tried looking into the Cloud Files API (cfapi) but had no luck so far.

rodneyviana commented 4 years ago

Hi @rodneyviana , is there any way around the OnDemand issue? (Besides unchecking it or messing with the registry to change it and closing and reopening the OneDrive app).

I tried looking into the Cloud Files API (cfapi) but had no luck so far.

When it is OnDemand and it shows OnDemandOrUnknown is because it is sync'ing. I am trying something new but so far no luck.

eduardomb08 commented 4 years ago

Hey @rodneyviana, thanks for your response. However, for me here the OneDrive tray icon shows "Up to date" but I still get OnDemandOrUnknown as the result from the module. It seems the OnDemand check changes the output of the IsMemberOf call.

I also tried a few things the last couple of days but no luck either.

rodneyviana commented 3 years ago

Hey @rodneyviana, thanks for your response. However, for me here the OneDrive tray icon shows "Up to date" but I still get OnDemandOrUnknown as the result from the module. It seems the OnDemand check changes the output of the IsMemberOf call.

I also tried a few things the last couple of days but no luck either.

I am onto something to monitor On Demand. I got something working but I may need beta testers.

eduardomb08 commented 3 years ago

Hey @rodneyviana, thanks for your response. However, for me here the OneDrive tray icon shows "Up to date" but I still get OnDemandOrUnknown as the result from the module. It seems the OnDemand check changes the output of the IsMemberOf call. I also tried a few things the last couple of days but no luck either.

I am onto something to monitor On Demand. I got something working but I may need beta testers.

I believe we can help. Did you push it to a specific branch?

rodneyviana commented 3 years ago

See: https://github.com/rodneyviana/ODSyncService/tree/master/Binaries/Beta Let me know if you encounter problems but please also send me feedback of what is working well

eduardomb08 commented 3 years ago

See: https://github.com/rodneyviana/ODSyncService/tree/master/Binaries/Beta Let me know if you encounter problems but please also send me feedback of what is working well

Could you explain a little bit how the new exe would work with the powershell module?

btw, there is a type on the md description for beta: I believe OnOnDemand.exe should be ODOnDemand.exe

rodneyviana commented 3 years ago

Could you explain a little bit how the new exe would work with the powershell module?

btw, there is a type on the md description for beta: I believe OnOnDemand.exe should be ODOnDemand.exe

The .exe is not related at all with the PowerShell script. You will need to prepare a new script to read the log file to find the latest updates. I will fix the typo.

eduardomb08 commented 3 years ago

Could you explain a little bit how the new exe would work with the powershell module? btw, there is a type on the md description for beta: I believe OnOnDemand.exe should be ODOnDemand.exe

The .exe is not related at all with the PowerShell script. You will need to prepare a new script to read the log file to find the latest updates. I will fix the typo.

Ok. I'll start playing with it.

eduardomb08 commented 3 years ago

OneDrive won't start after registering. Clearing the registration solves the problem.

rodneyviana commented 3 years ago

OneDrive won't start after registering. Clearing the registration solves the problem.

Could you provide:

  1. The contents of HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\OneDrive.exe\Debugger
  2. What happens if you use the -attach method
eduardomb08 commented 3 years ago

With -attach:

Ansi Time: 2020-09-11 16:16:56.830
[CREATE] EventCallBack is NULL
Session Status: 0x0
Loaded: ntdll
Loaded: KERNEL32
Loaded: KERNELBASE
Loaded: USER32
Loaded: win32u
Loaded: GDI32
Loaded: gdi32full
Loaded: msvcp_win
Loaded: ucrtbase
Loaded: ADVAPI32
Loaded: msvcrt
Loaded: sechost
Loaded: RPCRT4
Loaded: SspiCli
Loaded: CRYPTBASE
Loaded: bcryptPrimitives
Loaded: SHELL32
WaitForEvent - HR: 0
GetStatus - HR: 0
DEBUG_STATUS_BREAK
Add BP:  [SHELL32!Shell_NotifyIconW]
BP 1
SetExecutionStatus to GO - HR: 0
PID=18508,hr=0
Loaded: cfgmgr32
Loaded: shcore
Loaded: combase
Loaded: windows.storage
Loaded: shlwapi
Loaded: kernel.appcore
Loaded: powrprof
Loaded: profapi
Loaded: ole32
Loaded: OLEAUT32
Loaded: VERSION
Loaded: WTSAPI32
Loaded: USERENV
Loaded: WININET
Loaded: IMM32
Loaded: privman32
Loaded: uxtheme
Loaded: ucrtbase
Loaded: LoggingPlatform
Loaded: WS2_32
Loaded: MSVCP140
Loaded: VCRUNTIME140
Loaded: CRYPTSP
Loaded: rsaenh
Loaded: bcrypt
Loaded: OneDriveTelemetryStable
Loaded: IPHLPAPI
Loaded: NSI
Loaded: dhcpcsvc
Loaded: FileSyncClient
Loaded: CRYPT32
Loaded: MSASN1
Loaded: ETWLog
Loaded: WINTRUST
Loaded: UpdateRingSettings
Loaded: RemoteAccess
Loaded: Telemetry
Loaded: LogUploader
Loaded: FileSyncViews
Loaded: FileSyncSessions
Loaded: Secur32
Loaded: urlmon
Loaded: imagehlp
Loaded: gdiplus
Loaded: COMCTL32
Loaded: dwmapi
Loaded: XmlLite
Loaded: WINHTTP
Loaded: PROPSYS
Loaded: wer
Loaded: SyncEngine
Loaded: Qt5Core
Loaded: Qt5Qml
Loaded: Qt5Gui
Loaded: Qt5Quick
Loaded: Qt5WinExtras
Loaded: iertutil
Loaded: Qt5Widgets
Loaded: credui
Loaded: WSOCK32
Loaded: WnsClientApi
Loaded: ncrypt
Loaded: faultrep
Loaded: adal
Loaded: MPR
Loaded: NETAPI32
Loaded: WINMM
Loaded: Qt5Network
Loaded: NTASN1
Loaded: dbghelp
Loaded: WINMMBASE
Loaded: DNSAPI
Loaded: LIBEAY32
Loaded: SSLEAY32
Loaded: MSWSOCK
Loaded: SRVCLI
Loaded: dbgcore
Loaded: NETUTILS
Loaded: Wscapi
Loaded: cldapi
Loaded: FLTLIB
Loaded: AEPIC
Loaded: ntmarta
Loaded: FileSyncFALWB
Loaded: atlthunk
Loaded: MSCTF
Loaded: FileSync.Resources
Loaded: clbcatq
Loaded: mlang
Loaded: FileSync.LocalizedResources
Loaded: OneCoreUAPCommonProxyStub
Loaded: qwindows
Loaded: AppXDeploymentClient
Loaded: StateRepository.Core
Loaded: WinTypes
Loaded: rometadata
Loaded: msxml6
Loaded: Windows.Networking.Connectivity
Loaded: edputil
Loaded: dhcpcsvc6
Loaded: apphelp
Loaded: webio
Loaded: WINNSI
Loaded: rasadhlp
Loaded: sxs
Loaded: fwpuclnt
Loaded: schannel
Loaded: mskeyprotect
Loaded: ncryptsslp
Loaded: DPAPI
Loaded: ondemandconnroutehelper
Loaded: msiso
Loaded: cryptnet
Loaded: twinapi.appcore
Loaded: RMCLIENT
Loaded: DSREG
Loaded: msvcp110_win
Loaded: netprofm
Loaded: npmproxy
Loaded: wlanapi
Loaded: wcmapi
Loaded: dusmapi
Loaded: efswrt
Loaded: StructuredQuery
Loaded: ntshrui
Loaded: cscapi
Loaded: FeClient
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Exception: 0x406d1388
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Exception: 0x406d1388
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501

and it seems it hangs after that...

I don't see any ...\OneDrive.exe\Debugger right now. Maybe I need to register it again..

rodneyviana commented 3 years ago

It may not be hanging. It should not show any new line unless some debug event happens. How is the log file going? Is it recording? And please register again to see the content of ...\OneDrive.exe\Debugger. Also where is your application located (ODOnDemand.exe)? I mean the full path. Avoid any user related folder and use a simple folder like c:\tools

eduardomb08 commented 3 years ago

There are really no new lines. I'll register again and post the content of ..\OneDrive.exe\Debugger here. ODOnDemand.exe on C:\ODTool

More from attach:

Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Loaded: Windows.Security.Authentication.Web.Core
Loaded: OneCoreCommonProxyStub
Loaded: vaultcli
Loaded: Windows.Web
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Exception: 0x406d1388
Exception: 0x406d1388
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501
Exception: 0x406d1388
Expression: SHELL32!Shell_NotifyIconW
Offset = 8
Evaluation = poi(0x00EFECF4) & 0xffff
Event: 501

Log file:

2020-09-11 14:07:44.213 Information General Initiating App  0
2020-09-11 14:07:44.225 Information General Setting auto launch key. Use 'ODOnDemand.exe -clear' to remove the monitoring   0
2020-09-11 15:23:56.334 Information General Initiating App  0
2020-09-11 15:23:56.341 Information General Deleting auto launch key. Use 'ODOnDemand.exe -lauch' to restart monitoring 0
2020-09-11 16:16:56.831 Information General Initiating App  0
2020-09-11 16:19:24.460 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    18508
2020-09-11 16:19:26.723 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    18508
2020-09-11 16:19:27.768 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Processing changes' 18508
2020-09-11 16:19:28.757 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Processing changes' 18508
rodneyviana commented 3 years ago

So it is doing what it should be doing. The sync is taking place now. The last IconChange should contain the most recent status. This PowerShell script should help you:

$content = Get-Content -Path "$($env:LOCALAPPDATA)\OneDriveMonitor\Logs\OneDriveMonitor_$((Get-Date).ToString('yyyy-MM-dd')).log";
$lastStatus = '';
for($count=$content.Count-1;$count -gt 0; $count--)
{
    if($content[$count].Contains('IconChange'))
    {
        $lastStatus = $content[$count].Split("`t")[3];
        $lastStatus = $lastStatus.Split("'")[1];
        break;
    }

}

Write-Host $lastStatus
eduardomb08 commented 3 years ago

So, I let it run and everything looked fine... I even saw some "Up to date" log messages.. I wasn't working on any of the files saved to OneDrive.. I was just letting it run... it ran all through the weekend... today, when I logged on the powershell window was looping indefinitely displaying this:

image

the notepadd window in the back is the log file. The last logged message is from 2020-09-11 23:56:02.309

eduardomb08 commented 3 years ago

It seems OneDrive crashed (or was brought down) for some reason... also, there was another log file for the 12th.. I started it again with the -onLaunch option and it's running now

eduardomb08 commented 3 years ago

Here are the last few lines from the log after restarting the program with the -onLaunch option:

2020-09-14 11:03:27.099 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:28.130 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:29.168 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:30.192 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:31.230 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:32.260 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:33.293 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:34.323 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:35.350 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:36.382 Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:04:05.033 Information General Initiating App  0
2020-09-14 11:04:05.040 Information General Setting auto launch key. Use 'ODOnDemand.exe -clear' to remove the monitoring   0
2020-09-14 11:04:20.557 Information General Initiating App  0

What is the final state now? The last IconChange has msg "Looking for changes"... OD icon on the tray shows it as Up to date. There are no other logged messages after 11:04. It's 11:32 now.

rodneyviana commented 3 years ago

Here are the last few lines from the log after restarting the program with the -onLaunch option:

2020-09-14 11:03:27.099   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:28.130   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:29.168   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:30.192   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:31.230   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:32.260   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:33.293   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:34.323   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:35.350   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:03:36.382   Information IconChange  uID=501,Action=1,tootip='OneDrive - AmWINS Group, Inc (USA).Looking for changes'    14748
2020-09-14 11:04:05.033   Information General Initiating App  0
2020-09-14 11:04:05.040   Information General Setting auto launch key. Use 'ODOnDemand.exe -clear' to remove the monitoring   0
2020-09-14 11:04:20.557   Information General Initiating App  0

What is the final state now? The last IconChange has msg "Looking for changes"... OD icon on the tray shows it as Up to date. There are no other logged messages after 11:04. It's 11:32 now.

I am releasing a new version soon based on your feedback. Thanks for testing.

rodneyviana commented 3 years ago

Eduardo,

The new version is Release Candidate. Improvements:

The commands are still the same Please test and let me know how it is doing.

Thanks,

Rodney

rodneyviana commented 3 years ago

Eduardo,

I need your feedback on the new version in order to finish the application. Would you be able to help?

eduardomb08 commented 3 years ago

Sure. I was planning on trying it out this afternoon.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Rodney Viana notifications@github.com Sent: Tuesday, September 15, 2020 11:44:45 AM To: rodneyviana/ODSyncService ODSyncService@noreply.github.com Cc: Eduardo Monteiro de Barros eduardocmb@hotmail.com; Comment comment@noreply.github.com Subject: Re: [rodneyviana/ODSyncService] Onedrivesync not showing status correctly (#14)

Eduardo,

I need your feedback on the new version in order to finish the application. Would you be able to help?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frodneyviana%2FODSyncService%2Fissues%2F14%23issuecomment-692803033&data=02%7C01%7C%7C2787b3e496ab4e72c15d08d8598e4601%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637357814871894360&sdata=3tEZw5xN5xh5hnZkzQzuFNXauPsZN0woNZ8p7OQ55OI%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACZTD54GE6AK7A6FZAO4TGDSF6DW3ANCNFSM4O3NCUHA&data=02%7C01%7C%7C2787b3e496ab4e72c15d08d8598e4601%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637357814871894360&sdata=eoDblsw%2BXyjvYIuosphfc2xvsiwSh9%2F%2FikuuIPhSVmI%3D&reserved=0.

rodneyviana commented 3 years ago

I added an installer. Please test it on a machine without previous installation. https://github.com/rodneyviana/ODSyncService/raw/master/Binaries/Beta/Setup.zip

eduardomb08 commented 3 years ago

Hey @rodneyviana ... the new version has some great improvements. Thank you for that!! The cleaner log makes it really easier to visually detect the current status... I'll do more tests... I may be able to test the installer tomorrow.

Thanks again.

rodneyviana commented 3 years ago

Can I close this thread?

uday1kiran commented 3 years ago

Still the issue exists with the latest dll you provided

rodneyviana commented 3 years ago

Still the issue exists with the latest dll you provided

The solution is not in DLL is a different approach altogether: https://github.com/rodneyviana/ODSyncService/tree/master/Binaries/Beta

eduardomb08 commented 3 years ago

I agree on closing this given the new EXE solution.