Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.85k stars 449 forks source link

No search results unless exact query #8111

Closed qstokkink closed 2 months ago

qstokkink commented 2 months ago

When I search for a query, for example, "ubuntu". I get a list of completions, as expected:

When I instead click on one of the completions, I get many results:

However, when I then press "enter" I get no results:

Even clicking on the "ubuntu" completion gives me no results.

qstokkink commented 2 months ago

😮 removing metadata.db resolves this.

EDIT: Temporarily, after a running for a few minutes this starts happening again.

qstokkink commented 2 months ago

I alternately searched for "ubuntu" and "ubunt" until the bug happened. At this point an error popped up in my web console:

GET
http://127.0.0.1:33729/api/metadata/search/local?first=1&last=200&metadata_type=300&exclude_deleted=1&fts_text=ubuntu&hide_xxx=1
[HTTP/1.1 500 Internal Server Error 32ms]

Uncaught (in promise) 
Object { stack: "Ee@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:72:41605\nM6@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:1052\nh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:4246\nEventHandlerNonNull*U6</<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:4318\nU6<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:3223\nT1@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:76:512\n_request@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:1208\nrequest@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:76:3028\nCc.prototype[t]@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:1512\nGw/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:72:36329\nsearchTorrentsLocal@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:7207\nCT/</<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147:41550\nCT/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147:41658\nYc@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:24434\nEi@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:42732\nEC@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:41511\npo@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:40537\np0@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:37118\nno@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30:3274\njt/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34471\nVoidFunction*jt@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34445\nEn@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34133\nlC@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30:24882\nh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117:24574\nonKeyDown@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117:25275\nB9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:9862\nG9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:10016\nW9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:10073\nIg@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:31506\nZy@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:31925\npd/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:36847\nDh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:37189\nby@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:8998\npd@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:33218\nuh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:17402\nc3@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:17184\n", message: "Request failed with status code 500", name: "AxiosError", code: "ERR_BAD_RESPONSE", config: {…}, request: XMLHttpRequest, response: {…} }
​
code: "ERR_BAD_RESPONSE"
​
config: Object { timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", … }
​
message: "Request failed with status code 500"
​
name: "AxiosError"
​
request: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: true, … }
​
response: Object { data: {…}, status: 500, statusText: "Internal Server Error", … }
​
stack: "Ee@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:72:41605\nM6@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:1052\nh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:4246\nEventHandlerNonNull*U6</<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:4318\nU6<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:74:3223\nT1@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:76:512\n_request@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:1208\nrequest@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:76:3028\nCc.prototype[t]@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:1512\nGw/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:72:36329\nsearchTorrentsLocal@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:77:7207\nCT/</<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147:41550\nCT/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147:41658\nYc@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:24434\nEi@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:42732\nEC@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:41511\npo@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:40537\np0@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:37118\nno@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30:3274\njt/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34471\nVoidFunction*jt@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34445\nEn@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:34133\nlC@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30:24882\nh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117:24574\nonKeyDown@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117:25275\nB9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:9862\nG9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:10016\nW9@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:10073\nIg@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:31506\nZy@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:31925\npd/<@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:36847\nDh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32:37189\nby@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:8998\npd@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:33218\nuh@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:17402\nc3@http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29:17184\n"
​
<prototype>: Object { constructor: Ee(e, t, n, r, o), toJSON: toJSON(), stack: "", … }
index.83d9d3fb.js:147:41550
    CT http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147
    AsyncFunctionThrow self-hosted:811
    (Async: async)
    CT http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:147
    Yc http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    Ei http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    EC http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    po http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    p0 http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    no http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30
    jt http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    (Async: VoidFunction)
    jt http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    En http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    lC http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:30
    h http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117
    onKeyDown http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:117
    B9 http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    G9 http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    W9 http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    Ig http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    Zy http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    pd http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    Dh http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:32
    by http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    pd http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    uh http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29
    c3 http://127.0.0.1:33729/ui/assets/index.83d9d3fb.js:29

I assumed that there would be a traceback in the Tribler process but all I see is a message INFO:DatabaseEndpoint:FTS: "ubuntu".

qstokkink commented 2 months ago

Hold on, the raw HTTP response DID have more info:

Object {
    handled: false,
    code: "UnrepeatableReadError",
    message: 'Traceback (most recent call last):\n File "/home/quinten/Documents/tribler/src/tribler/core/restapi/rest_manager.py", line 106, in error_middleware\n response = await handler(request)\n File "/home/quinten/Documents/tribler/src/tribler/core/restapi/rest_manager.py", line 161, in required_components_middleware\n return await handler(request)\n File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl\n return await handler(request)\n …ome/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 2272, in load\n else: obj._load_()\n File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 4827, in _load_\n if obj not in objects: throw(UnrepeatableReadError,\n File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw\n raise exc\npony.orm.core.UnrepeatableReadError: Phantom object Resource[41824] disappeared\n'
}

Pretty formatting:

Traceback (most recent call last):
 File "/home/quinten/Documents/tribler/src/tribler/core/restapi/rest_manager.py", line 106, in error_middleware
 response = await handler(request)
 File "/home/quinten/Documents/tribler/src/tribler/core/restapi/rest_manager.py", line 161, in required_components_middleware
 return await handler(request)
 File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl
 return await handler(request)
 …ome/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 2272, in load
 else: obj._load_()
 File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 4827, in _load_
 if obj not in objects: throw(UnrepeatableReadError,
 File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw
 raise exc
pony.orm.core.UnrepeatableReadError: Phantom object Resource[41824] disappeared

I added a try .. except around the entire local_search() body and got this:

Traceback (most recent call last):
  File "/home/quinten/Documents/tribler/src/tribler/core/database/restapi/database_endpoint.py", line 321, in local_search
    self.add_statements_to_metadata_list(search_results)
  File "<string>", line 2, in add_statements_to_metadata_list
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 538, in new_func
    reraise(exc_type, exc, tb)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/utils/utils.py", line 88, in reraise
    try: raise exc.with_traceback(tb)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 519, in new_func
    result = func(*args, **kwargs)
  File "/home/quinten/Documents/tribler/src/tribler/core/database/restapi/database_endpoint.py", line 138, in add_statements_to_metadata_list
    raw_statements = self.tribler_db.knowledge.get_simple_statements(
  File "/home/quinten/Documents/tribler/src/tribler/core/database/layers/knowledge.py", line 446, in get_simple_statements
    return [SimpleStatement(subject_type=s.subject.type, subject=s.subject.name, predicate=s.object.type,
  File "/home/quinten/Documents/tribler/src/tribler/core/database/layers/knowledge.py", line 446, in <listcomp>
    return [SimpleStatement(subject_type=s.subject.type, subject=s.subject.name, predicate=s.object.type,
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 2278, in __get__
    value = attr.get(obj)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 2288, in get
    val = vals[attr] if attr in vals else attr.load(obj)
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 2272, in load
    else: obj._load_()
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/orm/core.py", line 4827, in _load_
    if obj not in objects: throw(UnrepeatableReadError,
  File "/home/quinten/Documents/tribler/venv/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.core.UnrepeatableReadError: Phantom object Resource[41824] disappeared