SynBioDex / SBOLExplorer

MIT License
4 stars 2 forks source link

SBOLExplorer ceases working temporarily #39

Closed cjmyers closed 4 years ago

cjmyers commented 5 years ago

On synbiohub.org, SBOLExplorer stops working periodically and then all search results return nothing. This is very bad. It should fall back to using normal search. Not sure the problem, but this error message shows up in the log:

SPARQL query: PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX dcterms: http://purl.org/dc/terms/ PREFIX sbh: http://wiki.synbiohub.org/wiki/Terms/synbiohub# PREFIX sbol2: http://sbols.org/v2# SELECT DISTINCT ?subject ?displayId ?version ?name ?description ?type ?graph WHERE { FILTER(?subject != ?subject) ?subject rdf:type ?type. ?subject sbh:topLevel ?subject. GRAPH ?graph { ?subject ?a ?t. } OPTIONAL { ?subject sbol2:displayId ?displayId. } OPTIONAL { ?subject sbol2:version ?version. } OPTIONAL { ?subject dcterms:title ?name. } OPTIONAL { ?subject dcterms:description ?description. } } LIMIT 10000 at Request.request [as _callback] (/synbiohub/lib/sparql/sparql.js:111:16) at Request.self.callback (/synbiohub/node_modules/request/request.js:185:22) at Request.emit (events.js:182:13) at Request. (/synbiohub/node_modules/request/request.js:1161:10) at Request.emit (events.js:182:13) at IncomingMessage. (/synbiohub/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) at process.internalTickCallback (internal/process/next_tick.js:72:19) [2019-02-27 16:00:28.516163] Error: Virtuoso 42000 Error The estimated execution time 8136 (sec) exceeds the limit of 400 (sec).

cjmyers commented 4 years ago

Make sure SBOLExplorer sends proper response code, 200 on success, >300 on failure.

cjmyers commented 4 years ago

I figure out why this fails and SBH search succeeds. It has to do with this line in the query:

GRAPH ?graph { ?subject ?a ?t. }

This comes from line 24 of query.py. It is used to get the graph where search results come from. The reason for it is so you can make sure you don't return search results outside the allowed graph. This is handled on line 231 and 232 of search.py:

    if _source.get('graph') not in allowed_graphs:
        continue

This is also handled though using the FROM lines in the SPARQL query. It feels like this can be safely removed without exposing private parts, but we should test it. If so, it should allow the queries to complete quickly.

yu-eric commented 4 years ago

Fixed in latest PR.