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

Catch and report API timeout #34

Open
merkys opened this issue Sep 20, 2021 · 7 comments
Open

Catch and report API timeout #34

merkys opened this issue Sep 20, 2021 · 7 comments

Comments

@merkys
Copy link

merkys commented Sep 20, 2021

For some queries the server timeouts, but wdq dies with rather obscure message about failure to parse JSON. Failcase:

SELECT ?item ?smiles ?itemLabel
     WHERE { ?item wdt:P31 wd:Q11173 .
             ?item wdt:P233 ?smiles .
             SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }

It would be great if wdq could check for the HTTP return status (I believe server-side timeouts should set a proper one) and report it back to the user.

@nichtich
Copy link
Owner

Thanks for reporting. Could you please try wikibase-cli instead?

@merkys
Copy link
Author

merkys commented Sep 22, 2021

Thanks for suggestion. Although I prefer wdq due to its lightweight dependencies (all are system-provided by Debian/Ubuntu OSes).

@versant2612
Copy link

Hello, I received this error and I think it is due to timeout
invalid character encountered while parsing JSON string, at character offset 1355571275 (before "\nPREFIX prov: <http...") at /usr/local/share/perl/5.30.0/RDF/Trine/Iterator/JSONHandler.pm line 68.
Can you confirm?

@merkys
Copy link
Author

merkys commented Feb 3, 2023

@versant2612 this indeed seems very similar to what I am getting:

invalid character encountered while parsing JSON string, at character offset 172474431 (before "\nPREFIX wd: <http:/...") at /usr/share/perl5/JSON.pm line 190.

Do you get your error by using wdq or something else?

@versant2612
Copy link

@merkys using wdq.

@versant2612
Copy link

And I have another case that I didn't receive any error using wdq (it seems that there were no results because the header was printed) but the query timeout when execute in WDQS

PREFIX prov: http://www.w3.org/ns/prov#
PREFIX wikibase: http://wikiba.se/ontology#

SELECT ?referrer (count( ?ref) as ?ref_per_ref)
WHERE {
?ref ?referrer ?pr_obj .
VALUES ?referrer {pr:P854}
}
GROUP BY ?referrer

@merkys
Copy link
Author

merkys commented Feb 6, 2023

This seems easy to fix, if the wish is to get a proper error message only, which would be sufficient to me. @nichtich would you accept a PR if I create one?

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

3 participants