realm-js: Infinite loop of "callbacks_poll"
So, it’s YOU! 😃
I’ve been seeing this endless loop of “callbacks_poll” that is killing my debugging performance and pleasure.

Goals
Get rid of the endless loop of callbacks_poll in my networking request pane and the associated memory leak
Expected Results
No callbacks_poll visible and no memory leak
Actual Results
See image. Endless loop. Makes it hard to identify individual network requests and there seems to be an associated memory leak, although I can’t guarantee that it is related.
Steps to Reproduce
Not sure. This happened after I upgraded Realm but I didn’t realize it at the time. Here’s my Realm setup
Code Sample
class User {}
User.schema = {
name: 'User',
primaryKey: 'id',
properties: {
id: { type: 'int' },
nickName: { type: 'string' },
displayName: { type: 'string' },
title: { type: 'string', optional: true },
email: { type: 'string' },
photo: { type: 'string', optional: true },
photoDir: { type: 'string' },
gender: { type: 'string' },
refId: { type: 'string', optional: true },
sessionToken: { type: 'string', optional: true }
}
};
export default User;
import Realm from 'realm';
import { logoutUser } from 'modules/login/actions/loginActions';
import { delToken, clearTokens } from 'modules/login/actions/oauthActions';
import * as config from 'config';
import { dbg } from 'utils';
import UserRecord from 'data/records/userRecord';
import {
EMIT_USER,
GET_USER,
STORE_USER,
DEL_USER,
CLEAR_ALL
} from '../userActionTypes';
import User from '../schemas/userDbSchema';
const realmSettings = {
schema: [User],
schemaVersion: 1,
migration: (oldRealm, newRealm) => {
// only apply this change if upgrading to schemaVersion 1
/* if (oldRealm.schemaVersion < 1) {
const oldObjects = oldRealm.objects('User');
const newObjects = newRealm.objects('User');
// loop through all objects and set the name property in the new schema
for (let i = 0; i < oldObjects.length; i++) {
newObjects[i].sessionToken = undefined;
}
} */
}
};
const realm = new Realm(realmSettings);
export function getUser() {
return {
type: GET_USER
};
}
export function emitUser(user) {
return {
type: EMIT_USER,
user
};
}
export function loadUser(userId) {
return async (dispatch, getState) => {
dispatch(getUser());
const sessionUser = getState().users.sessionUser;
if (sessionUser && sessionUser.id === userId) return sessionUser;
let user = null;
if (userId) user = realm.objectForPrimaryKey('User', userId);
else {
const users = realm.objects('User');
if (users.length > 0) user = users.values().next().value;
}
dbg(user ? `User ${user.id} loaded` : 'No user loaded');
if (user) {
dispatch(emitUser(new UserRecord(user)));
return user;
}
return null;
};
}## Version of Realm and Tooling
- Realm JS SDK Version: 2.0.11
- Node or React Native: React Native 0.49.5
- Client OS & Version: Mac Os
- Which debugger for React Native: React-Native-Debugger or Chrome
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 38
- Comments: 67 (16 by maintainers)
@blagoev I think it’s a high priority issue because the chrome debugger turn very slow and we almost cannot do any thing. Thanks.
This issue is causing my app to be almost impossible to work on; the app/debugger is painfully slow and crashes often. Please, please prioritise fixing this!
i changed this in ‘lib/browser/rcp.js’ at line 292 (v2.0.12)
pollTimeoutId = setTimeout(() => sendRequest('callbacks_poll'), 60000);@blagoev what is arbitrary callback and when it is needed ?
still no solution for this?!
@kneth Well, to be honest, I would recommend changing the docs to ‘forget about it’ rather than ‘it’s slow’ as there are a number of bugs (ranging from 3+ year old bugs #491 as mentioned by @blagoev as ‘higher priority’ in this very thread to ones that have a resolution but closed with no fix on your part; #1034 ) that make any sort of debugging in an app that includes realm extremely painful.
Also, what does ‘higher priority’ mean in this context - can we expect a fix for #491 within the next 3 years and perhaps this bug might be fixed within the next 6 years?
I would think that at least on the realm.io website there would be a big warning right at the top of the introduction that debugging becomes problematic when using this product.
I invested so much into using realm without the knowledge that I wouldn’t be able to use JavaScript debugging anymore. On the bright side the fact that realm.io kills the development experience has made me into a much, much better programmer!
I use reactotron for logging and have to write really good code!
That being said it’s a shame that this issue doesn’t have a big warning banner displayed on the Realm.io website.
Life becomes much easier when you change realm to any other persistant library. I can say realm is pretty good for native Apps but worse for hybrid apps 😦
facing same app crash issue on iOS. Its sad realm team isn’t taking it seriorusly 😦
Unresponsiveness of the ream team makes this great idea and product a total crap 😦
Still no solution of this problem!
@FirdousNath We are taking it seriously but we are waiting for React Native to make the debugging experience easier (for us with C++ code).
@cyphire I see your point. Not that we try to hide it (https://realm.io/docs/javascript/latest/#chrome-debugging-is-slow).
@kneth in the iOS version the app continues to crash after few seconds, also doing nothing, I suppose because of this bug 😦 Do you know if it will be fixed soon? I’m a little bit in hurry for a deploy in production and now I can’t really work well 😦
Sorry to bother you! Thanks!
got any??
This is happening for me on
react-native“56” andrealm: “^2.15.3” as well as in “57.1.0” andrealm: “^2.17.0”This is causing the app to crash consistently when in debug mode. This makes development very slow and unbearable.
@kneth any update on the state of this ticket? is it on the roadmap? is it in progress? any ETAs? Thanks.
Edit: we opted to change the timeout as mentioned here to make development more bearable in debug mode.
@kneth is there any other workaround that we can do to fix this issue (in the meantime)?.
Our app has come to the point of been unusable when debugger is attached. As you can imagine that’s not a great place to be in. I appreciate you guys having higher priority issues than this, but this is a deal breaker for us. We are seriously considering taking out realm from our react-native app.
Any possible fix/workaround is highly appreciated
p.s: downgrading to 2.0.6 didn’t work
@blagoev Yeah, websockets would seem to be the way to go. For me, staying on 2.0.6 is an acceptable workaround for now. Thanks for being open about this.