Re: Serialization: crash at launch of program (duetoboost::serialization::base_object)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Serialization: crash at launch of program (duetoboost::serialization::base_object)

RIVASSEAU Jean Noel
I have tried to use versioning. Exact same problem.

More explanations: if I use the version facility,  and at load I switch the boost::serialization::base_object<MyBaseClass> depending on the version, the same crash will happen.

Eg: this code:

if (version == 0)
{
        boost::serialization::base_object<MyBaseClass_1>
}
Else
{
        boost::serialization::base_object<MyBaseClass_2>
}

Will cause the same crash.

So, could you look at the code, because currently there is no way to change the base class of an object appearing in serialized archives, if you want to be able to read old archives.

It seems like there is a bug, if the base_object is used several times with different classes, the crash will appear.

Thanks

Jean-Noël


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Robert Ramey
Envoyé : mercredi 5 avril 2006 17:15
À : [hidden email]
Objet : Re: [Boost-users] Serialization: crash at launch of program (duetoboost::serialization::base_object)

The "version" facility is provided for maintaining the ability to read old
archives.  It doesn't sound like you're using this and its sounds like you
should be.

Robert Ramey


"RIVASSEAU Jean Noel" <[hidden email]> wrote in message
news:[hidden email]...
Hello,

My program crashes at launch (not even a exit(0) as the first line of
main(int argc, char *argv[]) will stop it from crashing), due to the BSL.

What I am trying to do is: I have a class, whose serialization is split (eg,
save and load functions are provided, and they are different). Now this
class had a parent class, so I used to call
boost::serialization::base_object<MObject>() on the base class MObject.

However I want to change the parent of my class to a different class. I also
want to update my old archives, so I decided to leave the load function of
my class untouched, while I would change the save function, to update the
call to base_object to the new parent class (not MObject anymore). I thought
it would work, since it would load the old archive using the same method,
but save it using the new, so I would have ran only one time the program and
the archive would be updated (then, of course, before running it again I
would have to recompile it one more time with the correct changes to the
load function).

But it does not work as expected, since it seems the BSL does not like the
fact that save and load functions calls to boost::serialization::base_object
do not specify the same base class. It does not complain at compile time but
crashes at run time before even entering main and certainly before loading
any archive. The crash is due to a NULL pointer, I have tried to debug with
gdb but the crash apparently occurs on the _libkernel32_a_iname () so I do
not not know where it is (too low level for me).

Robert, do you have an idea what is going on? I suspect a bug - however if
it is "normal" behaviour (I think it should then throw an exception rather
than crash),

***
Tell that to the author of _libkernel32_a_iname ()

do you have an idea how could I update my archives? I need to change the
parent of this class, but need to be able to read my old archives - and
changing them "by hand" by looking into the XML archive code is tool hard.

Thank you, regards

Jean-Noël Rivasseau



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users 





_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Serialization: crash at launch of program(duetoboost::serialization::base_object)

Robert Ramey
I would be wiling to look at a small example which demonstrates the problem.

Robert Ramey

RIVASSEAU Jean Noel wrote:

> I have tried to use versioning. Exact same problem.
>
> More explanations: if I use the version facility,  and at load I
> switch the boost::serialization::base_object<MyBaseClass> depending
> on the version, the same crash will happen.
>
> Eg: this code:
>
> if (version == 0)
> {
> boost::serialization::base_object<MyBaseClass_1>
> }
> Else
> {
> boost::serialization::base_object<MyBaseClass_2>
> }
>
> Will cause the same crash.
>
> So, could you look at the code, because currently there is no way to
> change the base class of an object appearing in serialized archives,
> if you want to be able to read old archives.
>
> It seems like there is a bug, if the base_object is used several
> times with different classes, the crash will appear.
>
> Thanks
>
> Jean-Noël
>
>
> -----Message d'origine-----
> De : [hidden email]
> [mailto:[hidden email]] De la part de Robert
> Ramey
> Envoyé : mercredi 5 avril 2006 17:15
> À : [hidden email]
> Objet : Re: [Boost-users] Serialization: crash at launch of program
> (duetoboost::serialization::base_object)
>
> The "version" facility is provided for maintaining the ability to
> read old
> archives.  It doesn't sound like you're using this and its sounds
> like you
> should be.
>
> Robert Ramey
>
>
> "RIVASSEAU Jean Noel" <[hidden email]> wrote in message
> news:[hidden email]...
> Hello,
>
> My program crashes at launch (not even a exit(0) as the first line of
> main(int argc, char *argv[]) will stop it from crashing), due to the
> BSL.
>
> What I am trying to do is: I have a class, whose serialization is
> split (eg,
> save and load functions are provided, and they are different). Now
> this
> class had a parent class, so I used to call
> boost::serialization::base_object<MObject>() on the base class
> MObject.
>
> However I want to change the parent of my class to a different class.
> I also
> want to update my old archives, so I decided to leave the load
> function of
> my class untouched, while I would change the save function, to update
> the
> call to base_object to the new parent class (not MObject anymore). I
> thought
> it would work, since it would load the old archive using the same
> method,
> but save it using the new, so I would have ran only one time the
> program and
> the archive would be updated (then, of course, before running it
> again I
> would have to recompile it one more time with the correct changes to
> the
> load function).
>
> But it does not work as expected, since it seems the BSL does not
> like the
> fact that save and load functions calls to
> boost::serialization::base_object
> do not specify the same base class. It does not complain at compile
> time but
> crashes at run time before even entering main and certainly before
> loading
> any archive. The crash is due to a NULL pointer, I have tried to
> debug with
> gdb but the crash apparently occurs on the _libkernel32_a_iname () so
> I do
> not not know where it is (too low level for me).
>
> Robert, do you have an idea what is going on? I suspect a bug -
> however if
> it is "normal" behaviour (I think it should then throw an exception
> rather
> than crash),
>
> ***
> Tell that to the author of _libkernel32_a_iname ()
>
> do you have an idea how could I update my archives? I need to change
> the
> parent of this class, but need to be able to read my old archives -
> and
> changing them "by hand" by looking into the XML archive code is tool
> hard.
>
> Thank you, regards
>
> Jean-Noël Rivasseau
>
>
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users =



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users