Room destruction and teardown

Options
caozane
caozane
edited September 2013 in Photon Server
The game I'm working on requires that rooms serialize some data to a DB when all peers have left. Currently I am overwriting Room.OnDispose, which then handles the serialization. It seems to work except when I am shutting down a server instance. In some cases, which seems pretty much random to me, the TearDown function is not called at all. My theory is that the serialization stuff might be so slow that the tear down call is somehow skipped.

My question is this: Why is TearDown not called? I would think that this function would be absolutely guaranteed.

Comments

  • qaz
    Options
    If you kill a process It may not be called, power failure, etc...
    I suggest to do that serializing data with db on application start.
  • caozane
    Options
    We do serialization continuously, each 5 minutes or so, which takes care of power failures. But in our case the users are actually generating data, so serializing must be when a room is removed. We also need the server instances, when under normal circumstances, to be terminated in proper way. So I am still very much interested in getting answers regarding my initial post :)
  • It's not guaranteed that TearDown is called.
    To prevent a "hanging" process on shutdown, Photon only waits for a certain amount of time for a clean shutdown (which includes the call to ApplicationBase.TearDown()). If Photon did not shut down in that time frame, it unloads the CLR and TearDown is not called.

    However, that should not happen normally. If the problem is reproduceable - can you please provide the Photon-Default-... (or Photon-Loadbalancing-...), Photon-CLR.log, and ALL application log files from a shutdown where the TearDown is not called as expected? (like described here: viewtopic.php?f=5&t=1913)

    Can you also send me the code of your TearDown() method please?