[Vm-dev] Re: FFI crashes VM on Linux (was: Z3950 on OSX: module yaz3 not found)

Hernán Morales Durand hernan.morales at gmail.com
Fri Dec 24 15:44:50 UTC 2010


Hi David,

2010/12/24 David T. Lewis <lewis at mail.msen.com>:
>
> Hern??n,
>
> A segmentation fault that occurs when calling the function in an
> external library would most likely indicate that the arguments being
> passed to the library function are not correct for some reason.
> Probably it is something related to the ExternalStructure as you
> mention.

The strange thing is that in the Windows VM goes fine. Is there a
special VM debug flag or parameter specifically for this cases? Maybe
I could check with that.

> You must use a normal 32-bit VM and 32-bit libraries. I think that
> you are doing this, but I mention it because using 64-bit VM or
> libraries will definitely crash FFI.
>  <http://bugs.squeak.org/view.php?id=7237>
>

Yes, I'm sure because Ubuntu 8.10 doesn't allow to install libraries
compiled for another architecture.

Cheers,

> Dave
>
> On Fri, Dec 24, 2010 at 08:33:33AM +0100, laurent laffont wrote:
>>
>> Which VM have you used ?
>>
>> I cross post to vm-dev list.
>>
>> Laurent.
>>
>> On Fri, Dec 24, 2010 at 3:54 AM, Hern??n Morales Durand <
>> hernan.morales at gmail.com> wrote:
>>
>> > Laurent, not much progress here :(
>> > I just reproduced the Unix VM crash. First I've linked the library so
>> > we do not have to change every module name call
>> >
>> > user at ubuntu:/usr/lib$ ln -T -s /usr/lib/libyaz.so.3.0.0 yaz
>> >
>> > and I've tried to execute the library tracer in the shell script
>> >
>> > ltrace -f -l /usr/lib/libyaz.so.3.0.0 -o out.txt "$BASE/squeakvm" \
>> >        -plugins "$BASE" \
>> >        -encoding latin1 \
>> >        -vm-display-X11 \
>> >        "$ROOT/Contents/Resources/pharo.image"
>> >
>> > but it crash the VM too with an unhandled exception even before the
>> > GUI is displayed.
>> > What I've observed is that every FFI call which receives an
>> > ExternalStructure as parameter kills the VM. This is weird because
>> > this doesn't happen in the Windows VM. I ran this little script I use
>> > to debug the library
>> >
>> > | conn lib rs rsSize records |
>> > lib := Z3950FFILibrary default.
>> > conn := lib
>> >        createConnectionTo: #Alabama asZ3950Server hostName
>> >        port: 7090.
>> > lib createOptions.
>> > lib
>> >        setConnection: conn
>> >        optionName: 'preferredRecordSyntax'
>> >        optionValue: 'USMARC'.
>> > rs := lib
>> >        searchPqf: conn
>> >        query:  '@attr 1=1003 collins'.
>> > rsSize := lib resultSetSize: rs.
>> > rsSize > 0
>> >        ifFalse:  [ 'no results' ].
>> > records := Array new: rsSize.
>> > 0 to: rsSize - 1 do: [: pos |
>> >        record := lib resultSetRecord: rs position: pos.
>> >        record isNil not
>> >                ifTrue:  [
>> >                        records
>> >                                at: pos + 1
>> >                                put: ( lib
>> >                                        getRecord: record
>> >                                        function: 'render; charset=marc8,
>> > iso8859-1'
>> >                                        length: nil ). ] ].
>> > records
>> >
>> > and the the doIt just hangs the VM, the console output going through
>> > the Debugger is the following:
>> >
>> > Segmentation fault
>> >
>> > -1370902312 ContextPart>doPrimitive:method:receiver:args:
>> > -1370902404 ContextPart>tryPrimitiveFor:receiver:args:
>> > -1370902788 ContextPart>send:to:with:super:
>> > -1370902896 ContextPart>send:super:numArgs:
>> > -1370902988 InstructionStream>interpretExtension:in:for:
>> > -1370903080 InstructionStream>interpretNextInstructionFor:
>
>



-- 
Hernán Morales
Information Technology Manager,
Institute of Veterinary Genetics.
National Scientific and Technical Research Council (CONICET).
La Plata (1900), Buenos Aires, Argentina.
Telephone: +54 (0221) 421-1799.
Internal: 422
Fax: 425-7980 or 421-1799.


More information about the Vm-dev mailing list