neo4j / neo4j-dotnet-driver

Neo4j Bolt driver for .NET
Apache License 2.0
232 stars 69 forks source link

System.ArgumentOutOfRangeException: Expected a struct, but got: A1 Parameter name: markerByte Actual value was 161. #140

Closed Meatballs1 closed 7 years ago

Meatballs1 commented 7 years ago
System.ArgumentOutOfRangeException: Expected a struct, but got: A1
Parameter name: markerByte
Actual value was 161.
  at Neo4j.Driver.Internal.Packstream.PackStream+Unpacker.UnpackStructHeader () [0x00075] in <9150069943ec4fab840358b2a188b25d>:0
  at Neo4j.Driver.Internal.Packstream.PackStreamMessageFormatV1+ReaderV1.Read (Neo4j.Driver.Internal.Messaging.IMessageResponseHandler responseHandler) [0x00000] in <9150069943ec4fab840358b2a188b25d>:0
  at Neo4j.Driver.Internal.Connector.SocketClient.ReceiveOne (Neo4j.Driver.Internal.Messaging.IMessageResponseHandler responseHandler) [0x00000] in <9150069943ec4fab840358b2a188b25d>:0
Meatballs1 commented 7 years ago

v1.1.0-SNAPSHOT-1608031116

zhenlineo commented 7 years ago

Hello, could you upgrade to the latest stable 1.1.0 version of this driver? Release

Let me know if the problem still exists.

Cheers, Zhen

Meatballs1 commented 7 years ago

Hi @zhenlineo I have been trying to using myget but get the following error:

Could not install package 'Neo4j.Driver 1.1.0-SNAPSHOT-1701200833'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Using Xamarin Studio/Mono to develop

Meatballs1 commented 7 years ago

Looking at the nuget package folders the old snapshot has portable-win8+net45+wp8 but the latest snapshot only has netstandard1.0. Both have a dotnet folder

zhenlineo commented 7 years ago

The new 1.1 driver requires .NET Standard 1.3, which requires 4.6 .NET Framework.

What's the problem to use 1.0.2 driver then? Is it use too much memory use for your application? Or does it also have the same Expected a struct, but got: A1 issue? Otherwise, do use nuget rather than any snapshots in myget.

Meatballs1 commented 7 years ago

1.0.2 -> 1.1.0 was where the full query results stopped being retrieved in one go and were requested as needed by the enumerator? I think I definitely needed that bit...

zhenlineo commented 7 years ago

