hi sean,
thanks for sending me your log. using it i was able to reproduce the error you reported. here are the exact steps to reproduce:
- Client watches for rooms.
- Client is informed of the existence of a given room (let's call it "Room N")
- Client observes "Room N".
- Client stops watching for rooms.
- "Room N" is removed from the server.
- Client receives a u62 (STOPPED_OBSERVING_ROOM) UPC.
- RoomManager removes "Room N" from its observed room list. No other references to the room remain, so RoomManager invokes the internal shutdown() method on "Room N".
- In response to the u62 UPC, the internal doStopObserving() method is invoked on "Room N".
- The doStopObserving() method notices that the current client is neither in nor observing the room, so it invokes the purgeRoomData() method.
- The purgeRoomData() method tries to add a log message (line 2099), but "Room N" has already been shutdown/disposed (Step 7), so its log reference is null.
- TypeError: Cannot access a property or method of a null object reference. The null object is the missing log.
in most applications, this error does not occur during room observation/stop observation because the current client typically has a remaining cached reference to the room being observed, so shutdown() is not called in Step 7. in your case, however, the client gains knowledge of the room via watchForRooms(), which does not cache rooms. in the current design, rooms are added to the room cache only when they are presently unknown to the current client but expected to become known in the future (e.g., during a "createRoom()" call).
there are two ways to address this bug in Reactor:
- Cache rooms that become known in response to a watchForRooms() call.
- Make rooms that have already been shutdown ignore subsequent shutdown requests.
i favour a smaller cache/memory footprint over occasional redundant shutdown() calls, so i chose option 2 (as described at
http://factory.user1.net/issues/show/568).
in your use case, the caching system is an internal detail that you doesn't affect your code, but after all your help in the bug hunt, i thought you might be interested in the internals.
in my tests, the error is gone as of staging build Reactor_1.1.1.1176_dev (
http://www.unionplatform.com/staging/re ... or/latest/). if you have time, please let me know whether the errors are also gone in your application.
colin