After running the appserver with the trace module and the -t argument, python -m trace -t, and disabling the mail queue delivery to prevent repetitive calls from being made, the following few lines are output last. I'm still not sure if this provides further insight into the problem but worth noting for now.
...
postgres.py(199): return compile_sql_token(compile, expr, state)
--- modulename: expr, funcname: compile_sql_token
expr.py(1284): if is_safe_token(expr) and not compile.is_reserved_word(expr):
expr.py(1285): return expr
info.py(247): if state.context is TABLE and issubclass(expr, ClassAlias):
info.py(249): return table
--- modulename: expr, funcname: <genexpr>
expr.py(538): tables = set(compile(table, state, token=True) for table in tables)
--- modulename: info, funcname: compile_type
info.py(245): cls_info = get_cls_info(expr)
--- modulename: info, funcname: get_cls_info
info.py(47): if "__storm_class_info__" in cls.__dict__:
info.py(49): return cls.__dict__["__storm_class_info__"]
info.py(246): table = compile(cls_info.table, state)
--- modulename: postgres, funcname: compile_sql_token_postgres
postgres.py(196): if "." in expr and state.context in (TABLE, COLUMN_PREFIX):
postgres.py(199): return compile_sql_token(compile, expr, state)
--- modulename: expr, funcname: compile_sql_token
expr.py(1284): if is_safe_token(expr) and not compile.is_reserved_word(expr):
expr.py(1285): return expr
info.py(247): if state.context is TABLE and issubclass(expr, ClassAlias):
info.py(249): return table
--- modulename: expr, funcname: <genexpr>
expr.py(538): tables = set(compile(table, state, token=True) for table in tables)
expr.py(539): return ", ".join(sorted(tables))
expr.py(641): parameters = state.parameters
expr.py(642): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._stack.pop(-1))
expr.py(643): state.parameters[parameters_pos:parameters_pos] = parameters
expr.py(644): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._stack.pop(-1))
expr.py(645): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._stack.pop(-1))
expr.py(646): return "".join(tokens)
database.py(201): params = state.parameters
database.py(202): statement = convert_param_marks(statement, "?", self.param_mark)
--- modulename: database, funcname: convert_param_marks
database.py(380): if from_param_mark == to_param_mark or from_param_mark not in statement:
database.py(382): tokens = statement.split("'")
database.py(383): for i in range(0, len(tokens), 2):
database.py(384): tokens[i] = tokens[i].replace(from_param_mark, to_param_mark)
database.py(383): for i in range(0, len(tokens), 2):
database.py(385): return "'".join(tokens)
database.py(203): raw_cursor = self.raw_execute(statement, params)
--- modulename: postgres, funcname: raw_execute
postgres.py(290): if type(statement) is unicode:
postgres.py(292): statement = statement.encode("UTF-8")
postgres.py(293): return Connection.raw_execute(self, statement, params)
--- modulename: database, funcname: raw_execute
database.py(276): raw_cursor = self.build_raw_cursor()
--- modulename: database, funcname: build_raw_cursor
database.py(263): return self._raw_connection.cursor()
database.py(277): trace("connection_raw_execute", self, raw_cursor,
database.py(278): statement, params or ())
--- modulename: tracer, funcname: trace
tracer.py(90): for tracer in _tracers:
tracer.py(91): attr = getattr(tracer, name, None)
tracer.py(92): if attr:
tracer.py(93): attr(*args, **kwargs)
--- modulename: stormtracer, funcname: connection_raw_execute
stormtracer.py(16): now = time.time()
stormtracer.py(17): for entry in OOPSStorm.get_for_tracing():
--- modulename: stormtracer, funcname: get_for_tracing
stormtracer.py(67): for entry in self._global:
--- modulename: weakref, funcname: __iter__
weakref.py(309): return self.iterkeys()
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.iterkeys():
stormtracer.py(69): try:
stormtracer.py(70): for entry in self._local.logs:
--- modulename: weakref, funcname: __iter__
weakref.py(309): return self.iterkeys()
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.iterkeys():
weakref.py(304): obj = wr()
weakref.py(305): if obj is not None:
weakref.py(306): yield obj
stormtracer.py(71): yield entry
stormtracer.py(18): entry.connection_raw_execute(now, connection, raw_cursor,
stormtracer.py(19): statement, params)
--- modulename: stormtracer, funcname: connection_raw_execute
stormtracer.py(79): params = tuple(repr((isinstance(param, Variable) and
stormtracer.py(81): for param in params)
--- modulename: stormtracer, funcname: <genexpr>
stormtracer.py(79): params = tuple(repr((isinstance(param, Variable) and
--- modulename: stormtracer, funcname: <genexpr>
stormtracer.py(82): self._statements.append([statement, params, now, None, None])
stormtracer.py(17): for entry in OOPSStorm.get_for_tracing():
--- modulename: stormtracer, funcname: get_for_tracing
stormtracer.py(70): for entry in self._local.logs:
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.iterkeys():
tracer.py(90): for tracer in _tracers:
database.py(279): if params:
database.py(280): args = (statement, tuple(self.to_database(params)))
--- modulename: postgres, funcname: to_database
postgres.py(301): for param in params:
postgres.py(302): if isinstance(param, Variable):
postgres.py(303): param = param.get(to_db=True)
postgres.py(304): if isinstance(param, (datetime, date, time, timedelta)):
postgres.py(306): elif isinstance(param, unicode):
postgres.py(308): elif isinstance(param, str):
postgres.py(309): yield psycopg2.Binary(param)
--- modulename: postgres, funcname: to_database
postgres.py(301): for param in params:
database.py(283): try:
database.py(284): self._check_disconnect(raw_cursor.execute, *args)
--- modulename: database, funcname: _check_disconnect
database.py(324): try:
database.py(325): return function(*args, **kwargs)
After running the appserver with the trace module and the -t argument, python -m trace -t, and disabling the mail queue delivery to prevent repetitive calls from being made, the following few lines are output last. I'm still not sure if this provides further insight into the problem but worth noting for now.
... sql_token( compile, expr, state) is_reserved_ word(expr) : class_info_ _" in cls.__dict__: _["__storm_ class_info_ _"] cls_info. table, state) sql_token_ postgres sql_token( compile, expr, state) is_reserved_ word(expr) : sorted( tables) ) stack.pop( -1)) s[parameters_ pos:parameters_ pos] = parameters stack.pop( -1)) stack.pop( -1)) param_marks( statement, "?", self.param_mark) split(" '") i].replace( from_param_ mark, to_param_mark) execute( statement, params) encode( "UTF-8" ) raw_execute( self, statement, params) raw_cursor( ) connection. cursor( ) connection_ raw_execute" , self, raw_cursor, raw_execute get_for_ tracing( ): iterkeys( ): iterkeys( ): n_raw_execute( now, connection, raw_cursor, raw_execute (isinstance( param, Variable) and (isinstance( param, Variable) and s.append( [statement, params, now, None, None]) get_for_ tracing( ): iterkeys( ): to_database( params) )) to_db=True) Binary( param) disconnect( raw_cursor. execute, *args)
postgres.py(199): return compile_
--- modulename: expr, funcname: compile_sql_token
expr.py(1284): if is_safe_token(expr) and not compile.
expr.py(1285): return expr
info.py(247): if state.context is TABLE and issubclass(expr, ClassAlias):
info.py(249): return table
--- modulename: expr, funcname: <genexpr>
expr.py(538): tables = set(compile(table, state, token=True) for table in tables)
--- modulename: info, funcname: compile_type
info.py(245): cls_info = get_cls_info(expr)
--- modulename: info, funcname: get_cls_info
info.py(47): if "__storm_
info.py(49): return cls.__dict_
info.py(246): table = compile(
--- modulename: postgres, funcname: compile_
postgres.py(196): if "." in expr and state.context in (TABLE, COLUMN_PREFIX):
postgres.py(199): return compile_
--- modulename: expr, funcname: compile_sql_token
expr.py(1284): if is_safe_token(expr) and not compile.
expr.py(1285): return expr
info.py(247): if state.context is TABLE and issubclass(expr, ClassAlias):
info.py(249): return table
--- modulename: expr, funcname: <genexpr>
expr.py(538): tables = set(compile(table, state, token=True) for table in tables)
expr.py(539): return ", ".join(
expr.py(641): parameters = state.parameters
expr.py(642): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._
expr.py(643): state.parameter
expr.py(644): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._
expr.py(645): state.pop()
--- modulename: expr, funcname: pop
expr.py(262): setattr(self, *self._
expr.py(646): return "".join(tokens)
database.py(201): params = state.parameters
database.py(202): statement = convert_
--- modulename: database, funcname: convert_param_marks
database.py(380): if from_param_mark == to_param_mark or from_param_mark not in statement:
database.py(382): tokens = statement.
database.py(383): for i in range(0, len(tokens), 2):
database.py(384): tokens[i] = tokens[
database.py(383): for i in range(0, len(tokens), 2):
database.py(385): return "'".join(tokens)
database.py(203): raw_cursor = self.raw_
--- modulename: postgres, funcname: raw_execute
postgres.py(290): if type(statement) is unicode:
postgres.py(292): statement = statement.
postgres.py(293): return Connection.
--- modulename: database, funcname: raw_execute
database.py(276): raw_cursor = self.build_
--- modulename: database, funcname: build_raw_cursor
database.py(263): return self._raw_
database.py(277): trace("
database.py(278): statement, params or ())
--- modulename: tracer, funcname: trace
tracer.py(90): for tracer in _tracers:
tracer.py(91): attr = getattr(tracer, name, None)
tracer.py(92): if attr:
tracer.py(93): attr(*args, **kwargs)
--- modulename: stormtracer, funcname: connection_
stormtracer.py(16): now = time.time()
stormtracer.py(17): for entry in OOPSStorm.
--- modulename: stormtracer, funcname: get_for_tracing
stormtracer.py(67): for entry in self._global:
--- modulename: weakref, funcname: __iter__
weakref.py(309): return self.iterkeys()
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.
stormtracer.py(69): try:
stormtracer.py(70): for entry in self._local.logs:
--- modulename: weakref, funcname: __iter__
weakref.py(309): return self.iterkeys()
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.
weakref.py(304): obj = wr()
weakref.py(305): if obj is not None:
weakref.py(306): yield obj
stormtracer.py(71): yield entry
stormtracer.py(18): entry.connectio
stormtracer.py(19): statement, params)
--- modulename: stormtracer, funcname: connection_
stormtracer.py(79): params = tuple(repr(
stormtracer.py(81): for param in params)
--- modulename: stormtracer, funcname: <genexpr>
stormtracer.py(79): params = tuple(repr(
--- modulename: stormtracer, funcname: <genexpr>
stormtracer.py(82): self._statement
stormtracer.py(17): for entry in OOPSStorm.
--- modulename: stormtracer, funcname: get_for_tracing
stormtracer.py(70): for entry in self._local.logs:
--- modulename: weakref, funcname: iterkeys
weakref.py(303): for wr in self.data.
tracer.py(90): for tracer in _tracers:
database.py(279): if params:
database.py(280): args = (statement, tuple(self.
--- modulename: postgres, funcname: to_database
postgres.py(301): for param in params:
postgres.py(302): if isinstance(param, Variable):
postgres.py(303): param = param.get(
postgres.py(304): if isinstance(param, (datetime, date, time, timedelta)):
postgres.py(306): elif isinstance(param, unicode):
postgres.py(308): elif isinstance(param, str):
postgres.py(309): yield psycopg2.
--- modulename: postgres, funcname: to_database
postgres.py(301): for param in params:
database.py(283): try:
database.py(284): self._check_
--- modulename: database, funcname: _check_disconnect
database.py(324): try:
database.py(325): return function(*args, **kwargs)