Re: [Zope] Zope-killer: zSQL method that crashes Zope

2000-07-21 Thread Daniel Rusch

If it matters to anyone, Andy isn't the only one with Zope killing ZSQL
Methods 
I just spent way too much time trying to figure out why our stage enviroment
was crashing.
Turns out to be a ZSQL method which fails. Of course it wasn't wrapped in a
try/except .
Oh well, so much for standards...!

DR


Andy Gates wrote:

 Here's a thing.  Those problems I was having with some sort of Zope-killing
 page have been tracked down to a particular zSQL method.

 The zSQL method is duff, in that is should fail - the perils of late-night
 coding on decaf, I fear - but it should fail neatly with a Zope error, not
 crash out the Python interpreter and force some poor schmuck to restart the
 limping Zope process.  I don't know whether this is a peculiarity to my
 setup (NT4SP6, IIS4, Zope2, Access97 database) or a general problem;
 perhaps some of the developer-hatted Zopistas could take a look?

 The poison SQL is this:

 select (dtml-var field, field2)
 from tablename
 where (field1= dtml-sqlvar parameter1 type=string
and dtml-var field  '')

 Where two parameters are passed to the method, namely "field" and
 "parameter1".  parameter1 is fed in as a dtml-sqlvar and searches against
 the table's field1 column.  field is passed in as a dtml-var and is used to
 define which of the table's other fields is retruned.  field2 is always
 returned.

 What makes the SQL duff is the parentheses around the fields in the first
 part of the SELECT.  They're not required and if you remove them to produce
 the zSQL below, it works fine.

 select dtml-var field, field2
 from tablename
 where (field1= dtml-sqlvar parameter1 type=string
and dtml-var field  '

 So why does it kill Python?  I'm only vaguely concerned now that I've found
 the fault, because of course the SQL is canned and no developer could get
 their hands on it - but this experience redoubles my acceptance of the
 notion of canned SQL!

 AndyG

 "I don't suffer from stress.  I'm just a carrier."

 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Zope-killer: zSQL method that crashes Zope

2000-07-20 Thread Andy Gates

Here's a thing.  Those problems I was having with some sort of Zope-killing 
page have been tracked down to a particular zSQL method.

The zSQL method is duff, in that is should fail - the perils of late-night 
coding on decaf, I fear - but it should fail neatly with a Zope error, not 
crash out the Python interpreter and force some poor schmuck to restart the 
limping Zope process.  I don't know whether this is a peculiarity to my 
setup (NT4SP6, IIS4, Zope2, Access97 database) or a general problem; 
perhaps some of the developer-hatted Zopistas could take a look?

The poison SQL is this:

select (dtml-var field, field2)
from tablename
where (field1= dtml-sqlvar parameter1 type=string
   and dtml-var field  '')

Where two parameters are passed to the method, namely "field" and 
"parameter1".  parameter1 is fed in as a dtml-sqlvar and searches against 
the table's field1 column.  field is passed in as a dtml-var and is used to 
define which of the table's other fields is retruned.  field2 is always 
returned.

What makes the SQL duff is the parentheses around the fields in the first 
part of the SELECT.  They're not required and if you remove them to produce 
the zSQL below, it works fine.

select dtml-var field, field2
from tablename
where (field1= dtml-sqlvar parameter1 type=string
   and dtml-var field  '

So why does it kill Python?  I'm only vaguely concerned now that I've found 
the fault, because of course the SQL is canned and no developer could get 
their hands on it - but this experience redoubles my acceptance of the 
notion of canned SQL!

AndyG

"I don't suffer from stress.  I'm just a carrier."


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Zope-killer: zSQL method that crashes Zope

2000-07-20 Thread Chris Withers

Andy Gates wrote:
 The poison SQL is this:
 
 select (dtml-var field, field2)
 from tablename
 where (field1= dtml-sqlvar parameter1 type=string
and dtml-var field  '')
 

Now I guess our code wasn't like this, but I do remember that we've had
similar problems with lethal SQL methods that cause Zope to die silently
and leave nothing in the logs.

However, our setup was quite different:

Zope 2.1.4-2.1.6, Redhat Linux, MySQL

The problem is that ZSQL Methods don't seem to be very robust, to the
point of actualyl killing Zope rather than returning an exception.

I'd guess this is something that needs to be looked at but it's probabyl
one of those bugs that's hideous to track down (ZCAtalog index bug
anyone? ;-)

ah well,

Chris

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Zope-killer: zSQL method that crashes Zope

2000-07-20 Thread Shane Hathaway

Chris Withers wrote:
 
 Andy Gates wrote:
  The poison SQL is this:
 
  select (dtml-var field, field2)
  from tablename
  where (field1= dtml-sqlvar parameter1 type=string
 and dtml-var field  '')
 
 
 Now I guess our code wasn't like this, but I do remember that we've had
 similar problems with lethal SQL methods that cause Zope to die silently
 and leave nothing in the logs.
 
 However, our setup was quite different:
 
 Zope 2.1.4-2.1.6, Redhat Linux, MySQL
 
 The problem is that ZSQL Methods don't seem to be very robust, to the
 point of actualyl killing Zope rather than returning an exception.
 
 I'd guess this is something that needs to be looked at but it's probabyl
 one of those bugs that's hideous to track down (ZCAtalog index bug
 anyone? ;-)

I have a strong suspicion that nearly all bugs like this are the result
of a stack overflow.  It may be worth the effort to either:

(1) Create a modified Python that would catch stack overflows before
they happen
(2) Get Zope running on microthreads/stackless Python (has anyone
tried?) and gain a little more control over the stacks.

Shane

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Zope-killer: zSQL method that crashes Zope

2000-07-20 Thread Chris Withers

Shane Hathaway wrote:
 I have a strong suspicion that nearly all bugs like this are the result
 of a stack overflow.  It may be worth the effort to either:
 
 (1) Create a modified Python that would catch stack overflows before
 they happen

Couldn't the code that catches infinite recursion be bent to do
something similar?

 (2) Get Zope running on microthreads/stackless Python (has anyone
 tried?) and gain a little more control over the stacks.

Way over my head ;-)

cheers,

Chris

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )