[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Exception in the socket code

From: Paolo Bonzini
Subject: [Help-smalltalk] Re: Exception in the socket code
Date: Fri, 25 Mar 2011 15:23:58 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 03/25/2011 03:11 PM, Holger Hans Peter Freyther wrote:
On 03/25/2011 02:59 PM, Paolo Bonzini wrote:

I mean, are you sure the primitive isn't failing because for example
aCollection is bogus?  I mean, this crashes the VM:

hmm... I assume it is valid as I go through the normal Socket>>#atEnd.

I guess I didn't explain myself very well...

st> (FileDescriptor on: 0) nextAvailable: 1 into: nil startingAt: 1

Object: nil error: did not understand #+
MessageNotUnderstood(Exception)>>signal (
UndefinedObject(Object)>>doesNotUnderstand: #+ (
FileDescriptor>>nextAvailable:into:startingAt: (
UndefinedObject>>executeStatements (a String:1)

Does this patch help, or otherwise change the failure?

diff --git a/packages/sockets/ b/packages/sockets/
index 8eb4dcd..2084797 100644
--- a/packages/sockets/
+++ b/packages/sockets/
@@ -46,6 +46,12 @@ collection.'>
        ptr := 1

+    close [
+       <category: 'buffer handling'>
+        super close.
+        flushBlock := nil
+    ]
     flushBlock: block [
        "Set which block will be used to flush the buffer.
         The block will be evaluated with a collection and
@@ -119,6 +125,12 @@ evaluates an user defined block to try to get some more data.'>
            yourself    "Force a buffer load soon"

+    close [
+       <category: 'buffer handling'>
+        super close.
+        fillBlock := nil
+    ]
     atEnd [
        "Answer whether the data stream has ended."

diff --git a/packages/sockets/ b/packages/sockets/
index ea11feb..c6358cd 100644
--- a/packages/sockets/
+++ b/packages/sockets/
@@ -1318,6 +1318,7 @@ This class adds a read buffer to the basic model of AbstractSocket.'>
        <category: 'private - buffering'>
        ^(ReadBuffer on: (String new: size)) fillBlock:
                [:data :size || n |
+                data isNil ifTrue: [self halt].
                self implementation ensureReadable.
                n := self implementation isOpen
ifTrue: [self implementation nextAvailable: size into: data startingAt: 1] @@ -1459,6 +1460,7 @@ This class adds read and write buffers to the basic model of AbstractSocket.'>
        ^(WriteBuffer on: (String new: size)) flushBlock:
                [:data :size |
                | alive |
+                data isNil ifTrue: [self halt].
                self implementation ensureWriteable.
                alive := self implementation isOpen
and: [(self implementation next: size putAll: data startingAt: 1) > -1].

I'll apply the part since it's good anyway.

should the vm crash? patches welcome?

no, it shouldn't.  patch on the way.

st>  (FileDescriptor on: 0) nextAvailable: 1 into: 123 startingAt: 1

stdin:4: Aborted
(ip 80)FileDescriptor>>#nextAvailable:into:startingAt:
(ip 14)UndefinedObject>>#executeStatements
(ip 0)<bottom>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]