You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "wuxin2016 (via GitHub)" <gi...@apache.org> on 2023/01/31 06:40:39 UTC

[GitHub] [shardingsphere] wuxin2016 opened a new issue, #23857: Packet received out-of-order. Expected 1; got 2

wuxin2016 opened a new issue, #23857:
URL: https://github.com/apache/shardingsphere/issues/23857

   
   ### Which version of ShardingSphere did you use?
   5.3.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Use Entity frameworkcore paging queries to query the results。
   
   ### Actual behavior
   first step ,queried the count,it's OK. but queried the data,I got an exception
   ~~~C#
                 var data = source.Where(query).ProjectTo<TDto>();
                 result.TotalCount = await data.CountAsync(cancellationToken);
                 if (result.TotalCount > 0)
                 {
                     var mapData = data.OrderBy(page, defaultSort);
                     result.Data = await mapData.Skip(pageSize * (pageIndex - 1))
                         .Take(pageSize).ToListAsync(cancellationToken);
                 }
   ~~~
   
   Exception 
   ~~~C#
       An error occurred using the connection to database .....
   
    MySqlConnector.MySqlProtocolException: Packet received out-of-order. Expected 1; got 2.
            at MySqlConnector.Protocol.Serialization.ProtocolUtility.<DoReadPayloadAsync>g__AddContinuation|5_0(ValueTask`1 readPacketTask, BufferedByteReader bufferedByteReader, IByteHandler byteHandler, F
   unc`1 getNextSequenceNumber, ArraySegmentHolder`1 previousPayloads, ProtocolErrorBehavior protocolErrorBehavior, IOBehavior ioBehavior) in /_/src/MySqlConnector/Protocol/Serialization/ProtocolUtility.cs:
   line 476
            at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in /_/src/MySqlConnector/Core/ServerSession.cs:line 943
            at MySqlConnector.Core.ServerSession.TryResetConnectionAsync(ConnectionSettings cs, MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnect
   or/Core/ServerSession.cs:line 616
            at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/
   ConnectionPool.cs:line 65
            at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/
   ConnectionPool.cs:line 124
            at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnecti
   on.cs:line 915
            at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 406
            at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
            at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
            at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
            at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlRelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
            at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
            at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
            at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationTok
   en)
            at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   dbug: 2023/1/31 10:43:16.083 CoreEventId.ContextDisposed[10407] (Microsoft.EntityFrameworkCore.Infrastructure)
   ~~~
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   Asp.Net 6.0 ,MySQL ,Entityframework Core 6.0
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1409855894

   Hi @wuxin2016 
   Thanks for the feedback, can you provide the configuration and SQL statements, we need to be able to reproduce this problem during the investigation.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] wuxin2016 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "wuxin2016 (via GitHub)" <gi...@apache.org>.
wuxin2016 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1416640984

   > We created a simple example of .net core 6 + efcore, https://github.com/wuxin2016/efcore.demo/tree/master, you can use VSCode editor to debug, it supports mac and linux systems, download address https ://code.visualstudio.com, the above problem will also be reproduced in this example, Packet received out-of-order. Expected 1; got 2
   
   You can modify the connection string in the DeaultDbContext.cs file
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1421939907

   > We debugged and found that there was a request before disconnection, but there were two responses
   > ![4dd331b2cfc5a27929c0a11b08293f8](https://user-images.githubusercontent.com/6856843/217420543-769fa832-f2e7-4614-b7da-6f5f792210d3.png)
   > ![f236b04114c08d8bf4174edda510ce8](https://user-images.githubusercontent.com/6856843/217420578-92d8db86-d454-4f68-945a-54dcaadc554e.png)
   > ![a7b1c63239034548fc753f32d735806](https://user-images.githubusercontent.com/6856843/217420602-b28ba6f7-1241-43d5-99ca-8e0158b12ca8.png)
   
   Thanks for your input @alei78910 .
   I think the root cause is the two commands were sent at once. So Proxy returned incorrect Packet Number (Actual 2, expected 1).


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] wuxin2016 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "wuxin2016 (via GitHub)" <gi...@apache.org>.
wuxin2016 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1409881932

   > Hi @wuxin2016 Thanks for the feedback, can you provide the configuration and SQL statements, we need to be able to reproduce this problem during the investigation.
   
   proxy-configuation:
   ~~~yaml
   authority:
     privilege:
       type: ALL_PERMITTED
     users:
     - password: test
       user: test
   mode:
     repository:
       props:
         maxRetries: 3
         namespace: governance_ds
         operationTimeoutMilliseconds: 5000
         retryIntervalMilliseconds: 500
         server-lists: shardingsphere-proxy-zookeeper:2181
         timeToLiveSeconds: 60
       type: ZooKeeper
     type: Cluster
   props:
     proxy-frontend-database-protocol-type: MySQL
     sql-show: true
     sql-simple: false
   ~~~
   SQLs
   ~~~SQL
   ## 1 
   SELECT COUNT(*)
   FROM `AppLoginLogs` AS `a`
   WHERE (((`a`.`LoginStatus` = 1) AND (`a`.`LoginClientType` = 1)) AND (`a`.`UserId` = 11910177)) AND ((`a`.`CreationTime` >= '2023-01-10 01:43:10.922') AND (`a`.`CreationTime` <= '2023-01-15 01:43:15.587'
   ))
   
   ## 2
   SELECT `a`.`Id`, `a`.`CreationTime`, `a`.`CreatorUserId`, `a`.`EmployeeCode`, `a`.`EmployeeName`, `a`.`LoginClientType`, `a`.`LoginStatus`, `a`.`MtVersion`, `a`.`PhoneOS`
   FROM `AppLoginLogs` AS `a`
   WHERE (`a`.`LoginStatus` = 1) AND ((`a`.`CreationTime` >= '2023-01-10 01:43:10.922') AND (`a`.`CreationTime` <= '2023-01-15 01:43:15.587'))
   ORDER BY `a`.`CreationTime` DESC
   LIMIT 10 OFFSET 1
   ~~~
   
   The connection was closed after executing the first statement.
   When opened the connection again before executing the second statement , I got an exception above.
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] alei78910 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "alei78910 (via GitHub)" <gi...@apache.org>.
alei78910 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1410168826

   > Hi @wuxin2016 Could you help us reproduce this issue on macOS or Linux? We're not familiar with .NET 6.0. Or could you capture network packets by `tcpdump` or `Wireshark`?
   
   We use sokit (a software similar to Wireshark) to listen to the traffic of shardingsphere-proxy and find that it executes SELECT COUNT(*)... and returns query result data, but when executing the next statement, a TCP error occurs: The remote host closed the connection。
   ![image](https://user-images.githubusercontent.com/6856843/215744435-b341fe40-acdb-4e38-8584-2ce22c7af791.png)
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] alei78910 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "alei78910 (via GitHub)" <gi...@apache.org>.
alei78910 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1415458985

   The test found that shardingsphere-proxy will automatically disconnect after 300 or 320 seconds of idle time after the mysql client command line connection。
   ![image](https://user-images.githubusercontent.com/6856843/216563016-9175f4d4-d272-4304-a0d6-3ea59e3917db.png)
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] alei78910 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "alei78910 (via GitHub)" <gi...@apache.org>.
alei78910 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1421934518

   We debugged and found that there was a request before disconnection, but there were two responses
   ![4dd331b2cfc5a27929c0a11b08293f8](https://user-images.githubusercontent.com/6856843/217420543-769fa832-f2e7-4614-b7da-6f5f792210d3.png)
   ![f236b04114c08d8bf4174edda510ce8](https://user-images.githubusercontent.com/6856843/217420578-92d8db86-d454-4f68-945a-54dcaadc554e.png)
   ![a7b1c63239034548fc753f32d735806](https://user-images.githubusercontent.com/6856843/217420602-b28ba6f7-1241-43d5-99ca-8e0158b12ca8.png)
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1409964454

   Hi @wuxin2016 Could you help us reproduce this issue on macOS or Linux? We're not familiar with .NET 6.0.  


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] tristaZero closed issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "tristaZero (via GitHub)" <gi...@apache.org>.
tristaZero closed issue #23857: Packet received out-of-order. Expected 1; got 2
URL: https://github.com/apache/shardingsphere/issues/23857


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1415514393

   > The test found that shardingsphere-proxy will automatically disconnect after 300 or 320 seconds of idle time after the mysql client command line connection。 ![image](https://user-images.githubusercontent.com/6856843/216563016-9175f4d4-d272-4304-a0d6-3ea59e3917db.png)
   
   There is no such logic in ShardingSphere-Proxy. I think the disconnect might be performed by something between ShardingSphere-Proxy and MySQL client.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] alei78910 commented on issue #23857: Packet received out-of-order. Expected 1; got 2

Posted by "alei78910 (via GitHub)" <gi...@apache.org>.
alei78910 commented on issue #23857:
URL: https://github.com/apache/shardingsphere/issues/23857#issuecomment-1416636900

   We created a simple example of .net core 6 + efcore, https://github.com/wuxin2016/efcore.demo/tree/master, you can use VSCode editor to debug, it supports mac and linux systems, download address https ://code.visualstudio.com, the above problem will also be reproduced in this example, Packet received out-of-order. Expected 1; got 2


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org