You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2020/02/15 23:31:16 UTC
[GitHub] [tinkerpop] Haapsaari-Juha opened a new pull request #1247: Null
checks added tp Connection.Parse
Haapsaari-Juha opened a new pull request #1247: Null checks added tp Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247
Added null check to Gremlin.Net.Driver.Connection.Parse method for receivedMsg variable and responseHandler. My first pull request to public repo, hope I did it correctly
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] dzmitry-lahoda commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
dzmitry-lahoda commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588212659
>> Parse and we notify the response handler about the exception.
Will not because message is null. There there is silent error eating.
Could we just check that deserialized object is not null and throw exception.
```
var receivedMsg = _messageSerializer.DeserializeMessage<ResponseMessage<JToken>>(received);
if (receivedMsg == null)
{
throw new Exception("receivedMsg");
}
```
To check what happens in case of null array passed, in case of empty array passed, and do property based testing for any other array passed. So it will be more explainable failure than just eating null.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] spmallette commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
spmallette commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-595322781
closing in favor of #1250
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] dzmitry-lahoda edited a comment on issue #1247:
TINKERPOP-2192 Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
dzmitry-lahoda edited a comment on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588212659
> Parse and we notify the response handler about the exception.
Will not because message is null. There there is silent error eating.
Could we just check that deserialized object is not null and throw exception.
```
var receivedMsg = _messageSerializer.DeserializeMessage<ResponseMessage<JToken>>(received);
if (receivedMsg == null)
{
throw new Exception("receivedMsg");
}
```
To check what happens in case of null array passed, in case of empty array passed, and do property based testing for any other array passed. So it will be more explainable failure than just eating null.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] dzmitry-lahoda commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
dzmitry-lahoda commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588658436
@FlorianHockmann I did change in my PR. Please review.
> property based testing
Given we do not have fix which only improves situation (like my PR), we would have to prove.
For this:
0. Check latest Json library and see it returns `object?` - so null is possible. DONE
1. Test with byte array being null, empty. What error we see?
2. Test byte array contains string "null", "", "[]", "{}", not null terminated string, etc.
3. Run generator of byte arrays with https://github.com/haf/expecto#property-based-tests (in C#)
Check that we never ever get null reference in this case. Or in some case we do. Than we should look into Json or into layer creating byte array. And have better semantics for error.
But this seems no needed for now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] spmallette closed pull request #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
spmallette closed pull request #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] spmallette commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
spmallette commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-587415435
i have no clue why docker is failing on the gremlin-python portion of the build. works fine for me locally - it's just doing `docker/build.sh` with no flags. not sure if anyone else can get it to fail locally...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] spmallette commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
spmallette commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-587421936
As a quick note @Haapsaari-Juha given that we are trying to quickly turn around a 3.4.6 release to fix a bug in 3.4.5:
https://lists.apache.org/thread.html/r7de7d160173d0774720b347122409bb6e46268613205b08edaa687ee%40%3Cdev.tinkerpop.apache.org%3E
it may take some extra time to see this change reviewed/merged.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] dzmitry-lahoda commented on issue #1247: TINKERPOP-2192
Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
dzmitry-lahoda commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588105418
Change looks pretty safe. Event check for `null` in message is kind of reasonable, because could return null https://github.com/JamesNK/Newtonsoft.Json/blob/a31156e90a14038872f54eb60ff0e9676ca4a0d8/Src/Newtonsoft.Json/JsonConvert.cs#L823 . Also at same time not sure if it hides bad JSON setting or other json related behind. Should we fail totally in this case?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] FlorianHockmann commented on issue #1247:
TINKERPOP-2192 Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
FlorianHockmann commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588122540
> Also at same time not sure if it hides bad JSON setting or other json related behind. Should we fail totally in this case?
We would still get an error in that case [from here](https://github.com/apache/tinkerpop/blob/master/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs#L136) where the `receivedMsg` is also accessed without a null check. If `receivedMsg` is `null` then `TryParseResponseMessage` will throw a `NullReferenceException` which will be caught by the try/catch in `Parse` and we notify the response handler about the exception.
I think that we should however ensure that we're not getting an exception in a `catch` clause.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services
[GitHub] [tinkerpop] FlorianHockmann commented on issue #1247:
TINKERPOP-2192 Null checks added to Connection.Parse
Posted by GitBox <gi...@apache.org>.
FlorianHockmann commented on issue #1247: TINKERPOP-2192 Null checks added to Connection.Parse
URL: https://github.com/apache/tinkerpop/pull/1247#issuecomment-588295619
> Will not because message is null. There there is silent error eating.
You're right. I should have looked taken a closer look.
> Could we just check that deserialized object is not null and throw exception.
Yes, I think that might be the best option as we expect the message to never be null. So, if for some reason is actually null, then we can throw an exception which will result in a call to `CloseConnectionBecauseOfFailureAsync` which closes the connection completely and notifies all existing response handlers about the exception.
@Haapsaari-Juha: I don't know if you want to incorporate these changes into your PR as you were the first to contribute a fix for this issue or if @dzmitry-lahoda should update his PR accordingly.
> property based testing for any other array passed
Could you explain a bit further what you mean by this? Do you want to add property based testing for the internal classes of the driver?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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
With regards,
Apache Git Services