I'm trying to serialize and materialize some domain objects. If I run this:
FLSerializer serialize: users toFileNamed: 'users.fuel'. The file users.fuel is created. If in the same workspace in the same Pharo 1.3 image on Cog 2550 / Linux 64 bit I subsequently run: FLMaterializer materialzeFromFileNamed: 'users.fuel' I get an FLMethodChanged error. If I just serialize and materialize strings, numbers, and DateAndTime objects to files everything works fine and all 248 Fuel tests pass no problem. The incoming method it has a problem with is an #initialize method. The serializeHash is 15407 and the result of 'method bytecodesHash' is 30998. What should I check to diagnose/fix this problem? Thanks |
On Thu, Jun 7, 2012 at 10:12 PM, Paul DeBruicker <[hidden email]> wrote: I'm trying to serialize and materialize some domain objects. If I run this: that looks weird, because you are materializng in the SAME image ...
The incoming method it has a problem with is an #initialize method. which class is the one that contains that #initialize? do you have an #initialize in your image that uses pragmas? The serializeHash is 15407 and the result of 'method bytecodesHash' is 30998. can you try closing all opened ssytem browsers (nautilus windows or wharever)?
is your data private or you can provide an image with "users" so that we can test? Thanks -- Mariano http://marianopeck.wordpress.com |
On 06/07/2012 01:18 PM, Mariano Martinez Peck wrote:
> If I just serialize and materialize strings, numbers, and > DateAndTime objects to files everything works fine and all 248 Fuel > tests pass no problem. > > The incoming method it has a problem with is an #initialize method. > > > which class is the one that contains that #initialize? > do you have an #initialize in your image that uses pragmas? > There are pragmas but not in an #initialize method. The class where the error occurs is also a domain object. > The serializeHash is 15407 and the result of 'method bytecodesHash' > is 30998. > > > can you try closing all opened ssytem browsers (nautilus windows or > wharever)? > That didn't change things. > > What should I check to diagnose/fix this problem? > > > is your data private or you can provide an image with "users" so that we > can test? I can make up some imaginary users. |
In reply to this post by Mariano Martinez Peck
Its a problem with one of the instances of my domain object. When I
make a bunch of fake users and wipe out the real ones they serialize and materialize just fine. I'll try to set a halt for the serializedHash I mentioned earlier to see what's going on in the real object. Thanks On 06/07/2012 01:18 PM, Mariano Martinez Peck wrote: > > > On Thu, Jun 7, 2012 at 10:12 PM, Paul DeBruicker <[hidden email] > <mailto:[hidden email]>> wrote: > > I'm trying to serialize and materialize some domain objects. If I > run this: > > > FLSerializer serialize: users toFileNamed: 'users.fuel'. > > > The file users.fuel is created. > > If in the same workspace in the same Pharo 1.3 image on Cog 2550 / > Linux 64 bit I subsequently run: > > FLMaterializer materialzeFromFileNamed: 'users.fuel' > > I get an FLMethodChanged error. > > > that looks weird, because you are materializng in the SAME image ... > > > If I just serialize and materialize strings, numbers, and > DateAndTime objects to files everything works fine and all 248 Fuel > tests pass no problem. > > The incoming method it has a problem with is an #initialize method. > > > which class is the one that contains that #initialize? > do you have an #initialize in your image that uses pragmas? > > The serializeHash is 15407 and the result of 'method bytecodesHash' > is 30998. > > > can you try closing all opened ssytem browsers (nautilus windows or > wharever)? > > > What should I check to diagnose/fix this problem? > > > is your data private or you can provide an image with "users" so that we > can test? > > Thanks > > > > > -- > Mariano > http://marianopeck.wordpress.com > |
In reply to this post by Mariano Martinez Peck
The problem was that in one of the inst vars of my class that had the
error I was in some instances storing a Dictionary and other instances storing a SortedCollection with a custom sortBlock. They should have all been dictionaries but some instances had not been migrated to dictionaries. Once I fixed that the problem went away. This bit in a workspace also raises an error. I'm not sure why it does and I don't know why you'd ever do it in practice: |coll| coll:=OrderedCollection new. (Interval from: 1 to: 100) do: [:each| coll add:( each \\ 2 = 0 ifTrue: [SortedCollection sortBlock:[:a :c | a name < c name] ] ifFalse:[Dictionary new] ) ]. FLSerializer serialize: coll toFileNamed: 'collection.fuel'. FLMaterializer materializeFromFileNamed: 'collection.fuel' On 06/07/2012 01:18 PM, Mariano Martinez Peck wrote: > > > On Thu, Jun 7, 2012 at 10:12 PM, Paul DeBruicker <[hidden email] > <mailto:[hidden email]>> wrote: > > I'm trying to serialize and materialize some domain objects. If I > run this: > > > FLSerializer serialize: users toFileNamed: 'users.fuel'. > > > The file users.fuel is created. > > If in the same workspace in the same Pharo 1.3 image on Cog 2550 / > Linux 64 bit I subsequently run: > > FLMaterializer materialzeFromFileNamed: 'users.fuel' > > I get an FLMethodChanged error. > > > that looks weird, because you are materializng in the SAME image ... > > > If I just serialize and materialize strings, numbers, and > DateAndTime objects to files everything works fine and all 248 Fuel > tests pass no problem. > > The incoming method it has a problem with is an #initialize method. > > > which class is the one that contains that #initialize? > do you have an #initialize in your image that uses pragmas? > > The serializeHash is 15407 and the result of 'method bytecodesHash' > is 30998. > > > can you try closing all opened ssytem browsers (nautilus windows or > wharever)? > > > What should I check to diagnose/fix this problem? > > > is your data private or you can provide an image with "users" so that we > can test? > > Thanks > > > > > -- > Mariano > http://marianopeck.wordpress.com > |
On Thu, Jun 7, 2012 at 11:16 PM, Paul DeBruicker <[hidden email]> wrote: The problem was that in one of the inst vars of my class that had the error I was in some instances storing a Dictionary and other instances storing a SortedCollection with a custom sortBlock. They should have all been dictionaries but some instances had not been migrated to dictionaries. Once I fixed that the problem went away. Hi. Fuel does support full serialization of closures but you may need to "enable" that. BTW, can you try something with the image where you still have the closure and try to serialize this way: | serializer | serializer := FLSerializer newFull. serializer serialize: xxx on: aStream. and tell me if that also work? This bit in a workspace also raises an error. I'm not sure why it does and I don't know why you'd ever do it in practice: Thanks, I could reproduce it. I will take a look soon.
-- Mariano http://marianopeck.wordpress.com |
On 06/07/2012 02:25 PM, Mariano Martinez Peck wrote:
> | serializer | > serializer := FLSerializer newFull. > serializer serialize: xxx on: aStream. Using Fuel 1.8 I get a dnu when FLSerializer is sent #newFull. There is a #newDefault and a #newLight in my image. |
> Using Fuel 1.8 I get a dnu when FLSerializer is sent #newFull.
Hi Paul, You have to install FuelMetalevel, an additional package: Gofer new url: 'http://ss3.gemstone.com/ss/Fuel'; package: 'ConfigurationOfFuel'; load. ((Smalltalk at: #ConfigurationOfFuel) project version: #stable) load: 'FuelMetalevel'. Martín |
In reply to this post by Mariano Martinez Peck
On 06/07/2012 02:25 PM, Mariano Martinez Peck wrote:
> | serializer | > serializer := FLSerializer newFull. > serializer serialize: xxx on: aStream. > > and tell me if that also work? After loading FuelMetaLevel as Martin suggested the above code works to serialize and materialize the problematic domain objects just fine. |
On Fri, Jun 8, 2012 at 1:41 AM, Paul DeBruicker <[hidden email]> wrote:
Ok, just to clarify: when you install the package Fuel only, and in your graph you have entities like classes or methods, they will be considered "global", that is, we just store the class name and selector and during materialization we search it in the Smalltalk globals. If the class/method is not present, we throw an error. Now...closures are more complicated because you can even EVALUATE them. If the method surrounding the closure has changed in the image you are materializing, evaluating the closure (depending on the change in the method) can even crash your VM. Because of that, when serializing methods "as globals" we also store a chemsum and we compare during materialization to see that it hasn't change it. If changed, we throw the FLMethodChanged. With the package FuelMetalevel, and by using #newFull the serializer will consider the method as "full" so it will be fully serialized, and therefore you don't have the problem of the checksum. Anyway, you found a bug because you should not be needing FuelMetalevel since you are serializing and materializing in the same image. We will investigate it. Thanks -- Mariano http://marianopeck.wordpress.com |
Ok...the problem was when you are using the normal (light) serialization with Fuel where methods are always serialized as global. In your case, the method was "not installed" and therefore, was different during materialization. I have just commited Fuel-MarianoMartinezPeck.695. If you know try to serialize again your example, you should get a FLNotInstalledMethod error saying " #XXXSelector can not be serialized as global because it is not installed. You need FuelMetalevel to fully serialize methods. See the documentation. '" And now in http://rmod.lille.inria.fr/web/pier/software/Fuel/Errors I have added that exception and its explanation:
FLSerializer newFull serialize: anObject toFileNamed: 'example'. Cheers
-- Mariano http://marianopeck.wordpress.com |
Free forum by Nabble | Edit this page |