Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Passing bytes to DB is disabled" when uploading some media #6444

Open
turt2live opened this issue Dec 1, 2019 · 2 comments
Open

"Passing bytes to DB is disabled" when uploading some media #6444

turt2live opened this issue Dec 1, 2019 · 2 comments
Labels

Comments

@turt2live
Copy link
Member

@turt2live turt2live commented Dec 1, 2019

2019-12-01 06:45:00,971 - synapse.rest.media.v1.media_repository - 162 - INFO - POST-2080 - Stored local media in file '/home/matrix/.synapse/media_store/local_content/EG/Gd/PACtjcHusVFaoiHpBgLC'
2019-12-01 06:45:00,973 - synapse.http.server - 109 - ERROR - POST-2080 - Failed handle request via 'UploadResource': <SynapseRequest at 0x7fc8cd885358 method='POST' uri='/_matrix/media/r0/upload?filename=&user_id=%40redacted%3A
redacted.org' clientproto='HTTP/1.0' site=8008>
Traceback (most recent call last):
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/http/server.py", line 77, in wrapped_request_handler
    await h(self, request)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/rest/media/v1/upload_resource.py", line 86, in _async_render_POST
    media_type, upload_name, request.content, content_length, requester.user
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/rest/media/v1/media_repository.py", line 170, in create_content
    user_id=auth_user,
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 611, in _simple_insert
    yield self.runInteraction(desc, self._simple_insert_txn, table, values)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 504, in runInteraction
    **kwargs
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 552, in runWithConnection
    self._db_pool.runWithConnection(inner_func, *args, **kwargs)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/enterprise/adbapi.py", line 306, in _runWithConnection
    compat.reraise(excValue, excTraceback)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/python/compat.py", line 464, in reraise
    raise exception.with_traceback(traceback)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/twisted/enterprise/adbapi.py", line 297, in _runWithConnection
    result = func(conn, *args, **kw)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 549, in inner_func
    return func(conn, *args, **kwargs)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 421, in _new_transaction
    r = func(txn, *args, **kwargs)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 630, in _simple_insert_txn
    txn.execute(sql, vals)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 152, in execute
    self._do_execute(self.txn.execute, sql, *args)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/_base.py", line 178, in _do_execute
    return func(sql, *args)
  File "/home/matrix/.synapse/local/lib/python3.6/site-packages/synapse/storage/engines/postgres.py", line 29, in _disable_bytes_adapter
    raise Exception("Passing bytes to DB is disabled.")

Postgres 9.5, Synapse 1.6.1

@lub

This comment has been minimized.

Copy link

@lub lub commented Dec 31, 2019

I think this happens, when you specify an empty filename /upload?filename= (like you did according to your log)
The same media works for me, when specifying a proper filename or omitting the filename attribute completely.

I've noticed this error because matrix-bot-sdk does send empty filenames by default (see e.g. matrix-discord/mx-puppet-discord#25 (comment))

@lub

This comment has been minimized.

Copy link

@lub lub commented Jan 2, 2020

Seems this bug was introduced in 1.5.0rc1 by 1d38583 and is only affecting psycopg2; sqlite is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.