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

Python driver fails with unexpected bytes #270

Open
ssut opened this issue Jun 18, 2017 · 0 comments
Open

Python driver fails with unexpected bytes #270

ssut opened this issue Jun 18, 2017 · 0 comments

Comments

@ssut
Copy link

ssut commented Jun 18, 2017

I'm running tasks using celery in Python with python rethinkdb driver. I followed Ten-minute guide with Rethinkdb and Python and it seems to be running fine for a while, but it fails with UnicodeDecodeError after some time.

[2017-06-18 16:24:00,102: WARNING/PoolWorker-6] b'{"deleted":0,"errors":0,"generated_keys":["cef00e30-fdb1-443e-8313-54ab6da8812d"],"inserted":1,"replaced":0,"skipped":0,"unchanged":0}]}\x02\x00\x00\x00\x00\x00\x00\x00\x94\x00\x00\x00'
[2017-06-18 16:24:00,105: ERROR/PoolWorker-6] Task tasks.crawl[ddaffbc4-e56d-4da8-8304-c5abd243be79] raised unexpected: UnicodeDecodeError('utf-8', b'{"deleted":0,"errors":0,"generated_keys":["cef00e30-fdb1-443e-8313-54ab6da8812d"],"inserted":1,"replaced":0,"skipped":0,"unchanged":0}]}\x02\x00\x00\x00\x00\x00\x00\x00\x94\x00\x00\x00', 144, 145, 'invalid start byte')
Traceback (most recent call last):
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/celery/app/trace.py", line 367, in trace_task
  R = retval = fun(*args, **kwargs)
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/celery/app/trace.py", line 622, in __protected_call__
  return self.run(*args, **kwargs)
  File "/home/ssut/dev/.../tasks.py", line 215, in crawl
  r.table('logs').insert(log).run(conn)
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/rethinkdb/ast.py", line 123, in run
  return c._start(self, **global_optargs)
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/rethinkdb/net.py", line 626, in _start
  return self._instance.run_query(q, global_optargs.get('noreply', False))
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/rethinkdb/net.py", line 459, in run_query
  res = self._read_response(query)
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/rethinkdb/net.py", line 507, in _read_response
  self._parent._get_json_decoder(query))
  File "/home/ssut/.local/share/virtualenvs/server-NO78Iaa1/lib/python3.6/site-packages/rethinkdb/net.py", line 74, in __init__
  json_str = json_str.decode('utf-8')
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x94 in position 144: invalid start byte

The first line is a hint I modified to check where the error comes from:
image
I think the root cause of this issue is that the part of the socket receives response from the rethinkdb server does the wrong behavior.

@gabor-boros gabor-boros transferred this issue from rethinkdb/rethinkdb May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant