Skip to content

As for GemStone 3.3 we do not need #changeTo: hack anymore (and it breaks) #22

Closed

Description

@marianopeck

On GemStone 3.3 and beyond, the hack of changeClassTo: to convert strings to UTF8 fails. Moreover, #_encodeAsUTF8intoString was added into the system so we should use that.

The new code should be:

GRUtf8CodecStream>>nextPutAll: 
  binary
    ifTrue: [ stream nextPutAll: aString asString ]
    ifFalse: [ stream nextPutAll: aString _encodeAsUTF8intoString ]

 Utf8>>asString
    ^ self decodeToUnicode

The whole discussion of this fix is in a thread "Again, Corrup Error preventing debugging real seaside exception" on the GLASS mailing list.

I am a bit out of time right now to setup everything to make a PR, but I will see if I have time later.

Activity

  1. marianopeck commented on Feb 4, 2017

    @marianopeck
    Author

    Actually the nextPutAll: is only part of Grase..the asString is part of gemstone

  2. marschall commented on Sep 4, 2017

    @marschall
    Contributor

    That's somehow too much copying.

  3. marianopeck commented on Sep 10, 2017

    @marianopeck
    Author

    It's still much faster and better. @dalehenrich @jbrichau do you agree with me too?

  4. marschall commented on Sep 10, 2017

    @marschall
    Contributor

    If it improves the situation I'm not per se against it. However it's in my option not an ideal solution. Let me expand a bit the design philosophy behind the Seaside encoding pipeline.

    The Seaside encoding pipeline was designed to allow direct rendering into a socket buffer without intermediate allocations for maximum performance. It is implicitly assumed that the socket buffer is a byte based buffer since that's what operating systems accept.

    A Seaside response is per default in text mode in which case only characters and collections of characters should be written to the response stream. Writing bytes or collections of bytes is an error in this case as the response should be put into binary mode for this (see below). In this mode a conversing from characters to bytes is supposed to happen using an encoding. For maximum efficiency characters should be encoded directly to the socket buffer without going through an intermediate collection.

    A Seaside response can be but into binary mode (by sending #binary) in which case only bytes and collections of bytes should be written to the response stream. Writing characters or collections of characters is an error in this case as no encoding is present. For maximum efficiency writes in this mode should be copied directly to the socket buffer.

    I don't know how much of this GemStone/S supports but if it supports encoding into a buffer without creating an intermediate object then from efficiency point of view this should be used. I have to say as well that I'm not familiar with the Utf8 class, is it supposed to be polymorphic with String?

  5. added this to the milestone on Oct 7, 2017
  6. jbrichau commented on Oct 7, 2017

    @jbrichau
    Member

    I added the fix proposed by Mariano in commit d65731b (I wrongly referenced issue 20 there..) since it does fix a bug.

    For reference, the original discussion: http://forum.world.st/Again-Corrup-Error-preventing-debugging-real-seaside-exception-td4932708.html

    Perhaps a good inspection of the encoding pipeline in GemStone would be good, but this fix does improve on the current situation, so I don't see a reason not to incorporate it.

  7. jbrichau commented on Nov 19, 2017

    @jbrichau
    Member

    I had done this fix on the dev branch with the idea that it was going to be merged soon. I now added a separate PR #61 for this.

  8. added a commit that references this issue on Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions