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

PermissionManager.getPermissions() error after connection reset #6492

Closed
pavelpoley opened this issue Apr 14, 2019 · 11 comments · Fixed by #6506

Comments

@pavelpoley
Copy link

commented Apr 14, 2019

I am continue with this issue since i don't have solution
[(https://github.com//issues/6458)]

After connection reset or dropped connection PermissionManager.getPermissions() return this error:

E/REALM_SYNC: Connection[4]: Reading failed: Connection reset by peer E/REALM_JAVA: Error in __permission: CONNECTION_RESET_BY_PEER(realm.basic_system:104): Connection reset by peer E/REALM_SYNC: Connection[1]: Reading failed: Connection reset by peer E/REALM_JAVA: Error in __wildcardpermissions: CONNECTION_RESET_BY_PEER(realm.basic_system:104): Connection reset by peer E/REALM_SYNC: Connection[2]: Reading failed: Connection reset by peer

Even if it network error like @cmelchior said, i think something wrong here.
If you just disable INTERNET manually for a second getPermissions() not working anymore even with new PermissionManager instance.

as i know __permission is a simple full-sync realm, and it should to work like other user's Realms, and user's Realms work fine after connection reset.

Goals
Call PermissionManager.getPermissions() to get the list of permissions for all Realms available to this user

Expected results
PermissionManager.getPermissions() should return RealmResults<Permission>

Actual results
PermissionManager.getPermissions() triggers onError() with null object but with some addiotinal logs from E/REALM_SYNC

Steps to reproduce
Call PermissionManager.getPermissions() then manually disable and enable network then call PermissionManager.getPermissions() again, only after activity restart(setting configuration and connecting to realm) the PermissionManager.getPermissions() work again.
I want to mention that some connection reset happen by itself after about 5 minutes when PermissionManager.getPermissions() is called, this is happen also in the full sync TODO app example
todo app

Also does Permission/PermissionManager not support offline mode?

Realm 5.10.0
Realm platform cloud - standard plan
Android studio 3.4
Checked API 25/26

@realm-probot realm-probot bot added the O-Community label Apr 14, 2019

@wildfisher

This comment has been minimized.

Copy link

commented Apr 23, 2019

This is a critical problem. Can anybody reply to this?

@bmunkholm bmunkholm added the T-Help label Apr 29, 2019

@cmelchior

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

@pavelpoley @wildfisher Sorry for the late reply. I have been trying various ways to reproduce the reported behavior using https://github.com/realm/my-first-realm-app/tree/master/android/todo-full-sync, but so far I cannot reproduce connections being cut, even if the app is left alone for 10 minutes.

I have tried reproducing the behavior on both emulator and a OnePlus device.

Which kind of network conditions are you under, are you using Wifi or normal cellular data?

@pavelpoley

This comment has been minimized.

Copy link
Author

commented May 2, 2019

@cmelchior , what Realm version you are using? i have updated today to Realm version 5.11.0 and it feel better, i did't saw automatic connection reset like in version 5.10.0 (but it early to say, need to check more), then i roll back to version 5.10.0 to confirm and this connection reset really happens.

But the question is open because the issue is not only this automatic connection reset, the problem is that PermissionManager.getPermissions() returns error after connection reset , for example if you disable and enable INTERNET PermissionManager.getPermissions() will always return error even with new PermissionManager instance, i don't think this is correct behavior and also why Realm supports offline work but PermissionManager not working offline, it should work, no?

I have attach gist to reproduce this error manually:
link

Just replace ProjectsActivity in full sync todo app with the code above.
In the top of the page i attached some notes to reproduce.

@cmelchior

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

Thank you very much for the code. I can reproduce it now. I'll look into it.

@cmelchior

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

Okay, I can see the problem. Once we reported an error, we don't clear the saved error, causing all future calls to fail as well by reporting the same error.

The problem will go away if you close the PermissionManager and re-open it when this happens, but we should really try to clear the error in case it is intermittent.

@pavelpoley

This comment has been minimized.

Copy link
Author

commented May 3, 2019

If the error is still happens after close and re-open this may mean that some other PermissionManager not closed yet and its return existing instance?

And what about the offline work, PermissionManager not supported to work without Internet?

@cmelchior

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

@pavelpoley Yes, you would need to fully close all PermissionManager instances for it to work.

The underlying Realms do work offline, but because the PermissionManager fails to clear the error, it will appear as it does not. I'm working on a fix now.

@pavelpoley

This comment has been minimized.

Copy link
Author

commented May 3, 2019

@cmelchior Okay, thanks.

@cmelchior

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

I merged a fix to master. This should be available as 5.12.0-SNAPSHOT in an hour.

@pavelpoley

This comment has been minimized.

Copy link
Author

commented Jun 10, 2019

When 5.12.0 will be released?

@wildfisher

This comment has been minimized.

Copy link

commented Jun 11, 2019

We are using Realm Platform Shared plan and still experience this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.