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

Error Handling: Multiple server.log errors indicating http 406 Not Acceptable #7134

Closed
kcondon opened this issue Jul 27, 2020 · 4 comments · Fixed by #7170
Closed

Error Handling: Multiple server.log errors indicating http 406 Not Acceptable #7134

kcondon opened this issue Jul 27, 2020 · 4 comments · Fixed by #7170
Milestone

Comments

@kcondon
Copy link
Contributor

kcondon commented Jul 27, 2020

Seeing this in the logs, without tying it to a specific user action, though I am testing the download all api:

[2020-07-22T08:52:30.214+0000] [Payara 5.201] [SEVERE] [] [edu.harvard.iq.dataverse.api.errorhandlers.ThrowableHandler] [tid: _ThreadID=92 _ThreadName=http-thread-pool::jk-connector(5)] [timeMillis: 1595407950214] [levelValue: 1000] [[
Uncaught REST API exception:
Incident: 39be6b43-cbbf-4dc9-a19a-484f413872a3
URL: https://dataverse-internal.iq.harvard.edu/api/v1/datasets/export?exporter=dcterms&persistentId=doi%3A10.70122%2FFK2%2FEVQ2OH
Method: GET
javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable

@qqmyers Has made the following comments:
ThrowableHandler was added prior to #7085. When it was added, it stopped the default handing for exceptions such as javax.ws.rs.NotAcceptableException . What #7085 did was to add more exception/http code-specific handlers to manage the ones Dataverse source throws so that they don't get caught be the new default ThrowableHandler. My guess is that javax.ws.rs.NotAcceptableException is being thrown by the framework code rather than Dataverse source code, so I didn't add a specific handler for it. The fix is probably to just add yet-another handler for this specific exception and just send a 406 response as intended. The Redirect handler is probably a good example.

@kcondon kcondon added this to the Dataverse 5 milestone Jul 27, 2020
@kcondon kcondon changed the title Error Handling: Multiple server.log errors indicating http 406 Not Acceptible Error Handling: Multiple server.log errors indicating http 406 Not Acceptable Jul 27, 2020
@qqmyers
Copy link
Member

qqmyers commented Jul 27, 2020

FWIW - datasets/export can produce "application/xml", "application/json", or "application/html". My guess is that if someone makes an API call requesting something other than one of those, it's a 406.

@poikilotherm
Copy link
Contributor

poikilotherm commented Jul 27, 2020

@qqmeyers @pdurbin Should we try instead of adding more handlers for them whether we can replace lots of 'em by matching on the base class in one handler?

Those specific cases of special formating can still be handled by a separate handler... I'm not 100% sure this works, but willing to try.

If you want I can look into this tomorrow morning.

@qqmyers
Copy link
Member

qqmyers commented Jul 27, 2020

@poikilotherm - refactoring would make sense - even the ones that do custom logging are very similar. (I also don't know if one could simply rethrow from the ThrowableHandler if its one of the WebAppExceptions.) If you have time to try things out tomorrow, I'd say go for it. Thanks!

poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
…or ArrayOutOfBoundsException, NullPointerException and ServeletException perfectly replaced by ThrowableHandler. IQSS#7134
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 28, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 29, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 29, 2020
… JSONResponseBuilder for crafting responses and logging. IQSS#7134
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Jul 29, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
…or ArrayOutOfBoundsException, NullPointerException and ServeletException perfectly replaced by ThrowableHandler. IQSS#7134
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
… JSONResponseBuilder for crafting responses and logging. IQSS#7134
poikilotherm added a commit to poikilotherm/dataverse that referenced this issue Aug 10, 2020
@poikilotherm
Copy link
Contributor

As requested by @scolapasta, I created a code only PR #7170 to solve this particular issue.

Added a new issue about a bigger sized refactoring in #7171 and add first draft with a docs-first approach in #7172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants