Cassandra Thrift 异常:现有连接被远程主机强制关闭

发布于 2024-12-20 04:02:26 字数 3195 浏览 2 评论 0原文

我在向列插入大值时遇到问题,值 byte[] 长度为 25130744(从 DataSet 转换为 byte[]),并给我一个异常:IOException:无法从传输连接读取数据:现有连接被远程主机强行关闭。

有人知道原因吗?小列值工作正常。 Aquiles 或 Cassandra 服务器中是否存在数据大小限制或请求超时限制?

Cassandra version: 1.0.2, Aquiles version: 1.0, .NET Framework 4.0

这是详细信息:

Server Error in '/test' Application.

An existing connection was forcibly closed by the remote host

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Source Error: 


Line 482: public void recv_insert()
Line 483: {
Line 484: TMessage msg = iprot_.ReadMessageBegin();
Line 485: if (msg.Type == TMessageType.Exception) {
Line 486: TApplicationException x = TApplicationException.Read(iprot_);

Source File: D:\codeplex\Aquiles\trunk\Aquiles.Cassandra10\Apache\Cassandra\Cassandra.cs Line: 484 

Stack Trace: 


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +245

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +7768653
Thrift.Transport.TStreamTransport.Read(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TStreamTransport.cs:84
Thrift.Transport.TTransport.ReadAll(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TTransport.cs:54
Thrift.Transport.TFramedTransport.ReadFrame() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TFramedTransport.cs:90
Thrift.Transport.TFramedTransport.Read(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TFramedTransport.cs:83
Thrift.Transport.TTransport.ReadAll(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TTransport.cs:54
Thrift.Protocol.TBinaryProtocol.ReadI32() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Protocol\TBinaryProtocol.cs:338
Thrift.Protocol.TBinaryProtocol.ReadMessageBegin() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Protocol\TBinaryProtocol.cs:220
Apache.Cassandra.Client.recv_insert() in D:\codeplex\Aquiles\trunk\Aquiles.Cassandra10\Apache\Cassandra\Cassandra.cs:484
DataAccessLib.CassandraAccess.<>c__DisplayClass28.<InsertCommand>b__27(Client client) in C:\TestProject\Class1.cs:746

[ExecutionBlockException: Exception 'Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.' during executing command. See inner exception for further details.]
Aquiles.Core.Cluster.Impl.DefaultCluster.Execute(Delegate executionBlock, String keyspaceName, ConnectionConfig overrideConnectionConfig) in D:\codeplex\Aquiles\trunk\Aquiles.Core\Cluster\Impl\DefaultCluster.cs:191

i encounter a problem when inserting a large value to a column, the value byte[]
length is 25130744 (converted from DataSet to byte[]), and gives me an exception: IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Anyone know the reason? Small column values work fine. Are there some data size limit or request timeout limit in Aquiles or Cassandra server?

Cassandra version: 1.0.2, Aquiles version: 1.0, .NET Framework 4.0

Here is the detailed info:

Server Error in '/test' Application.

An existing connection was forcibly closed by the remote host

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

Source Error: 


Line 482: public void recv_insert()
Line 483: {
Line 484: TMessage msg = iprot_.ReadMessageBegin();
Line 485: if (msg.Type == TMessageType.Exception) {
Line 486: TApplicationException x = TApplicationException.Read(iprot_);

Source File: D:\codeplex\Aquiles\trunk\Aquiles.Cassandra10\Apache\Cassandra\Cassandra.cs Line: 484 

Stack Trace: 


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +245

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +7768653
Thrift.Transport.TStreamTransport.Read(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TStreamTransport.cs:84
Thrift.Transport.TTransport.ReadAll(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TTransport.cs:54
Thrift.Transport.TFramedTransport.ReadFrame() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TFramedTransport.cs:90
Thrift.Transport.TFramedTransport.Read(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TFramedTransport.cs:83
Thrift.Transport.TTransport.ReadAll(Byte[] buf, Int32 off, Int32 len) in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Transport\TTransport.cs:54
Thrift.Protocol.TBinaryProtocol.ReadI32() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Protocol\TBinaryProtocol.cs:338
Thrift.Protocol.TBinaryProtocol.ReadMessageBegin() in d:\thrift-0.6.0\thrift-0.6.0\lib\csharp\src\Protocol\TBinaryProtocol.cs:220
Apache.Cassandra.Client.recv_insert() in D:\codeplex\Aquiles\trunk\Aquiles.Cassandra10\Apache\Cassandra\Cassandra.cs:484
DataAccessLib.CassandraAccess.<>c__DisplayClass28.<InsertCommand>b__27(Client client) in C:\TestProject\Class1.cs:746

[ExecutionBlockException: Exception 'Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.' during executing command. See inner exception for further details.]
Aquiles.Core.Cluster.Impl.DefaultCluster.Execute(Delegate executionBlock, String keyspaceName, ConnectionConfig overrideConnectionConfig) in D:\codeplex\Aquiles\trunk\Aquiles.Core\Cluster\Impl\DefaultCluster.cs:191

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔少女心 2024-12-27 04:02:26

cassandra.yaml 中有一个设置可以控制最大 thrift 消息大小。默认为 16 MB。

thrift_max_message_length_in_mb: 16

您可以更新该设置以发送更大的消息。请记住,该设置适用于整个消息,包括一些开销,因此您需要将其设置为高于要发送的列的实际大小。

理论上,您可以将此设置增加到千兆字节范围,但这几乎肯定不是一个好主意。整个 thrift 消息需要适合内存,并且默认的 rpc 超时设置也可能需要更改。

我会考虑将您的列分成更小的子列,而不是增加该设置。

There is a setting in cassandra.yaml that controls the maximum thrift message size. It defaults to 16 megabytes.

thrift_max_message_length_in_mb: 16

You can update that setting in order to send larger messages. Keep in mind that the setting applies to the entire message including some overhead, so you will need to set it higher than the actual size of the column you are sending.

Theoretically you can increase this setting to the gigabyte range, but it is almost certainly not a good idea. The entire thrift message is going to need to fit in memory and the default rpc timeout settings may also have to be changed.

I would consider chunking your column into smaller sub columns rather than increasing that setting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文