Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-23 Thread Marc Kaufmann
Yeah, I realized that after George's message.

I also now searched the Github for the message and found this:

```
#:manager
[manager
(make-threshold-LRU-manager
(lambda (request)
(response/xexpr
`(html (head (title "Page Has Expired."))
(body (p "Sorry, this page has expired. Please go back.")
(* 128 1024 1024))]
```

It seems this calls the serve/servlet not with the argument #f, but with
the error message I find. Presumably this serve/servlet gets called by
default, since I changed nothing yet get that error message? At least I
have finally figured out what I need configuring.

Link to search:
https://github.com/racket/racket/search?q=serve%2Fservlet_q=serve%2Fservlet

Thanks everybody, that was quite helpful.

Cheers,
Marc

On Mon, Dec 23, 2019 at 3:28 PM Sam Tobin-Hochstadt 
wrote:

> The default is documented here:
>
> https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
> as the default value for the `#:manager` argument.
>
> The default handler is `#f`, which produces the behavior you see. You
> can provide a different `request? -> response?` function instead.
>
> On Mon, Dec 23, 2019 at 6:55 AM Marc Kaufmann 
> wrote:
> >
> > In order to do everything as I do now - where I have been blissfully
> unaware of the managers - I do
> >
> > ```
> > (define the-manager-with-threshold (make-threshold-LRU-manager
> what-is-this-instance-expiration-handler? (* 512 1024 1024)))
> >
> > (serve/servlet start ...  ... #:manager
> the-manager-with-threshold)
> > ```
> > and this would set the threshold to roughly 512 MB, rather than 130MB?
> By the way, where does it say that the default is 130MB?
> >
> > Can I set the instance-expiration-manager to #f and that is the place
> where it generates the 'Sorry, this page link has expired' error? So I
> could provide a more meaningful error message there? Or better not, since
> it does more work behind the scenes?
> >
> > Cheers,
> > Marc
> >
> > On Sun, Dec 22, 2019 at 9:58 PM Philip McGrath 
> wrote:
> >>
> >> You can probably use `make-threshold-LRU-manager` with a much higher
> memory threshold than the default from `serve/servlet`, which is about 130
> MB. The manager will start expiring continuations at that threshold even if
> you have lots of RAM available.
> >>
> >> -Philip
> >>
> >> On Sat, Dec 21, 2019 at 3:31 PM George Neuner 
> wrote:
> >>>
> >>>
> >>> On 12/21/2019 4:38 AM, Marc Kaufmann wrote:
> >>>
> >>>
>  Did you perhaps change the continuation manager - or its setup?
> 
> https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29
> 
> >>>
> >>> No, not really. I simply import send/suspend/dispatch etc and use them
> without doing anything in particular. I am requiring them within
> typed/racket if that matters via require/typed. So I have no idea where to
> configure the continuation manager - I don't even know where the current
> one is.
> >>>
> >>>
> >>> If you started from serve/servlet - and didn't specify differently -
> then you are using the default LRU continuation manager.   If the load
> spikes, it will drop saved continuations to get memory use back under
> control.
> >>>
> >>>
> https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
> >>>
> https://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29
> >>>
> >>>
> >>> You can specify to use a different manager (including a custom one) in
> the call to serve/servlet.
> >>>
> >>>
> >>> George
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> >>> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/f974666a-3e1a-3cd8-d371-09e9a283a157%40comcast.net
> .
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAD7_NO7G%3DY_Q48_pfTYknpPCrfULRL3-yoCzqMVH0at372P0Uw%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAD7_NO4hU2%3D_kUCQVuDXccS-xGLpfjkyOOmuBHcWfPsS3Drrbw%40mail.gmail.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-23 Thread Sam Tobin-Hochstadt
The default is documented here:
https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
as the default value for the `#:manager` argument.

The default handler is `#f`, which produces the behavior you see. You
can provide a different `request? -> response?` function instead.

