Ah! No man!

If thats the answer , then the answer is wrong!

Security observation. "Bug" is another name for "Vunerability".

Example. If that mysql insert is not particularly atomic, and remember we
are probably talking mysql without transactions, a half done insert set
might whack the db. DoS with the submit button!

Now. Relying on javascript to stop this happening is naive imho. Firstly
because many browsers wont respect that javascript. I disable j-script on
my browser, cos I'm tired of popups. Consequently it wont work on my
machine or others.

Secondly relying on the honesty or otherwise of the browser is just not
sane. Ie.. Javascript validation considered harmful! Particularly if
someone *wants* to mess with the system.

There is a solution I *think*

What I suspect is happect is happening here, is the mysql cursor is being
created in a global context.

Then webware starts threading it. Now at this stage I'm *convinced* the
cursor is NOT threadsafe.
Theres good reason too. A db cursor essentially keeps stateful info on
where the querys and stuff are 'at'.
So if thread #1 is in a diferent stage of life cycle and using the cursor
then if thread #2 molests the cursor, it'll upset thread #1.

The answer is to either aquire a threadlock around cursor usage , or if
that does not work, then use multiple cursors (which might punish mysql.

Now If I understand correctly somewhere out there there is a db cursor
pooling library. That might hold the key.

Ciao, shayne.





--
Shayne O'Neill
http://perth.indymedia.org
I know how hard it is for you to put food on your family."
 ----George W. Bush

On Thu, 8 Apr 2004, jose wrote:

> I remember seeing this in the discussion before, try and search the
> list, If I remember correctly I think the answer was to use JavaScript
> to first disable the button (can't hit it more then once if it's not
> there) and then send the data.
>
> Jose
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Eduardo Elgueta
> Sent: Thursday, April 08, 2004 3:46 PM
> To: [EMAIL PROTECTED]
> Cc: webware-discuss
> Subject: Re: [Webware-discuss] WebKit dies
>
>
> David,
>
> Thank you for your answer, but I'm not using that method. In fact, it's
> a simple form that works pretty well most of the time.
>
> The problem is some users (don't ask me why) double-click submit
> buttons. Usually they receive an error message (because the record was
> already updated), but sometimes happens the problem I described.
>
> Anyway, I'll review my code again.
>
> Ed.
>
> David London wrote:
>
> >Eduardo,
> >Just looking at the error message I would be tempted to say that you
> >are experiencing a similar problem to what I had discovered. What I had
>
> >found was that if all of your code was in the context directory and you
>
> >were using forwarding or callMethodOfServlet on a derived class
> >something went wrong with the import and produced a similar set of
> >error messages. There were 2 possible fixes; 1) use the CVS versions of
>
> >Webkit (or at least ServletFactory.py) or 2) move all of the source
> >code into a subdirectory of the context. Why option 2 works is a
> >mystery to me, but it did.
> >
> >Although I ended up with an error message, not a crash.
> >
> >Best of Luck
> >David London
> >
> >On Thu, 2004-04-08 at 15:56, Eduardo Elgueta wrote:
> >
> >
> >>Hi All,
> >>
> >>WebKit dies with no error message when a user presses repeatedly the
> >>submit button (the user can press the button two or three times before
>
> >>receiving an error message from Apache).
> >>
> >>The page in question saves posted form data to a MySQL database using
> >>MySQLdb.
> >>
> >>Sometimes, the following error message (in Errors.csv) is recorded
> >>just
> >>before crashing:
> >>
> >>"Thu Apr  8 15:52:12
> >>2004","Input.py","/home/webwadmin/ww_apps/environ/Input.py","_mysql_ex
> ceptions.OperationalError","(2013,
> >>'Lost connection to MySQL server during
> >>query')","/home/webwadmin/ww_apps/ErrorMsgs/Error-Input.py-2004-04-08-
> 15-52-12-44505.html"
> >>
> >>This is the traceback:
> >>
> >>[Thu Apr  8 15:52:42 2004] [error] WebKit: Error while executing
> >>script
> >>/home/webwadmin/ww_apps/environ/Input.py
> >>Traceback (most recent call last):
> >>  File "/usr/local/Webware-0.8.1/WebKit/Application.py", line 415, in
> >>dispatchRequest
> >>    self.handleGoodURL(transaction)
> >>  File "/usr/local/Webware-0.8.1/WebKit/Application.py", line 567, in
> >>handleGoodURL
> >>    self.respond(transaction)
> >>  File "/usr/local/Webware-0.8.1/WebKit/Application.py", line 776, in
> >>respond
> >>    transaction.respond()
> >>  File "/usr/local/Webware-0.8.1/WebKit/Transaction.py", line 105, in
> >>respond
> >>    self._servlet.respond(self)
> >>  File "/usr/local/Webware-0.8.1/WebKit/HTTPServlet.py", line 38, in
> respond
> >>    method(trans)
> >>  File "/home/webwadmin/ww_apps/navix/NvxStdPage.py", line 13, in
> >>respondToPost
> >>    self._respond(transaction)
> >>  File "/usr/local/Webware-0.8.1/WebKit/Page.py", line 73, in _respond
> >>    self.writeHTML()
> >>  File "/usr/local/Webware-0.8.1/WebKit/Page.py", line 135, in
> writeHTML
> >>    self.writeBody()
> >>  File "/usr/local/Webware-0.8.1/WebKit/Page.py", line 204, in
> writeBody
> >>    self.writeBodyParts()
> >>  File "/home/webwadmin/ww_apps/environ/InnerPage.py", line 40, in
> >>writeBodyParts
> >>    EnvStdPage.writeBodyParts(self)
> >>  File "/home/webwadmin/ww_apps/navix/NvxStdPage.py", line 42, in
> >>writeBodyParts
> >>    self.writeContent()
> >>  File "/home/webwadmin/ww_apps/environ/Input.py", line 76, in
> writeContent
> >>    self.samp = DBSample(self.ses)
> >>  File "/home/webwadmin/ww_apps/environ/AppObjects.py", line 103, in
> >>__init__
> >>    NvxDBObject.__init__(self, ses, 'sample')
> >>  File "/home/webwadmin/ww_apps/navix/NvxDBObject.py", line 21, in
> __init__
> >>    self.loadDescription()
> >>  File "/home/webwadmin/ww_apps/navix/NvxDBObject.py", line 26, in
> >>loadDescription
> >>    c.execute(qry)
> >>  File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", line 61,
>
> >>in execute
> >>    r = self._query(query)
> >>  File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", line
> 168,
> >>in _query
> >>    rowcount = self._BaseCursor__do_query(q)
> >>  File "/usr/lib/python2.2/site-packages/MySQLdb/cursors.py", line
> 112,
> >>in __do_query
> >>    db.query(q)
> >>OperationalError: (2013, 'Lost connection to MySQL server during
> query')
> >>
> >>Any hints, suggestions, pointers? Is there any "debug mode" available
> >>for webki?
> >>
> >>TIA,
> >>
> >>Ed.
> >>
> >>
> >
> >
> >
>
> --
> Eduardo Elgueta
> Senior Consultant
> Navix
>
> correo/email: [EMAIL PROTECTED]
> tel�fono/phone: +56 (2) 209-8905
> celular/mobile: +56 (9) 821-0033
> web: www.navix.cl
>
> Av. Pedro de Valdivia 555 Of. 216
> Providencia 7500913
> Santiago, Chile
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick
> _______________________________________________
> Webware-discuss mailing list [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to