[Ur] redirect breaks channels

Sergey Mironov grrwlf at gmail.com
Sat Dec 28 13:38:33 EST 2013


>
> I've added the error checking you suggested: an exception will be raised on
> trying to read another client's channel.  In the process, I also fixed some
> issues with proper association of page requests with clients, so that the
> error should occur less often.  For now, I'm not convinced that the API
> itself should change, considering the explanation in the manual.
>
>
> I managed to reproduce the problem, which only manifested for me after a
> fatal error in a page handler.  It was an issue related to a
> benchmark-inspired optimization I added recently, and not anything specific
> to a database system or anything that only shows up under high concurrency
> or weird disk configuration.  It should be fixed now; let me know if it
> recurs.
>

That's clear, thanks for the support!

>
>> Looks like latest urweb can't compile channel2.ur anymore. It says
>>
>> dev:[grwlf at greyblade:~/proj/urweb/tests]$ urweb -dbms sqlite channel2
>> :0:0: (to 0:0) Function Channel2/monitor needed for both a link and a form
>> Make sure that the signature of the containing module hides any form
>> handlers.
>> :0:0: (to 0:0) Function Channel2/put needed for both a link and a form
>> Make sure that the signature of the containing module hides any form
>> handlers.
>>
>> Channel2.ur doesn't use any forms so it is probably a regression, is it?
>>
>
>
> I'm surprised if a previous Ur/Web version compiled this source code without
> complaint.  The behavior you're seeing is expected, for reasons explained in
> Section 10 of the manual.
>
> Executive summary: any properly typed function exported from a program's
> main module is treated as accessible via GET requests.  However, RFCs say
> that GET requests shouldn't cause side effects.  One fix is to add a .urs
> file that only exposes the entry points you really intended.  (As a bonus,
> this should also enable you to remove [: transaction page] annotations in
> the .ur file!)

Yes, the problem can be solved by adding channel2.urs containing
'main' signature only.  Unfortunately, I have at least one more test
which I can't compile anymore because of similar errors. This
application is rather complex so I don't plan to post it here, but it
contains a single 'main' function without forms and redirects, only
with  back-links to itself (via <a link={main {}}>back</a>).   That is
why I think that urweb become too suspicious.  As far as I understand
the idea correctly, adding 'safeGet' should be enough to export
'Channel2/monitor' and 'Channel2/put'. Could you please explain this
point in more details if I am wrong? In the end, it is strange to see
error messages mentioning forms because channel2.ur contains no forms!

Regards,
Sergey



More information about the Ur mailing list