On Mon, Dec 23, 2019 at 6:55 AM Marc Kaufmann  wrote:
>
> In order to do everything as I do now - where I have been blissfully unaware 
> of the managers - I do
>
> ```
> (define the-manager-with-threshold (make-threshold-LRU-manager 
> what-is-this-instance-expiration-handler? (* 512 1024 1024)))
>
> (serve/servlet start ...  ... #:manager 
> the-manager-with-threshold)
> ```
> and this would set the threshold to roughly 512 MB, rather than 130MB? By the 
> way, where does it say that the default is 130MB?
>
> Can I set the instance-expiration-manager to #f and that is the place where 
> it generates the 'Sorry, this page link has expired' error? So I could 
> provide a more meaningful error message there? Or better not, since it does 
> more work behind the scenes?
>
> Cheers,
> Marc
>
> On Sun, Dec 22, 2019 at 9:58 PM Philip McGrath  
> wrote:
>>
>> You can probably use `make-threshold-LRU-manager` with a much higher memory 
>> threshold than the default from `serve/servlet`, which is about 130 MB. The 
>> manager will start expiring continuations at that threshold even if you have 
>> lots of RAM available.
>>
>> -Philip
>>
>> On Sat, Dec 21, 2019 at 3:31 PM George Neuner  wrote:
>>>
>>>
>>> On 12/21/2019 4:38 AM, Marc Kaufmann wrote:
>>>
>>>
 Did you perhaps change the continuation manager - or its setup?
 https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29

>>>
>>> No, not really. I simply import send/suspend/dispatch etc and use them 
>>> without doing anything in particular. I am requiring them within 
>>> typed/racket if that matters via require/typed. So I have no idea where to 
>>> configure the continuation manager - I don't even know where the current 
>>> one is.
>>>
>>>
>>> If you started from serve/servlet - and didn't specify differently - then 
>>> you are using the default LRU continuation manager.   If the load spikes, 
>>> it will drop saved continuations to get memory use back under control.
>>>
>>> https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
>>> https://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29
>>>
>>>
>>> You can specify to use a different manager (including a custom one) in the 
>>> call to serve/servlet.
>>>
>>>
>>> George
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to racket-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/racket-users/f974666a-3e1a-3cd8-d371-09e9a283a157%40comcast.net.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAD7_NO7G%3DY_Q48_pfTYknpPCrfULRL3-yoCzqMVH0at372P0Uw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BYpQkYm%3Dd_tQ8oT9i9R3GdG%2B%3DxHj-_e9DpQSwyMiZzvMA%40mail.gmail.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-23 Thread Marc Kaufmann
Of course. I read this line of the docs:

#:manager manager

but not this one:

manager   :   manager?

  =   (make-threshold-LRU-manager

 #f (*

 128 1024 1024))


which comes a page later given how many arguments serve/servlet has. I
still haven't internalized how to read the documentation properly. Seems to
suggest the default handler is #f, so that should be OK to do.

It also means that it didn't help much that I increased the current RAM on
my server. Good to know.

On Mon, Dec 23, 2019 at 1:24 PM George Neuner  wrote:

>
> On 12/23/2019 6:54 AM, Marc Kaufmann wrote:
> > By the way, where does it say that the default is 130MB?
>
> In the docs for serve/servlet.
>
> > Can I set the instance-expiration-manager to #f and that is the place
> > where it generates the 'Sorry, this page link has expired' error? So I
> > could provide a more meaningful error message there? Or better not,
> > since it does more work behind the scenes?
>
> I don't know if you can set the handler to #f.  But you can replace it.
>
> George
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAD7_NO4GmcT7NS7H6Cgo%3D686vSNzcpdEAS80eTkq8Rg9DVDbmQ%40mail.gmail.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-23 Thread George Neuner



On 12/23/2019 6:54 AM, Marc Kaufmann wrote:

By the way, where does it say that the default is 130MB?


In the docs for serve/servlet.

Can I set the instance-expiration-manager to #f and that is the place 
where it generates the 'Sorry, this page link has expired' error? So I 
could provide a more meaningful error message there? Or better not, 
since it does more work behind the scenes?


