ZnZincServerAdaptor on Gemstone

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ZnZincServerAdaptor on Gemstone

GLASS mailing list
Hello.

We're currently using WAFastCGIAdaptor in Gemstone 3.4.1. Calling start
on it does not return and utilises the current process to serve requests.

We'd like to use ZnZincServerAdaptor in the same way, but I can't figure
out how to do that.  (We're using v2.4.3.6 of github://GsDevKit/zinc).

What I've tried to do is to subclass from ZnSingleThreadedServer, and on
it override start to something that does not fork:

ZnForegroundServer:

start
        self stop: false.
        self class default = self
                ifTrue: [ self register ].
        [ self listenLoop ] repeat

Then, I'd start the adaptor like this:

(ZnZincServerAdaptor port: portInteger)
                serverClass: ZnForegroundServer;
                start.

Running the above blocks and listens on the socket. But as soon as I try
to hit it with a web browser, the browser is left waiting for a response
while the server breaks with:

ERROR 2710 , a ConnectionClosed occurred (error 2710), , Connection
closed while waiting for data. (ConnectionClosed)

I realise I don't understand this code at all, but I thought this ought
to be do-able. Any advice would be appreciated!

For interest, here is the stack trace when run from topaz:

==> 1 ConnectionClosed (AbstractException) >> _signalWith: @6 line 25
2 ConnectionClosed (AbstractException) >> signal: @3 line 7
3 ConnectionClosed class (AbstractException class) >> signal: @3 line 4
4 SocketStreamSocket >> receiveDataSignallingTimeout:into:startingAt:
@11 line 14
5 SocketStream >> receiveData                   @6 line 15
6 SocketStream >> next                          @7 line 9
7 ZnLineReader >> processNext                   @6 line 4
8 ZnLineReader >> nextLine                      @3 line 3
9 ZnRequestLine >> readFrom:                    @4 line 3
10 ZnRequestLine class >> readFrom:              @3 line 3
11 ZnRequest >> readHeaderFrom:                  @2 line 2
12 ZnRequest (ZnMessage) >> readFrom:            @2 line 2
13 ZnRequest class (ZnMessage class) >> readFrom: @3 line 3
14 [] in ZnServer >> reader                      @7 line 4
15 [] in ZnSingleThreadedServer >> readRequest:  @16 line 6
16 [] in ZnSingleThreadedServer >> withMaximumEntitySizeDo: @11 line 6
17 [] in DynamicVariable class >> value:during:  @16 line 9
18 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
19 ZnMaximumEntitySize class (DynamicVariable class) >> value:during: @7
line 10
20 ZnForegroundServer (ZnSingleThreadedServer) >>
withMaximumEntitySizeDo: @6 line 5
21 ZnForegroundServer (ZnSingleThreadedServer) >> readRequest: @3 line 6
22 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @13 line 12
23 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
24 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @9 line 16
25 [] in DynamicVariable class >> value:during:  @16 line 9
26 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
27 ZnCurrentServer class (DynamicVariable class) >> value:during: @7 line 10
28 ZnForegroundServer (ZnSingleThreadedServer) >>
executeOneRequestResponseOn: @5 line 9
29 [] in ZnSingleThreadedServer >> serveConnectionOn: @31 line 13
30 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
31 [] in ZnSingleThreadedServer >> serveConnectionOn: @27 line 14
32 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
33 [] in ZnSingleThreadedServer >> serveConnectionOn: @21 line 16
34 [] in ExecBlock >> ifCurtailed:               @8 line 6
35 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
36 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
37 [] in ZnSingleThreadedServer >> serveConnectionOn: @17 line 19
38 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
39 ZnForegroundServer (ZnSingleThreadedServer) >> serveConnectionOn: @5
line 22
40 [] in ZnSingleThreadedServer >> listenLoop    @12 line 12
41 [] in ExecBlock >> ifCurtailed:               @8 line 6
42 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
43 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
44 ZnForegroundServer (ZnSingleThreadedServer) >> listenLoop @4 line 14
45 ZnForegroundServer >> start                   @8 line 5
46 ZnZincServerAdaptor >> basicStart             @3 line 2
47 [] in WAServerManager >> start:               @9 line 3
48 [] in ExecBlock >> ifCurtailed:               @8 line 6
49 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
50 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
51 WAServerManager >> start:                     @5 line 4
52 ZnZincServerAdaptor (WAServerAdaptor) >> start @3 line 2




--


_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: ZnZincServerAdaptor on Gemstone

GLASS mailing list

Iwan,

Have you looked at gsApplicationTools[1][2]? The GemServers in gsApplicationTools are designed to work with Zinc instead of FFI.

In my Seaside installation this is the class hierarchy for ZnZincServerAdaptor:

Object
 GRObject
  WAObject
   WAServerAdaptor
    ZnZincServerAdaptor
     WAGsZincAdaptor
      WAZincNewGemServerAdaptor

The class WAGsZincAdaptor and WAZincNewGemServerAdaptor are Zinc  adaptors designed to work in GemStone. To get those classes loaded you should load Seaside with at Metacello expression that loads 'Zinc Project' along with your other `loads:` arguments and that should get you all of the Seaside classes needed to uze Zinc servers in GemStone.

If you decide not to use gsApplicationTools, you should at least take a look at gsApplicationTools for examples on how to use the adaptors.

Dale

On 6/17/20 5:00 AM, Iwan Vosloo via Glass wrote:
Hello.

We're currently using WAFastCGIAdaptor in Gemstone 3.4.1. Calling start on it does not return and utilises the current process to serve requests.

We'd like to use ZnZincServerAdaptor in the same way, but I can't figure out how to do that.  (We're using v2.4.3.6 of github://GsDevKit/zinc).

What I've tried to do is to subclass from ZnSingleThreadedServer, and on it override start to something that does not fork:

ZnForegroundServer:

start
    self stop: false.
    self class default = self
        ifTrue: [ self register ].
    [ self listenLoop ] repeat

Then, I'd start the adaptor like this:

(ZnZincServerAdaptor port: portInteger)
        serverClass: ZnForegroundServer;
        start.

Running the above blocks and listens on the socket. But as soon as I try to hit it with a web browser, the browser is left waiting for a response while the server breaks with:

ERROR 2710 , a ConnectionClosed occurred (error 2710), , Connection closed while waiting for data. (ConnectionClosed)

I realise I don't understand this code at all, but I thought this ought to be do-able. Any advice would be appreciated!

For interest, here is the stack trace when run from topaz:

==> 1 ConnectionClosed (AbstractException) >> _signalWith: @6 line 25
2 ConnectionClosed (AbstractException) >> signal: @3 line 7
3 ConnectionClosed class (AbstractException class) >> signal: @3 line 4
4 SocketStreamSocket >> receiveDataSignallingTimeout:into:startingAt: @11 line 14
5 SocketStream >> receiveData                   @6 line 15
6 SocketStream >> next                          @7 line 9
7 ZnLineReader >> processNext                   @6 line 4
8 ZnLineReader >> nextLine                      @3 line 3
9 ZnRequestLine >> readFrom:                    @4 line 3
10 ZnRequestLine class >> readFrom:              @3 line 3
11 ZnRequest >> readHeaderFrom:                  @2 line 2
12 ZnRequest (ZnMessage) >> readFrom:            @2 line 2
13 ZnRequest class (ZnMessage class) >> readFrom: @3 line 3
14 [] in ZnServer >> reader                      @7 line 4
15 [] in ZnSingleThreadedServer >> readRequest:  @16 line 6
16 [] in ZnSingleThreadedServer >> withMaximumEntitySizeDo: @11 line 6
17 [] in DynamicVariable class >> value:during:  @16 line 9
18 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
19 ZnMaximumEntitySize class (DynamicVariable class) >> value:during: @7 line 10
20 ZnForegroundServer (ZnSingleThreadedServer) >> withMaximumEntitySizeDo: @6 line 5
21 ZnForegroundServer (ZnSingleThreadedServer) >> readRequest: @3 line 6
22 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @13 line 12
23 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
24 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @9 line 16
25 [] in DynamicVariable class >> value:during:  @16 line 9
26 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
27 ZnCurrentServer class (DynamicVariable class) >> value:during: @7 line 10
28 ZnForegroundServer (ZnSingleThreadedServer) >> executeOneRequestResponseOn: @5 line 9
29 [] in ZnSingleThreadedServer >> serveConnectionOn: @31 line 13
30 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
31 [] in ZnSingleThreadedServer >> serveConnectionOn: @27 line 14
32 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
33 [] in ZnSingleThreadedServer >> serveConnectionOn: @21 line 16
34 [] in ExecBlock >> ifCurtailed:               @8 line 6
35 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
36 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
37 [] in ZnSingleThreadedServer >> serveConnectionOn: @17 line 19
38 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
39 ZnForegroundServer (ZnSingleThreadedServer) >> serveConnectionOn: @5 line 22
40 [] in ZnSingleThreadedServer >> listenLoop    @12 line 12
41 [] in ExecBlock >> ifCurtailed:               @8 line 6
42 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
43 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
44 ZnForegroundServer (ZnSingleThreadedServer) >> listenLoop @4 line 14
45 ZnForegroundServer >> start                   @8 line 5
46 ZnZincServerAdaptor >> basicStart             @3 line 2
47 [] in WAServerManager >> start:               @9 line 3
48 [] in ExecBlock >> ifCurtailed:               @8 line 6
49 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
50 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
51 WAServerManager >> start:                     @5 line 4
52 ZnZincServerAdaptor (WAServerAdaptor) >> start @3 line 2





_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: ZnZincServerAdaptor on Gemstone

GLASS mailing list
Hi Dale,

I was not aware of the classes below ZnZincServerAdaptor or the gem
server framework. Those are nice docs, thanks.

-i

On 2020/06/17 20:40, Dale Henrichs via Glass wrote:

> Iwan,
>
> Have you looked at gsApplicationTools[1][2]? The GemServers in
> gsApplicationTools are designed to work with Zinc instead of FFI.
>
> In my Seaside installation this is the class hierarchy for
> ZnZincServerAdaptor:
>
>     Object
>       GRObject
>        WAObject
>         WAServerAdaptor
>          ZnZincServerAdaptor
>           WAGsZincAdaptor
>            WAZincNewGemServerAdaptor
>
> The class WAGsZincAdaptor and WAZincNewGemServerAdaptor are Zinc
> adaptors designed to work in GemStone. To get those classes loaded you
> should load Seaside with at Metacello expression that loads 'Zinc
> Project' along with your other `loads:` arguments and that should get
> you all of the Seaside classes needed to uze Zinc servers in GemStone.
>
> If you decide not to use gsApplicationTools, you should at least take a
> look at gsApplicationTools for examples on how to use the adaptors.
>
> Dale
>
> [1] https://github.com/dalehenrich/gsApplicationTools
> [2]
> https://github.com/GsDevKit/gsApplicationTools/blob/master/docs/gettingStarted.md#table-of-contents
> On 6/17/20 5:00 AM, Iwan Vosloo via Glass wrote:
>> Hello.
>>
>> We're currently using WAFastCGIAdaptor in Gemstone 3.4.1. Calling
>> start on it does not return and utilises the current process to serve
>> requests.
>>
>> We'd like to use ZnZincServerAdaptor in the same way, but I can't
>> figure out how to do that.  (We're using v2.4.3.6 of
>> github://GsDevKit/zinc).
>>
>> What I've tried to do is to subclass from ZnSingleThreadedServer, and
>> on it override start to something that does not fork:
>>
>> ZnForegroundServer:
>>
>> start
>>     self stop: false.
>>     self class default = self
>>         ifTrue: [ self register ].
>>     [ self listenLoop ] repeat
>>
>> Then, I'd start the adaptor like this:
>>
>> (ZnZincServerAdaptor port: portInteger)
>>         serverClass: ZnForegroundServer;
>>         start.
>>
>> Running the above blocks and listens on the socket. But as soon as I
>> try to hit it with a web browser, the browser is left waiting for a
>> response while the server breaks with:
>>
>> ERROR 2710 , a ConnectionClosed occurred (error 2710), , Connection
>> closed while waiting for data. (ConnectionClosed)
>>
>> I realise I don't understand this code at all, but I thought this
>> ought to be do-able. Any advice would be appreciated!
>>
>> For interest, here is the stack trace when run from topaz:
>>
>> ==> 1 ConnectionClosed (AbstractException) >> _signalWith: @6 line 25
>> 2 ConnectionClosed (AbstractException) >> signal: @3 line 7
>> 3 ConnectionClosed class (AbstractException class) >> signal: @3 line 4
>> 4 SocketStreamSocket >> receiveDataSignallingTimeout:into:startingAt:
>> @11 line 14
>> 5 SocketStream >> receiveData                   @6 line 15
>> 6 SocketStream >> next                          @7 line 9
>> 7 ZnLineReader >> processNext                   @6 line 4
>> 8 ZnLineReader >> nextLine                      @3 line 3
>> 9 ZnRequestLine >> readFrom:                    @4 line 3
>> 10 ZnRequestLine class >> readFrom:              @3 line 3
>> 11 ZnRequest >> readHeaderFrom:                  @2 line 2
>> 12 ZnRequest (ZnMessage) >> readFrom:            @2 line 2
>> 13 ZnRequest class (ZnMessage class) >> readFrom: @3 line 3
>> 14 [] in ZnServer >> reader                      @7 line 4
>> 15 [] in ZnSingleThreadedServer >> readRequest:  @16 line 6
>> 16 [] in ZnSingleThreadedServer >> withMaximumEntitySizeDo: @11 line 6
>> 17 [] in DynamicVariable class >> value:during:  @16 line 9
>> 18 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 19 ZnMaximumEntitySize class (DynamicVariable class) >> value:during:
>> @7 line 10
>> 20 ZnForegroundServer (ZnSingleThreadedServer) >>
>> withMaximumEntitySizeDo: @6 line 5
>> 21 ZnForegroundServer (ZnSingleThreadedServer) >> readRequest: @3 line 6
>> 22 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @13
>> line 12
>> 23 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
>> 24 [] in ZnSingleThreadedServer >> executeOneRequestResponseOn: @9
>> line 16
>> 25 [] in DynamicVariable class >> value:during:  @16 line 9
>> 26 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 27 ZnCurrentServer class (DynamicVariable class) >> value:during: @7
>> line 10
>> 28 ZnForegroundServer (ZnSingleThreadedServer) >>
>> executeOneRequestResponseOn: @5 line 9
>> 29 [] in ZnSingleThreadedServer >> serveConnectionOn: @31 line 13
>> 30 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
>> 31 [] in ZnSingleThreadedServer >> serveConnectionOn: @27 line 14
>> 32 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 33 [] in ZnSingleThreadedServer >> serveConnectionOn: @21 line 16
>> 34 [] in ExecBlock >> ifCurtailed:               @8 line 6
>> 35 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 36 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
>> 37 [] in ZnSingleThreadedServer >> serveConnectionOn: @17 line 19
>> 38 ExecBlock0 (ExecBlock) >> on:do:              @3 line 44
>> 39 ZnForegroundServer (ZnSingleThreadedServer) >> serveConnectionOn:
>> @5 line 22
>> 40 [] in ZnSingleThreadedServer >> listenLoop    @12 line 12
>> 41 [] in ExecBlock >> ifCurtailed:               @8 line 6
>> 42 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 43 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
>> 44 ZnForegroundServer (ZnSingleThreadedServer) >> listenLoop @4 line 14
>> 45 ZnForegroundServer >> start                   @8 line 5
>> 46 ZnZincServerAdaptor >> basicStart             @3 line 2
>> 47 [] in WAServerManager >> start:               @9 line 3
>> 48 [] in ExecBlock >> ifCurtailed:               @8 line 6
>> 49 ExecBlock0 (ExecBlock) >> ensure:             @2 line 12
>> 50 ExecBlock0 (ExecBlock) >> ifCurtailed:        @4 line 8
>> 51 WAServerManager >> start:                     @5 line 4
>> 52 ZnZincServerAdaptor (WAServerAdaptor) >> start @3 line 2
>>
>>
>>
>>
>
> _______________________________________________
> Glass mailing list
> [hidden email]
> https://lists.gemtalksystems.com/mailman/listinfo/glass
>


--

Reahl, the Python only web framework / www.reahl.org
_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass