{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/2694","repository_url":"https://api.github.com/repos/realm/realm-java","labels_url":"https://api.github.com/repos/realm/realm-java/issues/2694/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/2694/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/2694/events","html_url":"https://github.com/realm/realm-java/issues/2694","id":151568195,"number":2694,"title":"Database values not consistent between UI thread and AsyncTask","user":{"login":"tanayagrawal","id":8982815,"avatar_url":"https://avatars.githubusercontent.com/u/8982815?v=3","gravatar_id":"","url":"https://api.github.com/users/tanayagrawal","html_url":"https://github.com/tanayagrawal","followers_url":"https://api.github.com/users/tanayagrawal/followers","following_url":"https://api.github.com/users/tanayagrawal/following{/other_user}","gists_url":"https://api.github.com/users/tanayagrawal/gists{/gist_id}","starred_url":"https://api.github.com/users/tanayagrawal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanayagrawal/subscriptions","organizations_url":"https://api.github.com/users/tanayagrawal/orgs","repos_url":"https://api.github.com/users/tanayagrawal/repos","events_url":"https://api.github.com/users/tanayagrawal/events{/privacy}","received_events_url":"https://api.github.com/users/tanayagrawal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/S:Waiting%20For%20User","name":"S:Waiting For User","color":"ededed"},{"url":"https://api.github.com/repos/realm/realm-java/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-28T07:28:53Z","updated_at":"2016-05-04T09:36:51Z","closed_at":"2016-05-04T09:36:51Z","body":"\r\n###Goal\r\nI am trying to fetch a value from Realm in an Async Task which was committed from the UI thread right before starting the AsyncTask\r\n\r\n### Expected Results\r\nThe value fetched from Realm in the AsyncTask should be same as the value which was committed in the UI thread. \r\n\r\n#### Actual Results\r\nThe value fetched from Realm in the AsyncTask is NOT same as the value which was committed in the UI thread.\r\n\r\n#### Steps & Code to Reproduce\r\n- Commit a object in the Realm from the UI thread.\r\n- Make sure this object has some kind of unique ID associated with it.\r\n- I try to fetch that same object from the realm using same unique ID from the AsyncTask since the objects cannot be passed across threads.\r\n- After fetching this value, I have a loop running in my AsyncTask which uses this value. \r\n- For the first few iterations of the loop, the value of the object fetched from Realm is not updated(value which was committed from the UI thread) and is only updated after some of the iterations of the loop are over.\r\n- This leads to inconsistency between the computations that take place in the loop depending on that RealmObject\r\n\r\nRealm version(s): 0.89.1\r\n\r\nAndroid Studio version: 2.0.0\r\n\r\nAndroid Version : 5.0 \r\nDevice : OnePlus One"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/216811679","html_url":"https://github.com/realm/realm-java/issues/2694#issuecomment-216811679","issue_url":"https://api.github.com/repos/realm/realm-java/issues/2694","id":216811679,"user":{"login":"cmelchior","id":406066,"avatar_url":"https://avatars.githubusercontent.com/u/406066?v=3","gravatar_id":"","url":"https://api.github.com/users/cmelchior","html_url":"https://github.com/cmelchior","followers_url":"https://api.github.com/users/cmelchior/followers","following_url":"https://api.github.com/users/cmelchior/following{/other_user}","gists_url":"https://api.github.com/users/cmelchior/gists{/gist_id}","starred_url":"https://api.github.com/users/cmelchior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmelchior/subscriptions","organizations_url":"https://api.github.com/users/cmelchior/orgs","repos_url":"https://api.github.com/users/cmelchior/repos","events_url":"https://api.github.com/users/cmelchior/events{/privacy}","received_events_url":"https://api.github.com/users/cmelchior/received_events","type":"User","site_admin":false},"created_at":"2016-05-04T09:36:51Z","updated_at":"2016-05-04T09:36:51Z","body":"Closing due to no response"}}