jasminb / megastoragemanager

Android application providing sync and data management tools for mega cloud storage
5 stars 2 forks source link

Fetching remote folders -> MEGA server returned unexpected response #56

Open sandersaares opened 8 years ago

sandersaares commented 8 years ago

As per title, on my first login after installing the app, I get "MEGA server returned unexpected response" error after being displayed "Fetching remote folders". The official MEGA app works fine on the same device.

Samsung Note 2, running CyanogenMod based on Android 5.1.1.

jasminb commented 8 years ago

Hello,

It would be great if you are able to provide logcat dumps so I can investigate.

sandersaares commented 8 years ago

The only message of interest there appears to be this:

[ 08-24 09:04:09.706  6655: 7167 E/LOGIN    ]

Failed to download remote resources

java.io.IOException: Expected JSON document to start with '[' or '{' but was NUMBER

    at ba.makrosoft.mega.a.b.a.k(ProGuard:350)

    at ba.makrosoft.mega.a.b.a.a(ProGuard:322)

    at ba.makrosoft.mega.a.b.a.a(ProGuard:291)

    at ba.makrosoft.mega.a.r.<init>(ProGuard:60)

    at ba.makrosoft.mega.a.a.g.e(ProGuard:506)

    at ba.makrosoft.mega.q.a(ProGuard:292)

    at ba.makrosoft.mega.q.doInBackground(ProGuard:270)

    at android.os.AsyncTask$2.call(AsyncTask.java:292)

    at java.util.concurrent.FutureTask.run(FutureTask.java:237)

    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

    at java.lang.Thread.run(Thread.java:818)
Coolaz commented 7 years ago

Hi, I've registered here to say, I have exactly the same problem. I have Le Eco Le2 smartphone. Login was successful once or twice, out if 40 attempts.

Also, main Mega application sometimes is closed by the system. I just get system message 'Mega is stoped'.

martinzoller commented 7 years ago

I have also encountered this issue, and am hoping for a fix because the two other apps that support syncing MEGA folders (FolderSync, Synchronize Ultimate) also seem to have brocken backends. Happy to help with debugging if I can, but for now I couldn't get anything captured with aLogcat.

jasminb commented 7 years ago

Hey @martinzoller, if you can provide logs during failure i can check it out and devise a fix.

martinzoller commented 7 years ago

I finally captured the log of this error and it looks like it's the same that @sandersaares encountered :

I/MegaClient(21328): Attempting to login, attempt number: 1
D/PEFORMANCE_MONITOR(21328): Executing HTTP call lasted for: 114 ms
D/PEFORMANCE_MONITOR(21328): Executing HTTP call lasted for: 124 ms
V/WindowManager( 2364): not Base app: Adding window Window{193280dd u0 Please wait} at 23 of 33
I/MEGA_CLIENT(21328): Starting remote resource streaming...
D/WifiService( 2364): Client connection lost with reason: 4
W/InputMethodManagerService( 2364): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@25b26452 attribute=null, token = android.os.BinderProxy@3bacb88
I/ActivityManager( 2364): Process org.fdroid.fdroid (pid 22495) has died
D/audio_hw_primary( 1913): out_standby: enter: stream (0xb58a4280) usecase(1: low-latency-playback)
D/hardware_info( 1913): hw_info_append_hw_type : device_name = speaker
D/HeadsetPhoneState( 4765): sendDeviceStateChanged. mService=1 mSignal=5 mRoam=0 mBatteryCharge=5
D/HeadsetStateMachine( 4765): Disconnected process message: 11, size: 0
D/ConnectivityService( 2364): updateNetworkScore for NetworkAgentInfo [WIFI () - 146] to 60
D/ConnectivityService( 2364): rematching NetworkAgentInfo [WIFI () - 146]
D/ConnectivityService( 2364): Network NetworkAgentInfo [WIFI () - 146] was already satisfying request 1. No change.
D/ConnectivityManager.CallbackHandler( 2811): CM callback handler got msg 524290
D/ConnectivityService( 2364): notifyType AVAILABLE for NetworkAgentInfo [WIFI () - 146]
D/ConnectivityManager.CallbackHandler(23537): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 7417): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler(22921): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler(23537): CM callback handler got msg 524290
E/LOGIN   (21328): Failed to download remote resources
E/LOGIN   (21328): java.io.IOException: Expected JSON document to start with '[' or '{' but was NUMBER
E/LOGIN   (21328):  at ba.makrosoft.mega.a.b.a.k(ProGuard:350)
E/LOGIN   (21328):  at ba.makrosoft.mega.a.b.a.a(ProGuard:322)
E/LOGIN   (21328):  at ba.makrosoft.mega.a.b.a.a(ProGuard:291)
E/LOGIN   (21328):  at ba.makrosoft.mega.a.r.<init>(ProGuard:60)
E/LOGIN   (21328):  at ba.makrosoft.mega.a.a.g.e(ProGuard:506)
E/LOGIN   (21328):  at ba.makrosoft.mega.q.a(ProGuard:292)
E/LOGIN   (21328):  at ba.makrosoft.mega.q.doInBackground(ProGuard:270)
E/LOGIN   (21328):  at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/LOGIN   (21328):  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/LOGIN   (21328):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/LOGIN   (21328):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/LOGIN   (21328):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/LOGIN   (21328):  at java.lang.Thread.run(Thread.java:818)
W/InputMethodManagerService( 2364): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@bdb4dd9 attribute=null, token = android.os.BinderProxy@3bacb88
D/HeadsetPhoneState( 4765): sendDeviceStateChanged. mService=1 mSignal=3 mRoam=0 mBatteryCharge=5
D/HeadsetStateMachine( 4765): Disconnected process message: 11, size: 0
jasminb commented 7 years ago