I don't know if you can set the handler to #f.  But you can replace it.

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/758e97d9-e948-0baf-24ec-505ea56442a6%40comcast.net.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-23 Thread Marc Kaufmann
In order to do everything as I do now - where I have been blissfully
unaware of the managers - I do

```
(define the-manager-with-threshold (make-threshold-LRU-manager
what-is-this-instance-expiration-handler? (* 512 1024 1024)))

(serve/servlet start ...  ... #:manager
the-manager-with-threshold)
```
and this would set the threshold to roughly 512 MB, rather than 130MB? By
the way, where does it say that the default is 130MB?

Can I set the instance-expiration-manager to #f and that is the place where
it generates the 'Sorry, this page link has expired' error? So I could
provide a more meaningful error message there? Or better not, since it does
more work behind the scenes?

Cheers,
Marc

On Sun, Dec 22, 2019 at 9:58 PM Philip McGrath 
wrote:

> You can probably use `make-threshold-LRU-manager
> `
> with a much higher memory threshold than the default from `serve/servlet`,
> which is about 130 MB. The manager will start expiring continuations at
> that threshold even if you have lots of RAM available.
>
> -Philip
>
> On Sat, Dec 21, 2019 at 3:31 PM George Neuner 
> wrote:
>
>>
>> On 12/21/2019 4:38 AM, Marc Kaufmann wrote:
>>
>>
>> Did you perhaps change the continuation manager - or its setup?
>>>
>>> https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29
>>>
>>>
>> No, not really. I simply import send/suspend/dispatch etc and use them
>> without doing anything in particular. I am requiring them within
>> typed/racket if that matters via require/typed. So I have no idea where to
>> configure the continuation manager - I don't even know where the current
>> one is.
>>
>>
>> If you started from serve/servlet - and didn't specify differently - then
>> you are using the default LRU continuation manager.   If the load spikes,
>> it will drop saved continuations to get memory use back under control.
>>
>>-
>>
>> https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
>>-
>>
>> https://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29
>>
>>
>> You can specify to use a different manager (including a custom one) in
>> the call to serve/servlet.
>>
>>
>> George
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/f974666a-3e1a-3cd8-d371-09e9a283a157%40comcast.net
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAD7_NO7G%3DY_Q48_pfTYknpPCrfULRL3-yoCzqMVH0at372P0Uw%40mail.gmail.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-22 Thread Philip McGrath
You can probably use `make-threshold-LRU-manager
`
with a much higher memory threshold than the default from `serve/servlet`,
which is about 130 MB. The manager will start expiring continuations at
that threshold even if you have lots of RAM available.

-Philip

On Sat, Dec 21, 2019 at 3:31 PM George Neuner  wrote:

>
> On 12/21/2019 4:38 AM, Marc Kaufmann wrote:
>
>
> Did you perhaps change the continuation manager - or its setup?
>>
>> https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29
>>
>>
> No, not really. I simply import send/suspend/dispatch etc and use them
> without doing anything in particular. I am requiring them within
> typed/racket if that matters via require/typed. So I have no idea where to
> configure the continuation manager - I don't even know where the current
> one is.
>
>
> If you started from serve/servlet - and didn't specify differently - then
> you are using the default LRU continuation manager.   If the load spikes,
> it will drop saved continuations to get memory use back under control.
>
>-
>
> https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
>-
>
> https://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29
>
>
> You can specify to use a different manager (including a custom one) in the
> call to serve/servlet.
>
>
> George
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/f974666a-3e1a-3cd8-d371-09e9a283a157%40comcast.net
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAH3z3gYQWMiuBRsGR_G%3DNzN85ahf0weJHvo7XRSKZohWY3Mrzw%40mail.gmail.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-21 Thread George Neuner


On 12/21/2019 4:38 AM, Marc Kaufmann wrote:


Did you perhaps change the continuation manager - or its setup?

https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29