Yes, the streaming of the result is introduced in 1.1. I do not think we could help to fix your issue on a snapshot version. I could hardly help if you cannot upgrade version :(

I am so sorry that we bumped the version, the call for support donet core was high. The tls encryption requires .net stranded 1.3 so that's the lowest version we could go for.

If say you requires a support for other versions of .net framework, maybe you could start a new issue to ask for it?

gsasch commented 7 years ago

I've update to version 1.1.1 but i've the same error: An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Neo4j.Driver.dll Additional information: Expected a struct, but got: 63

Expected a struct, but got: 63 Parameter name: markerByte Actual value was 99.

This is the custom procedure call: call checkDataConsistency() yield consistencyResult return *

and this is the response in json:

{ "columns": [ "consistencyResult" ], "data": [ { "row": [ { "subVerify": { "consistencyReport": { "Details": [ "row 1: checked YES", "row 2: checked YES" ], "RowUpdated": 2 } }, "clashingVerify": { "consistencyReport": { "Details": [ "row 1: checked YES", "row 2: checked YES" ], "RowUpdated": 2 } } } ], "meta": [ null, null ], "graph": { "nodes": [], "relationships": [] } } ], "stats": { "contains_updates": false, "nodes_created": 0, "nodes_deleted": 0, "properties_set": 0, "relationships_created": 0, "relationship_deleted": 0, "labels_added": 0, "labels_removed": 0, "indexes_added": 0, "indexes_removed": 0, "constraints_added": 0, "constraints_removed": 0 } }

mode exception details:

System.ArgumentOutOfRangeException was unhandled HResult=-2146233086 Message=Expected a struct, but got: 63 Parameter name: markerByte Actual value was 99. ParamName=markerByte Source=Neo4j.Driver StackTrace: at Neo4j.Driver.Internal.Connector.SocketConnection.ReceiveOne() in Z:\BuildAgent\work\9ae188c903d07190\Neo4j.Driver\Neo4j.Driver\Internal\Connector\SocketConnection.cs:line 154 at Neo4j.Driver.Internal.Result.ResultBuilder.NextRecord() in Z:\BuildAgent\work\9ae188c903d07190\Neo4j.Driver\Neo4j.Driver\Internal\Result\ResultBuilder.cs:line 80 at Neo4j.Driver.Internal.Result.RecordSet.<Records>d__7.MoveNext() in Z:\BuildAgent\work\9ae188c903d07190\Neo4j.Driver\Neo4j.Driver\Internal\Result\RecordSet.cs:line 53 at Neo4J_SaceExtendedGroups.Program.checkConsistencyCall() at Neo4J_SaceExtendedGroups.Program.Main(String[] args) at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

thanks

zhenlineo commented 7 years ago

Hi @gsasch

How open do you receive this? Do you always get the error for this specific procedure call no matter when and where you call the procedure? Or it is like a phantom error that comes randomly in any location or in any query?

gsasch commented 7 years ago

Hi, i receive this error only when i call the procedure with bolt driver in .net project. The response is correct when i call it with cypher in http browser. this is the c# procedure in bold the line that catch the exception:

bool RetVal = false; using (var driver = GraphDatabase.Driver("bolt://" + ServerHost_Neo4J, AuthTokens.Basic(User_Neo4J, Password_Neo4J))) using (var session = driver.Session()) { string Neo4J_Q = @"call checkDataConsistency() yield consistencyResult return *"; var result = session.Run(Neo4J_Q); } thanks

gsasch commented 7 years ago

The result in C# is different after i made some changes in result data. I remove the "consistencyReport" object and then i move the subobjects "Details" and "RowUpdated" under the "consistencyResult" column:

The result with Bolt is an empty response in IRecord interface.. :(

The new json response now is: { "columns": [ "consistencyResult" ], "data": [ { "row": [ { "subVerify": { "Details": [ "Row Update: YES", "Row Update: YES" ], "RowUpdated": 2 }, "clashingVerify": { "Details": [ "Row Update: YES", "Row Update: YES" ], "RowUpdated": 2 } } ], "meta": [ null, null ], "graph": { "nodes": [ "" ], "relationships": [ "" ] } } ], "stats": { "contains_updates": false, "nodes_created": 0, "nodes_deleted": 0, "properties_set": 0, "relationships_created": 0, "relationship_deleted": 0, "labels_added": 0, "labels_removed": 0, "indexes_added": 0, "indexes_removed": 0, "constraints_added": 0, "constraints_removed": 0 } }

zhenlineo commented 7 years ago

This driver does not use any format that is similar to http json, instead this driver is using bolt binary protocol. When you use .net driver, could you turn on the logging on level Trace to catch the binaries between the server and the driver? (or use wireshark without encryption on connection to catch the binaries in TCP connections.) I would like to have the binary that you send between the server and client to figure out if there is a mismatch in the bolt encoding and decoding code.

Also you might get empty response if you did not iterating on the result as the records are lazily pulled. Try foreach(var record : result) to see if you get anything inside.

gsasch commented 7 years ago

Thanks, i resolve. The problem was written here: https://neo4j.com/docs/api/dotnet-driver/current/html/11b5f90b-435c-d657-08e8-bc6df823eff4.htm This method could be called multiple times. If no more record could be consumed then calling this method has the same effect of calling Summary.

So why i had an empty response. I added a fake line like this before read the result: if (result.Summary.Counters.LabelsAdded > 0) { }

and all work perfectly! :) thanks for your support

zhenlineo commented 7 years ago

Hi, I am closing this issue as I cannot see if the problem still exists in the newer releases.

Pls be free to open the issue again if you see the error again with a released driver.

Cheers, Zhen