AW: [mod_python] Multiple submissions from the same user

Sean Allen sean at monkeysnatchbanana.com
Sat Apr 5 17:46:44 EDT 2008


On Apr 5, 2008, at 10:31 AM, <Dominique.Holzwarth at ch.delarue.com> <Dominique.Holzwarth at ch.delarue.com 
 > wrote:
> Your idea with locking might be a point in general, however it's not  
> really want I to be honest. Think about a form that has a "show"  
> button which sends a request to the server to get same data and  
> display it to the user (as new html answer). Then what I'd like to  
> have is that the user just can't hit that show button like 1000x in  
> 1 sec so that a new request is started before a previous one is  
> actually transferred back to the user.
> As it makes no sense to "spam click" that show button (just as an  
> example) it also makes no sense to me to blow up my scripts just do  
> handle that case.
> So what I was wondering about was if there's some sort of mechanism  
> within apache or mod_python itself to simply ignore requests from  
> the same user when a request for that user is still being processed.
> I know you can limit stuff like "maxClient" and "ThreadsPerChild"  
> and "maxThreads" which is somehow related to how requests are being  
> processed. But I have to admit that I dont really understand it to  
> the fullest, so thats why I was asking here... ;-)

This is a bug in your code.

If you can't handle 2 requests coming in from same session w/o  
crashing, that is a bug in your code.
Saying you dont like the solution isnt really going to help you. You  
are basically asking for a crutch
to support buggy code. Even if there was a crutch to give, it is still  
just a crutch.

You are going to have to do some form of locking. The solution of  
doing it right there in the code
as suggested is going to be the least painful way to deal with it. If  
you consider that blowing up
your code, well, then yes, you do need to blow up your code. Code that  
dies when it gets
unexpected input is bad code.

As to this:

'So what I was wondering about was if there's some sort of mechanism  
within apache or mod_python itself to simply ignore requests from the  
same user '

User is an application level term. It means nothing to something like  
mod_python, mod_perl or any other lower level tool. mod_python exists  
inside an apache process, that process and mod_python are concerned  
with connections, stateless connections I might add, not with users. 


More information about the Mod_python mailing list