Zinc Callback Limit

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

Zinc Callback Limit

Mark Smith
Hi all,

I realise that this might not be typical usage however I have an application with a lot of checkboxes, well over 100, and have run into a small problem using the ZnZincServerAdaptor. When the form is submitted, by clicking the submit button, the final callback isn't executed, and the server appears to drop the connection.

The following reliably replicates the issue –

renderContentOn: html
        html form: [
                (1 to: 256) do: [ :aNumber |
                        html checkbox
                                callback: [ :aValue | ].
                        html
                                space;
                                text: 'checkbox', aNumber asString;
                                break ].
                html submitButton
                        callback: [
                                self inform: 'clicked' ];
                        value: 'click' ]

Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.

Unfortunately that's as far as I've got :).

Does anyone have any suggestions?

All the best,

Mark_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Philippe Marschall
On Mon, May 14, 2012 at 9:22 PM, Mark Smith
<[hidden email]> wrote:

> Hi all,
>
> I realise that this might not be typical usage however I have an application with a lot of checkboxes, well over 100, and have run into a small problem using the ZnZincServerAdaptor. When the form is submitted, by clicking the submit button, the final callback isn't executed, and the server appears to drop the connection.
>
> The following reliably replicates the issue –
>
> renderContentOn: html
>        html form: [
>                (1 to: 256) do: [ :aNumber |
>                        html checkbox
>                                callback: [ :aValue | ].
>                        html
>                                space;
>                                text: 'checkbox', aNumber asString;
>                                break ].
>                html submitButton
>                        callback: [
>                                self inform: 'clicked' ];
>                        value: 'click' ]
>
> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>
> Unfortunately that's as far as I've got :).
>
> Does anyone have any suggestions?
Can you check out

http://127.0.0.1:8080/tests/functional/WALotsaLinksFunctionalTest

Cheers
Philippe

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Sven Van Caekenberghe
In reply to this post by Mark Smith
Hi Mark,

On 14 May 2012, at 21:22, Mark Smith wrote:

> Hi all,
>
> I realise that this might not be typical usage however I have an application with a lot of checkboxes, well over 100, and have run into a small problem using the ZnZincServerAdaptor. When the form is submitted, by clicking the submit button, the final callback isn't executed, and the server appears to drop the connection.
>
> The following reliably replicates the issue –
>
> renderContentOn: html
> html form: [
> (1 to: 256) do: [ :aNumber |
> html checkbox
> callback: [ :aValue | ].
> html
> space;
> text: 'checkbox', aNumber asString;
> break ].
> html submitButton
> callback: [
> self inform: 'clicked' ];
> value: 'click' ]
>
> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>
> Unfortunately that's as far as I've got :).
>
> Does anyone have any suggestions?

Yes, this is part of Zn server protecting itself against general resource overconsumption as well as against a well-known, recently discovered attack vector. This is hardcoded at ZnConstants class>>#maximumNumberOfDictionaryEntries to 256.

You could overwrite it. In any case, you are the first one hitting the limit ;-)

Sven

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Philippe Marschall
On Mon, May 14, 2012 at 9:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:

> Hi Mark,
>
> On 14 May 2012, at 21:22, Mark Smith wrote:
>
>> Hi all,
>>
>> I realise that this might not be typical usage however I have an application with a lot of checkboxes, well over 100, and have run into a small problem using the ZnZincServerAdaptor. When the form is submitted, by clicking the submit button, the final callback isn't executed, and the server appears to drop the connection.
>>
>> The following reliably replicates the issue –
>>
>> renderContentOn: html
>>       html form: [
>>               (1 to: 256) do: [ :aNumber |
>>                       html checkbox
>>                               callback: [ :aValue | ].
>>                       html
>>                               space;
>>                               text: 'checkbox', aNumber asString;
>>                               break ].
>>               html submitButton
>>                       callback: [
>>                               self inform: 'clicked' ];
>>                       value: 'click' ]
>>
>> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>>
>> Unfortunately that's as far as I've got :).
>>
>> Does anyone have any suggestions?
>
> Yes, this is part of Zn server protecting itself against general resource overconsumption as well as against a well-known, recently discovered attack vector. This is hardcoded at ZnConstants class>>#maximumNumberOfDictionaryEntries to 256.

It's checkboxes, not links, I overlooked that at first. Makes sense now.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Paul DeBruicker
In reply to this post by Mark Smith
On 05/14/2012 12:22 PM, Mark Smith wrote:
> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>
> Unfortunately that's as far as I've got:).
>
> Does anyone have any suggestions?

Other than increasing the limit like Sven suggests if you can use jQuery
you could:

1. In your component create a callback dictionary in an inst var with a
randomly chosen id # as the key and each checkbox's callback as the value.
2. Assign the id # as the html id for the checkbox.
3. Set a onclick handler on a div that contains the checkboxes that
posts the callback id # when it is clicked and triggers just one
callback in your seaside app.
4. have the container div callback in your seaside app lookup which
checkbox callback to run from the dictionary in step 1 and run the
checkbox callback.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Mark Smith
In reply to this post by Sven Van Caekenberghe
On 14 May 2012, at 20:50, Sven Van Caekenberghe wrote:

> Hi Mark,
>
> On 14 May 2012, at 21:22, Mark Smith wrote:
>
>> Hi all,
>>
>> I realise that this might not be typical usage however I have an application with a lot of checkboxes, well over 100, and have run into a small problem using the ZnZincServerAdaptor. When the form is submitted, by clicking the submit button, the final callback isn't executed, and the server appears to drop the connection.
>>
>> The following reliably replicates the issue –
>>
>> renderContentOn: html
>> html form: [
>> (1 to: 256) do: [ :aNumber |
>> html checkbox
>> callback: [ :aValue | ].
>> html
>> space;
>> text: 'checkbox', aNumber asString;
>> break ].
>> html submitButton
>> callback: [
>> self inform: 'clicked' ];
>> value: 'click' ]
>>
>> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>>
>> Unfortunately that's as far as I've got :).
>>
>> Does anyone have any suggestions?
>
> Yes, this is part of Zn server protecting itself against general resource overconsumption as well as against a well-known, recently discovered attack vector. This is hardcoded at ZnConstants class>>#maximumNumberOfDictionaryEntries to 256.

Thanks Sven :). That makes a lot of sense. 256 seems like a good limit.

> You could overwrite it. In any case, you are the first one hitting the limit ;-)

When I have more time I might try to redesign the application so that it doesn't present quite so many checkboxes at one time ;).

> Sven
>
> --
> Sven Van Caekenberghe
> http://stfx.eu
> Smalltalk is the Red Pill
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc Callback Limit

Mark Smith
In reply to this post by Paul DeBruicker

On 14 May 2012, at 21:18, Paul DeBruicker wrote:

> On 05/14/2012 12:22 PM, Mark Smith wrote:
>> Although the exact number of fields/callbacks needed seems to vary. I arrived at 256 by a binary search.
>>
>> Unfortunately that's as far as I've got:).
>>
>> Does anyone have any suggestions?
>
> Other than increasing the limit like Sven suggests if you can use jQuery you could:
>
> 1. In your component create a callback dictionary in an inst var with a randomly chosen id # as the key and each checkbox's callback as the value.
> 2. Assign the id # as the html id for the checkbox.
> 3. Set a onclick handler on a div that contains the checkboxes that posts the callback id # when it is clicked and triggers just one callback in your seaside app.
> 4. have the container div callback in your seaside app lookup which checkbox callback to run from the dictionary in step 1 and run the checkbox callback.

That seems like a good suggestion. I'll look into doing that :).

Thanks.

> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside