[CalendarServer-changes] [5983] CalendarServer/branches/users/glyph/sql-store
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 5 12:03:25 PDT 2010
Revision: 5983
http://trac.macosforge.org/projects/calendarserver/changeset/5983
Author: glyph at apple.com
Date: 2010-08-05 12:03:24 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
Remove some debug prints and add a sanity-check timeout.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-05 17:54:48 UTC (rev 5982)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-05 19:03:24 UTC (rev 5983)
@@ -87,7 +87,6 @@
def startStopping():
log.msg("Starting stopping.")
sharedService.unpauseMonitor()
- dumpConnectionStatus()
return sharedService.stopService()
reactor.addSystemEventTrigger(#@UndefinedVariable
"before", "shutdown", startStopping)
@@ -100,7 +99,6 @@
"""
Delete everything from the database, then clean it up.
"""
- dumpConnectionStatus()
cleanupConn = calendarStore.connectionFactory(
"%s schema-cleanup" % (self.id(),)
)
Modified: CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py 2010-08-05 17:54:48 UTC (rev 5982)
+++ CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py 2010-08-05 19:03:24 UTC (rev 5983)
@@ -180,7 +180,20 @@
)
w = DiagnosticConnectionWrapper(connection, label)
c = w.cursor()
+ # Turn on standard conforming strings. This option is _required_ if
+ # you want to get correct behavior out of parameter-passing with the
+ # pgdb module. If it is not set then the server is potentially
+ # vulnerable to certain types of SQL injection.
c.execute("set standard_conforming_strings=on")
+
+ # Abort any second that takes more than 2 seconds (2000ms) to execute.
+ # This is necessary as a temporary workaround since it's hypothetically
+ # possible that different database operations could block each other,
+ # while executing SQL in the same process (in the same thread, since
+ # SQL executes in the main thread now). It's preferable to see some
+ # exceptions while we're in this state than to have the entire worker
+ # process hang.
+ c.execute("set statement_timeout=2000")
w.commit()
c.close()
return w
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100805/fddf54c4/attachment.html>
More information about the calendarserver-changes
mailing list