[DGD]Problem with state-dump
E. Harte
harte at xs4all.nl
Tue May 4 13:05:36 CEST 1999
On Tue, 4 May 1999 balduin at uni-paderborn.de wrote:
> Hello !
>
[...]
> - When I first did a dump_state() followed by a shutdown(),
> I noticed after restart, that the connection objects
> (cloned by connection() in e.g. the telnet port object to
> represent the connection) (oops many "connection"s in this sentence)
> where still existent. I now close down all connections
> when preparing dump_state() to avoid dumping them. But this
> leaves me with the following error during shutdown()
>
> * sniplet from the logfile
> [
> shutting down ...
> -----------------------------------------------------------------------
> Tue May 4 12:14:06 1999, runtime error, ticks left: 3989945
> Bad argument 1 for kfun call_other
> 103 receive_message /kernel/net/user (#22)
> 198 handle_command /system/user (#15)
> 150 command_loop /system/user (#15)
> 66 input_to /kernel/lib/auto (/system/user#15)
> ]
>
> where this is the stuff in driver.c
>
> do_shutdown()
> {
> object *_u;
> int i,sz;
>
> send_message("cutting connections ...\n");
> _u = users();
>
> for (i=0,sz=sizeof(_u);i<sz;i++)
> {
> send_message("removing "+object_name(_u[i]));
> _u[i]->remove_object();
> }
> send_message("preparing dump ...\n");
> prepare_dump();
> send_message("dumping ...\n");
> dump_state();
> send_message("shutting down ...\n");
> shutdown();
> }
Does the 'shutdown' happen from a user command or is it done from a
separate thread, meaning from a 'call_out()'? If the first option is
true, then it would be a good guess that our /system/user.c code does not
anticipate going linkdead halfway during a command-thread, if the second
option is true then I don't know why this is happening either. :-)
[...]
> - This leads to the next problem. I'd like to do a state-dump once in
> a while, just to reduce my risk in case of emergency. Lets say shortage
> of electricity. Or a server crash during development. Is there a way
> to do this without saving/loosing the connection objects to avoid the
> object leak mentioned above ?
You could store the 'current' users() array in a global variable in the
driver object that is then saved in the 'periodical' statedump. Make sure
the array is empty or nil if you do a shutdown + statedump as done in the
do_shutdown() code. Then in restored(), check for the global variable and
make all user objects go linkdead after all.
A possible side-effect (which you can work around of course if you want)
is that the user-objects will seem to have been logged on from the time
the periodical statedump was made until the time that you restart from it,
which can look a bit silly (players aging a day while in reality they
logged out 5 minutes after the periodical statedump, things like that).
Hope that helps.
Erwin.
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list