Thanks for the logs, will see what can be done. In your case, service is returning error codes for some reason. Will try to put some retry logic in place if this happens and update here.

jasminb commented 7 years ago

I've pushed new version to alpha, it should provide more detailed reason why requests fail.

To opt in: https://play.google.com/apps/testing/ba.makrosoft.mega

Please try it out and paste the error here.

martinzoller commented 7 years ago

Thanks. I retested and still get an error during "Fetching remote folders", but the displayed message has changed from "MEGA server returned unexpected response" to "A temporary congestion or server malfunction prevented your request from being processed. No data was altered. Retry. Retries must be spaced with exponential backoff." Below is the most concise debug output I got out of three attempts (the output was very similar every time). It doesn't look hugely helpful to me but who knows.

I/MegaClient(14025): Attempting to login, attempt number: 1
D/PEFORMANCE_MONITOR(14025): Executing HTTP call lasted for: 101 ms
D/PEFORMANCE_MONITOR(14025): Executing HTTP call lasted for: 111 ms
V/WindowManager( 2462): not Base app: Adding window Window{7b98af1 u0 Please wait} at 18 of 27
I/MEGA_CLIENT(14025): Starting remote resource streaming...
W/InputMethodManagerService( 2462): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@39bbc6d6 attribute=null, token = android.os.BinderProxy@1df4b24f
D/audio_hw_primary( 2209): out_standby: enter: stream (0xb58a4280) usecase(1: low-latency-playback)
D/hardware_info( 2209): hw_info_append_hw_type : device_name = speaker
D/HeadsetPhoneState( 4472): sendDeviceStateChanged. mService=1 mSignal=3 mRoam=0 mBatteryCharge=3
D/HeadsetStateMachine( 4472): Disconnected process message: 11, size: 0
D/ConnectivityService( 2462): updateNetworkScore for NetworkAgentInfo [WIFI () - 108] to 56
D/ConnectivityService( 2462): rematching NetworkAgentInfo [WIFI () - 108]
D/ConnectivityService( 2462): Network NetworkAgentInfo [WIFI () - 108] was already satisfying request 1. No change.
D/ConnectivityService( 2462): notifyType AVAILABLE for NetworkAgentInfo [WIFI () - 108]
D/ConnectivityManager.CallbackHandler( 3372): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 2808): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler(18780): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 5349): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 5349): CM callback handler got msg 524290
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/HTTP_CLIENT(14025): Fetching resources failed. Error code: -3
E/LOGIN   (14025): Failed to download remote resources
E/LOGIN   (14025): java.lang.RuntimeException: A temporary congestion or server malfunction prevented your request from being processed. No data was altered. Retry. Retries must be spaced with exponential backoff.
E/LOGIN   (14025):  at ba.makrosoft.mega.a.h.a(ProGuard:417)
E/LOGIN   (14025):  at ba.makrosoft.mega.a.h.a(ProGuard:360)
E/LOGIN   (14025):  at ba.makrosoft.mega.a.a.g.e(ProGuard:494)
E/LOGIN   (14025):  at ba.makrosoft.mega.q.a(ProGuard:292)
E/LOGIN   (14025):  at ba.makrosoft.mega.q.doInBackground(ProGuard:270)
E/LOGIN   (14025):  at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/LOGIN   (14025):  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/LOGIN   (14025):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/LOGIN   (14025):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/LOGIN   (14025):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/LOGIN   (14025):  at java.lang.Thread.run(Thread.java:818)
W/InputMethodManagerService( 2462): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@354ae52d attribute=null, token = android.os.BinderProxy@1df4b24f
D/ConnectivityManager.CallbackHandler( 3372): CM callback handler got msg 524290
D/ConnectivityService( 2462): updateNetworkScore for NetworkAgentInfo [WIFI () - 108] to 60
D/ConnectivityService( 2462): rematching NetworkAgentInfo [WIFI () - 108]
D/ConnectivityService( 2462): Network NetworkAgentInfo [WIFI () - 108] was already satisfying request 1. No change.
D/ConnectivityService( 2462): notifyType AVAILABLE for NetworkAgentInfo [WIFI () - 108]
D/ConnectivityManager.CallbackHandler( 2808): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler(18780): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 5349): CM callback handler got msg 524290
D/ConnectivityManager.CallbackHandler( 5349): CM callback handler got msg 524290
jasminb commented 7 years ago

Hey @martinzoller, from what I can see is that after 20 retries, service failed to serve request each time with the same error. I've pushed new version with backoff in between requests, please try it out and let me know.