No, not really. I simply import send/suspend/dispatch etc and use them 
without doing anything in particular. I am requiring them within 
typed/racket if that matters via require/typed. So I have no idea 
where to configure the continuation manager - I don't even know where 
the current one is.


If you started from serve/servlet - and didn't specify differently - 
then you are using the default LRU continuation manager.   If the load 
spikes, it will drop saved continuations to get memory use back under 
control.


 * 
https://docs.racket-lang.org/web-server/run.html?q=serve%2Fservlet#%28def._%28%28lib._web-server%2Fservlet-env..rkt%29._serve%2Fservlet%29%29
 * 
https://docs.racket-lang.org/web-server/servlet.html#%28def._%28%28lib._web-server%2Fmanagers%2Flru..rkt%29._make-threshold-.L.R.U-manager%29%29


You can specify to use a different manager (including a custom one) in 
the call to serve/servlet.



George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f974666a-3e1a-3cd8-d371-09e9a283a157%40comcast.net.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-21 Thread Marc Kaufmann


> Did you perhaps change the continuation manager - or its setup? 
>
> https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29
>  
>
>
No, not really. I simply import send/suspend/dispatch etc and use them 
without doing anything in particular. I am requiring them within 
typed/racket if that matters via require/typed. So I have no idea where to 
configure the continuation manager - I don't even know where the current 
one is.

Cheers,
Marc

As to where to put your message: you can install a custom "expiration" 
> handler in the continuation manager.  Unfortunately I haven't done this 
> in a very long time, so I can't guide you through it.  Perhaps someone 
> (Jay?) knows exactly what to do. 
>
> George 
>
>
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ebf3d85d-c1e6-4de0-9b97-b1150eb1843f%40googlegroups.com.


Re: [racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-20 Thread George Neuner



On 12/20/2019 8:45 AM, Marc Kaufmann wrote:
reading a past thread started by me, I realize that I should have 
learned how to implement Philip's advice on using stateless 
continuations, but well I didn't. So I still use vanilla 
`send/suspend/dispatch` and hence my users hit the "Sorry, this page 
has expired. Please go back." The quick fix is to tell them that they 
should go to page xyz.com. But I don't know how I can easily change 
this error message to add a link. Anyone?


I'm about to leave for travel or else I would have done some digging 
around.


PS: For some reason I keep hitting these errors faster than in the 
past - as in, within a few minutes. Any idea why that might be and how 
to increase the time? I can crank up the RAM of the machine too, 
anything that cuts down on developer time really. I'll be back in the 
new year to actually fix this, but not now.


Did you perhaps change the continuation manager - or its setup?
https://docs.racket-lang.org/web-server/servlet.html?q=ffi#%28part._managers%29

As to where to put your message: you can install a custom "expiration" 
handler in the continuation manager.  Unfortunately I haven't done this 
in a very long time, so I can't guide you through it.  Perhaps someone 
(Jay?) knows exactly what to do.


George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/85246bf7-7ba3-1d21-e6d0-17846a9bd498%40comcast.net.


[racket-users] Change error message of web server continuations from "Sorry, this page has expired. Please go back."

2019-12-20 Thread Marc Kaufmann
Hi all,

reading a past thread started by me, I realize that I should have learned 
how to implement Philip's advice on using stateless continuations, but well 
I didn't. So I still use vanilla `send/suspend/dispatch` and hence my users 
hit the "Sorry, this page has expired. Please go back." The quick fix is to 
tell them that they should go to page xyz.com. But I don't know how I can 
easily change this error message to add a link. Anyone?

I'm about to leave for travel or else I would have done some digging around.

Cheers,
Marc

PS: For some reason I keep hitting these errors faster than in the past - 
as in, within a few minutes. Any idea why that might be and how to increase 
the time? I can crank up the RAM of the machine too, anything that cuts 
down on developer time really. I'll be back in the new year to actually fix 
this, but not now.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/31aed0b4-c9df-4ccb-9e10-92df3dd3952c%40googlegroups.com.