Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

sql bind var error #3404

Closed
emdete opened this issue Jun 16, 2018 · 3 comments
Closed

sql bind var error #3404

emdete opened this issue Jun 16, 2018 · 3 comments

Comments

@emdete
Copy link

emdete commented Jun 16, 2018

after an update i see this error in the log:

2018-06-16 21:11:11,429 - synapse.http.server - 102 - ERROR - POST-61- Failed handle request via <function _async_render at 0x7f95a4f446e0>: <XForwardedForRequest at 0x7f95a
25ac758 method='POST' uri='/_matrix/federation/v1/get_missing_events/%21rJwFmeKiXqSEFwURkb%3Amatrix.org' clientproto='HTTP/1.1' site=8008>: Traceback (most recent call last)
:
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1442, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 79, in wrapped_request_handler
    yield h(self, request)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 305, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/federation/transport/server.py", line 203, in new_func
    origin, content, request.args, *args, **kwargs
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/federation/transport/server.py", line 479, in on_POST
    limit=limit,
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/federation/federation_server.py", line 452, in on_get_missing_events
    origin, room_id, earliest_events, latest_events, limit, min_depth
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/handlers/federation.py", line 1798, in on_get_missing_events
    origin, room_id, missing_events,
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/util/metrics.py", line 55, in measured_func
    r = yield func(self, *args, **kwargs)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/handlers/federation.py", line 465, in _filter_events_for_server
    (EventTypes.Member, None),
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/state.py", line 391, in get_state_ids_for_events
    group_to_state = yield self._get_state_for_groups(groups, types)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/state.py", line 563, in _get_state_for_groups
    missing_groups, types
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/state.py", line 196, in _get_state_groups_from_groups
    self._get_state_groups_from_groups_txn, chunk, types,
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 325, in runInteraction
    result = yield self.runWithConnection(inner_func, *args, **kwargs)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 370, in runWithConnection
    inner_func, *args, **kwargs
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/enterprise/adbapi.py", line 307, in _runWithConnection
    compat.reraise(excValue, excTraceback)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/twisted/enterprise/adbapi.py", line 298, in _runWithConnection
    result = func(conn, *args, **kw)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 366, in inner_func
    return func(conn, *args, **kwargs)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 321, in inner_func
    func, *args, **kwargs
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 246, in _new_transaction
    r = func(txn, *args, **kwargs)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/state.py", line 302, in _get_state_groups_from_groups_txn
    args
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 87, in execute
    self._do_execute(self.txn.execute, sql, *args)
  File "/home/mdt/matrix/synapse/local/lib/python2.7/site-packages/synapse/storage/_base.py", line 117, in _do_execute
    sql, *args
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 4, and there are 16 supplied.

i added a logline to see whats going on:

2018-06-16 10:15:52,929 - synapse.storage._base - 120 - INFO - POST-171- [SQL FAIL] {_get_state_groups_from_groups-29d} SELECT type, state_key, event_id FROM state_groups_state WHERE state_group = ? AND ((type = ?) OR (type = ? AND state_key = ?)) ([303513, 'm', '.', 'r', 'o', 'o', 'm', '.', 'm', 'e', 'm', 'b', 'e', 'r', 'm.room.history_visibility', ''],) Incorrect number of bindings supplied. The current statement uses 4, and there are 16 supplied.

it seems a string is *-ed and given as an arg?

version is:

Server: Synapse/0.31.2
@neilisfragile
Copy link
Contributor

Thanks @emdete

@hawkowl related to metrics wrangling? I can't see any instances of this happening against postgres backed homeservers (and haven't been able to reproduce against sqlite3)

@hawkowl
Copy link
Contributor

hawkowl commented Jun 22, 2018

@neilisfragile Shouldn't be, none of that (should have been) near this code. Happy to take a deeper look on this if you want, though.

@richvdh
Copy link
Member

richvdh commented Jul 13, 2018

duplicate of #3354

@richvdh richvdh closed this as completed Jul 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants