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

Mysterious crash after deleting a document #15

Closed
lilsweetcaligula opened this issue Aug 20, 2021 · 1 comment
Closed

Mysterious crash after deleting a document #15

lilsweetcaligula opened this issue Aug 20, 2021 · 1 comment

Comments

@lilsweetcaligula
Copy link
Contributor

Hello. Thank you for your hard work on this project - it's really handy!

There seems to be some kind of issue that reveals itself after deleting a document. I am not sure whether I'm doing something wrong or it is, in fact, a bug.

Steps to reproduce:

$ curl http://localhost:15808/ping

{"status": "ok", "name": "nozama-cloudsearch", "version": "2.0.3"}
$ curl -X POST -H "Content-Type: application/json" http://localhost:15808/2013-08-22/documents/batch -d '[{"lang": "en", "fields": {"name": "bob"}, "version": 1, "type": "add", "id": 1001},{"lang": "en", "fields": {"name": "foo","extra": "bob"}, "version": 1, "type": "add", "id": 1002}]'

{"status": "ok", "adds": 2, "deletes": 0, "error": "", "warning": ""}
$ curl http://localhost:15808/2013-08-22/search?q=bob

{"rank": "-text_relevance", "match-expr": "(label 'bob')", "hits": {"found": 2, "start": 0, "hit": [{"id": "1001", "fields": {"name": "bob"}}, {"id": "1002", "fields": {"name": "foo", "extra": "bob"}}]}, "info": {"rid": "750923f200a2276a998ee058bffdd7e21acfd4e8e2e085cd0210a8887530f79b527cb79ad3de94bf", "time
-ms": 99, "cpu-time-ms": 0}}
$ curl -X POST -H "Content-Type: application/json" http://localhost:15808/2013-08-22/documents/batch -d '[{"type": "delete", "id": 1001}]'

{"status": "ok", "adds": 0, "deletes": 1, "error": "", "warning": ""}
$ curl -i http://localhost:15808/2013-08-22/search?q=bob

HTTP/1.0 500 500 Server Error
Server: PasteWSGIServer/0.5 Python/3.8.2
Date: Fri, 20 Aug 2021 05:39:55 GMT
Content-Type: application/json
Connection: close

When the server responds with the 500 error, the following trace is produced by the server:

nozama-cloudsearch_1  | Traceback (most recent call last):
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/paste/httpserver.py", line 109
2, in process_request_in_thread
nozama-cloudsearch_1  |     self.finish_request(request, client_address)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
nozama-cloudsearch_1  |     self.RequestHandlerClass(request, client_address, self)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__
nozama-cloudsearch_1  |     self.handle()
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/paste/httpserver.py", line 460
, in handle
nozama-cloudsearch_1  |     BaseHTTPRequestHandler.handle(self)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
nozama-cloudsearch_1  |     self.handle_one_request()
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/paste/httpserver.py", line 455
, in handle_one_request
nozama-cloudsearch_1  |     self.wsgi_execute()
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/paste/httpserver.py", line 308
, in wsgi_execute
nozama-cloudsearch_1  |     self.wsgi_write_chunk(chunk)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/paste/httpserver.py", line 168
, in wsgi_write_chunk
nozama-cloudsearch_1  |     self.wfile.write(chunk)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/socketserver.py", line 799, in write
nozama-cloudsearch_1  |     self._sock.sendall(b)
nozama-cloudsearch_1  | TypeError: a bytes-like object is required, not 'str'
nozama-cloudsearch_1  | ----------------------------------------
nozama-cloudsearch_1  | 2021-08-20 05:41:24,707 DEBUG [nozama.cloudsearch.service.nozamaviews.doc_sea
rch][worker 6] request_id <ef68fd9d230160d1a228defba507674fff6362ee7e135a38c12902ec02ae3d624dc3f2595a
b43600> request params <NestedMultiDict([('q', 'bob')])>
nozama-cloudsearch_1  | 2021-08-20 05:41:24,707 DEBUG [nozama.cloudsearch.service.nozamaviews.doc_sea
rch][worker 6] params recovered <{'q': 'bob'}>
nozama-cloudsearch_1  | 2021-08-20 05:41:24,707 DEBUG [nozama.cloudsearch.data.document.search][worke
r 6] searching query '{'q': 'bob'}'
nozama-cloudsearch_1  | 2021-08-20 05:41:24,718 INFO  [elasticsearch][worker 6] POST http://elasticse
arch:9200/documents/_search [status:200 request:0.011s]
nozama-cloudsearch_1  | 2021-08-20 05:41:24,720 ERROR [nozama.cloudsearch.service.restfulhelpers.JSON
ErrorHandler][worker 6] error:
nozama-cloudsearch_1  | Traceback (most recent call last):
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/tweens.py", line 13, i
n _error_handler
nozama-cloudsearch_1  |     response = request.invoke_exception_view(exc_info)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/view.py", line 779, in
 invoke_exception_view
nozama-cloudsearch_1  |     raise HTTPNotFound
nozama-cloudsearch_1  | pyramid.httpexceptions.HTTPNotFound: The resource could not be found.
nozama-cloudsearch_1  |
nozama-cloudsearch_1  | During handling of the above exception, another exception occurred:
nozama-cloudsearch_1  |
nozama-cloudsearch_1  | Traceback (most recent call last):
nozama-cloudsearch_1  |   File "/app/nozama/cloudsearch/service/restfulhelpers.py", line 196, in __ca
ll__
nozama-cloudsearch_1  |     return self.app(environ, start_response)
nozama-cloudsearch_1  |   File "/app/nozama/cloudsearch/service/restfulhelpers.py", line 166, in __ca
ll__
nozama-cloudsearch_1  |     return self.application(environ, start_response)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/router.py", line 270,
in __call__
nozama-cloudsearch_1  |     response = self.execution_policy(environ, self)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/router.py", line 279,
in default_execution_policy
nozama-cloudsearch_1  |     return request.invoke_exception_view(reraise=True)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/view.py", line 778, in
 invoke_exception_view
nozama-cloudsearch_1  |     reraise_(*exc_info)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/compat.py", line 179,
in reraise
nozama-cloudsearch_1  |     raise value
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/router.py", line 277,
in default_execution_policy
nozama-cloudsearch_1  |     return router.invoke_request(request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/router.py", line 249,
in invoke_request
nozama-cloudsearch_1  |     response = handle_request(request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/tweens.py", line 43, i
n excview_tween
nozama-cloudsearch_1  |     response = _error_handler(request, exc)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/tweens.py", line 17, i
n _error_handler
nozama-cloudsearch_1  |     reraise(*exc_info)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/compat.py", line 179,
in reraise
nozama-cloudsearch_1  |     raise value
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/tweens.py", line 41, i
n excview_tween
nozama-cloudsearch_1  |     response = handler(request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/router.py", line 147,
in handle_request
nozama-cloudsearch_1  |     response = _call_view(
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/view.py", line 667, in
 _call_view
nozama-cloudsearch_1  |     response = view_callable(context, request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/config/views.py", line
 188, in attr_view
nozama-cloudsearch_1  |     return view(context, request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/config/views.py", line
 214, in predicate_wrapper
nozama-cloudsearch_1  |     return view(context, request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py", line
 436, in rendered_view
nozama-cloudsearch_1  |     result = view(context, request)
nozama-cloudsearch_1  |   File "/usr/local/lib/python3.8/site-packages/pyramid/viewderivers.py", line
 144, in _requestonly_view
nozama-cloudsearch_1  |     response = view(request)
nozama-cloudsearch_1  |   File "/app/nozama/cloudsearch/service/nozamaviews.py", line 64, in doc_sear
ch
nozama-cloudsearch_1  |     rc = document.search(params)
nozama-cloudsearch_1  |   File "/app/nozama/cloudsearch/data/document.py", line 154, in search
nozama-cloudsearch_1  |     fields = conn.documents.find_one(query)['fields']
nozama-cloudsearch_1  | TypeError: 'NoneType' object is not subscriptable
nozama-cloudsearch_1  | 2021-08-20 05:41:24,721 ERROR [nozama.cloudsearch.service.restfulhelpers.JSON
ErrorHandler][worker 6] TypeError: 'NoneType' object is not subscriptable
@oisinmulvihill
Copy link
Owner

Fixed in version 2.0.4

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

2 participants