"Browse revisions" server error for long methods

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

"Browse revisions" server error for long methods

Christoph Thiede

Hi all, hi Chris,


I think there is an issue with the "Browse revisions" feature. When I invoke it on Context >> #doPrimitive:method:receiver:args:, I reproducibly get the following error:


Revisions request failed.  Server 'reply' in debugger.

414 Request-URI Too Large

And indeed, the original request is a little bit large:

url: 'http://source.squeak.org/trunk/'
args: {'action'->#('history') . 'mc-definition'->#('%09%00%00%00%07%06%12MCMethodDefinition%03%11%C3%80%00%18%C3%A7doPrimitive%3A%20primitiveIndex%20method%3A%20meth%20receiver%3A%20receiver%20args%3A%20arguments%0D%09%22Simulate%20a%20primitive%20method%20whose%20index%20is%20primitiveIndex.%20%20The%20simulated%20receiver%20and%0D%09%20arguments%20are%20given%20as%20arguments%20to%20this%20message.%20If%20successful%2C%20push%20result%20and%20return%0D%09%20resuming%20context%2C%20else%20%5E%20%7BerrCode%2C%20PrimitiveFailToken%7D.%20Any%20primitive%20which%20provokes%0D%09%20execution%20needs%20to%20be%20intercepted%20and%20simulated%20to%20avoid%20execution%20running%20away.%22%0D%0D%09%7C%20value%20%7C%0D%09%22Judicious%20use%20of%20primitive%2019%20%28a%20null%20primitive%20that%20doesn%27t%20do%20anything%29%20prevents%0D%09%20the%20debugger%20from%20entering%20various%20run-away%20activities%20such%20as%20spawning%20a%20new%0D%09%20process%2C%20etc.%20%20Injudicious%20use%20results%20in%20the%20debugger%20not%20being%20able%20to%20debug%0D%09%20interesting%20code%2C%20such%20as%20the%20debugger%20itself.%20%20Hence%20use%20primitive%2019%20with%20care%20%3A-%29%22%0D%09%22SystemNavigation%20new%20browseAllSelect%3A%20%5B%3Am%7C%20m%20primitive%20%3D%2019%5D%22%0D%09primitiveIndex%20%3D%2019%20ifTrue%3A%20%5B%0D%09%09%5Bself%20notify%3A%20%28%27The%20code%20being%20simulated%20is%20trying%20to%20control%20a%20process%20%28%7B1%7D%29.%20Process%20controlling%20cannot%20be%20simulated.%20If%20you%20proceed%2C%20things%20may%20happen%20outside%20the%20observable%20area%20of%20the%20simulator.%27%20translated%20format%3A%20%7Bmeth%20reference%7D%29%5D%0D%09%09%09ifCurtailed%3A%20%5Bself%20push%3A%20nil%20%22Cheap%20fix%20of%20the%20context%27s%20internal%20state%22%5D%5D.%0D%09%0D%09%28%28primitiveIndex%20between%3A%20201%20and%3A%20222%29%0D%09%20and%3A%20%5B%28self%20objectClass%3A%20receiver%29%20includesBehavior%3A%20BlockClosure%5D%29%20ifTrue%3A%0D%09%09%5B%28primitiveIndex%20%3D%20206%0D%09%09%20%20or%3A%20%5BprimitiveIndex%20%3D%20208%5D%29%20ifTrue%3A%09%09%09%09%09%09%22%5BFull%5DBlockClosure%3E%3EvalueWithArguments%3A%22%0D%09%09%09%5B%5Ereceiver%20simulateValueWithArguments%3A%20arguments%20first%20caller%3A%20self%5D.%0D%09%09%20%28%28primitiveIndex%20between%3A%20201%20and%3A%20209%29%09%09%09%20%22%5BFull%5DBlockClosure%3E%3Evalue%5B%3Avalue%3A...%5D%22%0D%09%09%20%20or%3A%20%5BprimitiveIndex%20between%3A%20221%20and%3A%20222%5D%29%20ifTrue%3A%20%22%5BFull%5DBlockClosure%3E%3EvalueNoContextSwitch%5B%3A%5D%22%0D%09%09%09%5B%5Ereceiver%20simulateValueWithArguments%3A%20arguments%20caller%3A%20self%5D%5D.%0D%0D%09primitiveIndex%20%3D%2083%20ifTrue%3A%20%22afr%209%2F11%2F1998%2019%3A50%22%20%22Object%3E%3Eperform%3A%5Bwith%3A...%5D%22%0D%09%09%5B%7C%20selector%20%7C%0D%09%09selector%20%3A%3D%20arguments%20at%3A%201%20ifAbsent%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09arguments%20size%20-%201%20%3D%20selector%20numArgs%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20number%20of%20arguments%27%5D.%0D%09%09%5Eself%20send%3A%20selector%20to%3A%20receiver%20with%3A%20arguments%20allButFirst%5D.%0D%09primitiveIndex%20%3D%2084%20ifTrue%3A%20%22afr%209%2F11%2F1998%2019%3A50%20%26%20eem%208%2F18%2F2009%2017%3A04%22%20%22Object%3E%3Eperform%3AwithArguments%3A%22%0D%09%09%5B%7C%20selector%20args%20%7C%0D%09%09arguments%20size%20%3D%202%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09selector%20%3A%3D%20arguments%20first.%0D%09%09args%20%3A%3D%20arguments%20second.%0D%09%09args%20isArray%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09args%20size%20%3D%20selector%20numArgs%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20number%20of%20arguments%27%5D.%0D%09%09%5Eself%20send%3A%20selector%20to%3A%20receiver%20with%3A%20args%5D.%0D%09primitiveIndex%20%3D%20100%20ifTrue%3A%20%22eem%208%2F18%2F2009%2016%3A57%22%20%22Object%3E%3Eperform%3AwithArguments%3AinSuperclass%3A%22%0D%09%09%5B%7C%20rcvr%20selector%20args%20superclass%20%7C%0D%09%09arguments%20size%0D%09%09%09caseOf%3A%20%7B%0D%09%09%09%09%5B3%5D%20-%3E%20%5B%0D%09%09%09%09%09rcvr%20%3A%3D%20receiver.%0D%09%09%09%09%09selector%20%3A%3D%20arguments%20first.%0D%09%09%09%09%09args%20%3A%3D%20arguments%20second.%0D%09%09%09%09%09superclass%20%3A%3D%20arguments%20third%5D.%0D%09%09%09%09%5B4%5D%20-%3E%20%5B%22mirror%20primitive%22%0D%09%09%09%09%09rcvr%20%3A%3D%20arguments%20first.%0D%09%09%09%09%09selector%20%3A%3D%20arguments%20second.%0D%09%09%09%09%09args%20%3A%3D%20arguments%20third.%0D%09%09%09%09%09superclass%20%3A%3D%20arguments%20fourth%5D%20%7D%0D%09%09%09otherwise%3A%20%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09args%20isArray%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09args%20size%20%3D%20selector%20numArgs%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20number%20of%20arguments%27%5D.%0D%09%09%28%28self%20objectClass%3A%20rcvr%29%20includesBehavior%3A%20superclass%29%20ifFalse%3A%0D%09%09%09%5B%5E%20self%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09%5Eself%20send%3A%20selector%20to%3A%20rcvr%20with%3A%20args%20lookupIn%3A%20superclass%5D.%0D%0D%09%22Mutex%3E%3EprimitiveEnterCriticalSection%0D%09%20Mutex%3E%3EprimitiveTestAndSetOwnershipOfCriticalSection%22%0D%09%28primitiveIndex%20%3D%20186%20or%3A%20%5BprimitiveIndex%20%3D%20187%5D%29%20ifTrue%3A%0D%09%09%5B%7C%20effective%20%7C%0D%09%09%20effective%20%3A%3D%20Processor%20activeProcess%20effectiveProcess.%0D%09%09%20%22active%20%3D%3D%20effective%22%0D%09%09%20value%20%3A%3D%20primitiveIndex%20%3D%20186%0D%09%09%09%09%09ifTrue%3A%20%5Breceiver%20primitiveEnterCriticalSectionOnBehalfOf%3A%20effective%5D%0D%09%09%09%09%09ifFalse%3A%20%5Breceiver%20primitiveTestAndSetOwnershipOfCriticalSectionOnBehalfOf%3A%20effective%5D.%0D%09%09%20%5E%28self%20isPrimFailToken%3A%20value%29%0D%09%09%09ifTrue%3A%20%5Bvalue%5D%0D%09%09%09ifFalse%3A%20%5Bself%20push%3A%20value%5D%5D.%0D%0D%09primitiveIndex%20%3D%20188%20ifTrue%3A%09%22Object%3E%3EwithArgs%3AexecuteMethod%3A%0D%09%09%09%09%09%09%09%09%09CompiledMethod%20class%3E%3Ereceiver%3AwithArguments%3AexecuteMethod%3A%0D%09%09%09%09%09%09%09%09%09VMMirror%3E%3EifFail%3Aobject%3Awith%3AexecuteMethod%3A%20et%20al%22%0D%09%09%5B%7C%20n%20args%20methodArg%20thisReceiver%20%7C%0D%09%09%20%28%28n%20%3A%3D%20arguments%20size%29%20between%3A%202%20and%3A%204%29%20ifFalse%3A%0D%09%09%09%5B%5Eself%20class%20primitiveFailTokenFor%3A%20%23%27unsupported%20operation%27%5D.%0D%09%09%20%28%28self%20objectClass%3A%20%28args%20%3A%3D%20arguments%20at%3A%20n%20-%201%29%29%20%3D%3D%20Array%0D%09%09%20%20and%3A%20%5B%28self%20objectClass%3A%20%28methodArg%20%3A%3D%20arguments%20at%3A%20n%29%29%20includesBehavior%3A%20CompiledMethod%5D%29%20ifFalse%3A%0D%09%09%09%5B%5Eself%20class%20primitiveFailTokenFor%3A%20%23%27bad%20argument%27%5D.%0D%09%09%20methodArg%20numArgs%20%3D%20args%20size%20ifFalse%3A%0D%09%09%09%5B%5Eself%20class%20primitiveFailTokenFor%3A%20%23%27bad%20number%20of%20arguments%27%5D.%0D%09%09%20thisReceiver%20%3A%3D%20arguments%20at%3A%20n%20-%202%20ifAbsent%3A%20%5Breceiver%5D.%0D%09%09%20methodArg%20primitive%20%3E%200%20ifTrue%3A%0D%09%09%09%5BmethodArg%20isQuick%20ifTrue%3A%0D%09%09%09%09%5B%5Eself%20push%3A%20%28methodArg%20valueWithReceiver%3A%20thisReceiver%20arguments%3A%20args%29%5D.%0D%09%09%09%20%5Eself%20doPrimitive%3A%20methodArg%20primitive%20method%3A%20meth%20receiver%3A%20thisReceiver%20args%3A%20args%5D.%0D%09%09%20%5EContext%0D%09%09%09sender%3A%20self%0D%09%09%09receiver%3A%20thisReceiver%0D%09%09%09method%3A%20methodArg%0D%09%09%09arguments%3A%20args%5D.%0D%0D%09primitiveIndex%20%3D%20118%20ifTrue%3A%20%22%5Breceiver%3A%5DtryPrimitive%3AwithArgs%3A%3B%20avoid%20recursing%20in%20the%20VM%22%0D%09%09%5B%28arguments%20size%20%3D%203%0D%09%09%20%20and%3A%20%5B%28self%20objectClass%3A%20arguments%20second%29%20%3D%3D%20SmallInteger%0D%09%09%20%20and%3A%20%5B%28self%20objectClass%3A%20arguments%20last%29%20%3D%3D%20Array%5D%5D%29%20ifTrue%3A%0D%09%09%09%5B%5Eself%20doPrimitive%3A%20arguments%20second%20method%3A%20meth%20receiver%3A%20arguments%20first%20args%3A%20arguments%20last%5D.%0D%09%09%20%28arguments%20size%20%3D%202%0D%09%09%20and%3A%20%5B%28self%20objectClass%3A%20arguments%20first%29%20%3D%3D%20SmallInteger%0D%09%09%20and%3A%20%5B%28self%20objectClass%3A%20arguments%20last%29%20%3D%3D%20Array%5D%5D%29%20ifFalse%3A%0D%09%09%09%5B%5Eself%20class%20primitiveFailTokenFor%3A%20nil%5D.%0D%09%09%20%5Eself%20doPrimitive%3A%20arguments%20first%20method%3A%20meth%20receiver%3A%20receiver%20args%3A%20arguments%20last%5D.%0D%0D%09value%20%3A%3D%20primitiveIndex%20%3D%20120%20%22FFI%20method%22%0D%09%09%09%09ifTrue%3A%20%5B%28meth%20literalAt%3A%201%29%20tryInvokeWithArguments%3A%20arguments%5D%0D%09%09%09%09ifFalse%3A%0D%09%09%09%09%09%5BprimitiveIndex%20%3D%20117%20%22named%20primitives%22%0D%09%09%09%09%09%09ifTrue%3A%20%5Bself%20tryNamedPrimitiveIn%3A%20meth%20for%3A%20receiver%20withArgs%3A%20arguments%5D%0D%09%09%09%09%09%09ifFalse%3A%20%22should%20use%20self%20receiver%3A%20receiver%20tryPrimitive%3A%20primitiveIndex%20withArgs%3A%20arguments%20but%20this%20is%20only%20in%20later%20VMs%20%28and%20appears%20to%20be%20broken%29%22%0D%09%09%09%09%09%09%09%5Breceiver%20tryPrimitive%3A%20primitiveIndex%20withArgs%3A%20arguments%5D%5D.%0D%0D%09%5E%28self%20isPrimFailToken%3A%20value%29%0D%09%09ifTrue%3A%20%5Bvalue%5D%0D%09%09ifFalse%3A%20%5Bself%20push%3A%20value%5D%06%07private%06%21doPrimitive%3Amethod%3Areceiver%3Aargs%3A%06%07Context%11%12ct%203%2F20%2F2021%2019%3A02')}
user: ''
passwd: ''

Hm ... does the server really need the entire source string? In theory, a hash or method timestamp or just the signature should suffice, shouldn't it? :-)

Best,
Christoph


Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

Christoph Thiede
Hmm ... Confusingly, the error message still persists when I manually
truncate the source in the method definition. On the other hand, the feature
works fine for other methods such as String >> #asInteger. Is the request
limit just way too low? Could you maybe increase this limitation?

Best,
Christoph



-----
Carpe Squeak!
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

marcel.taeumel
Hi Christoph,

"request URI too large" might be unrelated to the stuff put into the request header (here "mc-definition").

Best,
Marcel

Am 16.04.2021 14:49:59 schrieb Christoph Thiede <[hidden email]>:

Hmm ... Confusingly, the error message still persists when I manually
truncate the source in the method definition. On the other hand, the feature
works fine for other methods such as String >> #asInteger. Is the request
limit just way too low? Could you maybe increase this limitation?

Best,
Christoph



-----
Carpe Squeak!
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html



Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

Levente Uzonyi
In reply to this post by Christoph Thiede
The problem is that the service is implemented as a GET request instead
of a POST or PUT request, so data can only be encoded in the URL.
Like most web servers, nginx has an upper limit on the length of the URLs
accepted (though it's implicit in case of nginx).
And even though the accepted maximum length could be increased, there
would still be cases where the error occurs.
The right solution is to implement this as a POST or a PUT service.


Levente

On Fri, 16 Apr 2021, Christoph Thiede wrote:

> Hmm ... Confusingly, the error message still persists when I manually
> truncate the source in the method definition. On the other hand, the feature
> works fine for other methods such as String >> #asInteger. Is the request
> limit just way too low? Could you maybe increase this limitation?
>
> Best,
> Christoph
>
>
>
> -----
> Carpe Squeak!
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

codefrau
The argument to the server call is serializing the whole definition:

serializeForRequest: aMCDefinition
^ ((ReferenceStream on: (RWBinaryOrTextStream on: ByteArray new)) nextPut: aMCDefinition ; yourself) contents asString encodeForHTTP

So either, as Levente suggests, it needs to be POSTed which allows larger data, or something smaller needs to be posted to the server, like MCDefinition>>description. Either way, it sounds like both server and client need to be touched for this.

–Vanessa–

On Fri, Apr 16, 2021 at 4:17 PM Levente Uzonyi <[hidden email]> wrote:
The problem is that the service is implemented as a GET request instead
of a POST or PUT request, so data can only be encoded in the URL.
Like most web servers, nginx has an upper limit on the length of the URLs
accepted (though it's implicit in case of nginx).
And even though the accepted maximum length could be increased, there
would still be cases where the error occurs.
The right solution is to implement this as a POST or a PUT service.


Levente

On Fri, 16 Apr 2021, Christoph Thiede wrote:

> Hmm ... Confusingly, the error message still persists when I manually
> truncate the source in the method definition. On the other hand, the feature
> works fine for other methods such as String >> #asInteger. Is the request
> limit just way too low? Could you maybe increase this limitation?
>
> Best,
> Christoph
>
>
>
> -----
> Carpe Squeak!
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html



Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

marcel.taeumel
+1 for using POST (if it is easier to implement... Chris?)

Best,
Marcel

Am 17.04.2021 05:11:17 schrieb Vanessa Freudenberg <[hidden email]>:

The argument to the server call is serializing the whole definition:

serializeForRequest: aMCDefinition
^ ((ReferenceStream on: (RWBinaryOrTextStream on: ByteArray new)) nextPut: aMCDefinition ; yourself) contents asString encodeForHTTP

So either, as Levente suggests, it needs to be POSTed which allows larger data, or something smaller needs to be posted to the server, like MCDefinition>>description. Either way, it sounds like both server and client need to be touched for this.

–Vanessa–

On Fri, Apr 16, 2021 at 4:17 PM Levente Uzonyi <[hidden email]> wrote:
The problem is that the service is implemented as a GET request instead
of a POST or PUT request, so data can only be encoded in the URL.
Like most web servers, nginx has an upper limit on the length of the URLs
accepted (though it's implicit in case of nginx).
And even though the accepted maximum length could be increased, there
would still be cases where the error occurs.
The right solution is to implement this as a POST or a PUT service.


Levente

On Fri, 16 Apr 2021, Christoph Thiede wrote:

> Hmm ... Confusingly, the error message still persists when I manually
> truncate the source in the method definition. On the other hand, the feature
> works fine for other methods such as String >> #asInteger. Is the request
> limit just way too low? Could you maybe increase this limitation?
>
> Best,
> Christoph
>
>
>
> -----
> Carpe Squeak!
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html



Reply | Threaded
Open this post in threaded view
|

Re: "Browse revisions" server error for long methods

codefrau
Well, class + selector + author initials / time stamp should be enough to identify the method on the server. Sending the whole source code with it seems unnecessary. 

–Vanessa –

On Sat, Apr 17, 2021 at 06:04 Marcel Taeumel <[hidden email]> wrote:
+1 for using POST (if it is easier to implement... Chris?)

Best,
Marcel

Am 17.04.2021 05:11:17 schrieb Vanessa Freudenberg <[hidden email]>:

The argument to the server call is serializing the whole definition:

serializeForRequest: aMCDefinition
^ ((ReferenceStream on: (RWBinaryOrTextStream on: ByteArray new)) nextPut: aMCDefinition ; yourself) contents asString encodeForHTTP

So either, as Levente suggests, it needs to be POSTed which allows larger data, or something smaller needs to be posted to the server, like MCDefinition>>description. Either way, it sounds like both server and client need to be touched for this.

–Vanessa–

On Fri, Apr 16, 2021 at 4:17 PM Levente Uzonyi <[hidden email]> wrote:
The problem is that the service is implemented as a GET request instead
of a POST or PUT request, so data can only be encoded in the URL.
Like most web servers, nginx has an upper limit on the length of the URLs
accepted (though it's implicit in case of nginx).
And even though the accepted maximum length could be increased, there
would still be cases where the error occurs.
The right solution is to implement this as a POST or a PUT service.


Levente

On Fri, 16 Apr 2021, Christoph Thiede wrote:

> Hmm ... Confusingly, the error message still persists when I manually
> truncate the source in the method definition. On the other hand, the feature
> works fine for other methods such as String >> #asInteger. Is the request
> limit just way too low? Could you maybe increase this limitation?
>
> Best,
> Christoph
>
>
>
> -----
> Carpe Squeak!
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html