You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/01/24 22:21:00 UTC
[jira] [Commented] (TINKERPOP-2139) Errors during request
serialization in WebSocketGremlinRequestEncoder/NioGremlinRequestEncoder
are not reported to the client
[ https://issues.apache.org/jira/browse/TINKERPOP-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16751640#comment-16751640 ]
ASF GitHub Bot commented on TINKERPOP-2139:
-------------------------------------------
spmallette commented on pull request #1047: TINKERPOP-2139 Properly handle client side serialization exceptions
URL: https://github.com/apache/tinkerpop/pull/1047
https://issues.apache.org/jira/browse/TINKERPOP-2139
Prior to this change serialization exceptions were basically just logged because any failure would signal a bad host and mark it as dead, but that's not really what was happening obviously if the client was never even able to try to send the message to the host in the first place. These sorts of client exceptions are now handled better and actually throw an exception that the calling client can see and utilize while not killing the host.
All tests pass with `docker/build.sh -t -n -i`
VOTE +1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
> Errors during request serialization in WebSocketGremlinRequestEncoder/NioGremlinRequestEncoder are not reported to the client
> -----------------------------------------------------------------------------------------------------------------------------
>
> Key: TINKERPOP-2139
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2139
> Project: TinkerPop
> Issue Type: Bug
> Components: driver
> Affects Versions: 3.4.1
> Reporter: Eduard Tudenhoefner
> Assignee: stephen mallette
> Priority: Major
>
> Running something like *client.submit(TinkerFactory.createModern().traversal().addV("x").property("c", Color.RED))* will fail with the below error rather than reporting what the actual error was:
> {code:java}
> io.netty.handler.codec.EncoderException: WebSocketGremlinRequestEncoder must produce at least one message.> is a io.netty.handler.codec.EncoderException
> {code}
> This seems to be because *WebSocketGremlinRequestEncoder#encode(..)* just logs the error, but doesn't report it back to the client.
> Throwing an exception in *encode()* reports it correctly back to the client, but the session will be closed.
> Putting the below test method into *GremlinDriverIntegrateTest* reproduces the issue:
> {code:java}
> @Test
> public void shouldReportErrorWhenRequestCantBeSerialized() throws ExecutionException, InterruptedException {
> final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V3D0).create();
> final Client client = cluster.connect().alias("g");
> try {
> final ResultSet results = client.submit(TinkerFactory.createModern().traversal().addV("x").property("c", Color.RED));
> results.all().get();
> fail("Should have thrown exception over bad serialization");
> } catch (Exception ex) {
> final Throwable inner = ExceptionUtils.getRootCause(ex);
> assertThat(inner, instanceOf(ResponseException.class));
> assertEquals(ResponseStatusCode.SERVER_ERROR_SERIALIZATION, ((ResponseException) inner).getResponseStatusCode());
> assertTrue(ex.getMessage().contains("An error occurred during serialization of this request"));
> assertTrue(ex.getMessage().contains("Serializer for type java.awt.Color not found"));
> }
> // should not die completely just because we had a bad serialization error. that kind of stuff happens
> // from time to time, especially in the console if you're just exploring.
> assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
> cluster.close();
> }{code}
> Tested with *3.4.1* but it most likely fails with other versions as well.
> This is the diff I had tested it with:
> {code:java}
> @@ -58,7 +61,9 @@ public final class WebSocketGremlinRequestEncoder extends MessageToMessageEncode
> objects.add(new TextWebSocketFrame(textSerializer.serializeRequestAsString(requestMessage)));
> }
> } catch (Exception ex) {
> - logger.warn(String.format("An error occurred during serialization of this request [%s] - it could not be sent to the server.", requestMessage), ex);
> + String errorMsg = String.format("An error occurred during serialization of this request [%s] - it could not be sent to the server - Reason: %s", requestMessage, ex);
> + logger.warn(errorMsg, ex);
> + throw new ResponseException(ResponseStatusCode.SERVER_ERROR_SERIALIZATION, errorMsg);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)