Giter Club home page Giter Club logo

Comments (26)

2881099 avatar 2881099 commented on June 27, 2024

怎么重现问题。我测试没发现问题

from csredis.

kinsen avatar kinsen commented on June 27, 2024

这个问题很奇怪,Windows上没有出现,Linux频繁出现,目前还没发现100%复现的方式..

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

keys 查的参数是什么?
预计返回数据多少条,中间有没有特别长的keyname?
同样的参数,在redis-cli执行,是否正常?

截图多收集相关数据

from csredis.

2881099 avatar 2881099 commented on June 27, 2024
    public void ExpectType(RedisMessage expectedType)
    {
        RedisMessage type = ReadType();
        if ((int)type == -1)
            throw new EndOfStreamException("Unexpected end of stream; expected type '" + expectedType + "'");
        if (type != expectedType)
            throw new RedisProtocolException(String.Format("Unexpected response type: {0} (expecting {1})", type, expectedType));
    }

服务端返回-1,才会出这个错误

from csredis.

kinsen avatar kinsen commented on June 27, 2024

不是服务端返回-1,应该是流结束了..
查询的参数 一般为 AX*这样的. 长度不超过64.
cli中查询很正常.

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

我这里没办法重现问题啊,下面的代码测试没报错。

for (var a = 0; a < 50; a++) {
	new Thread(() => {
		for (int i = 0; i < 100; i++) {
			Task.Run(async () => {
				try {
					var keysall = RedisHelper.Keys("*");
					var keys = RedisHelper.Keys("lkjsdglkjskldgk*slkdgjlksdjgkl");

					Console.WriteLine(keys.Length + "/" + keysall.Length);
				} catch (Exception ex) {
					Console.WriteLine(ex);
				}

				await Task.Delay(200);
			}).Wait();
		}
	}).Start();
}

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

你那里可以必报错误吗?

from csredis.

zhyuxwz avatar zhyuxwz commented on June 27, 2024

会不会是因为redis的timeout配置的原因?我这边在将timeout配置为非0的值的时候也会遇到这样的问题

from csredis.

mirbeta avatar mirbeta commented on June 27, 2024

经常遇到这个问题....不管是windows和linux下

from csredis.

mirbeta avatar mirbeta commented on June 27, 2024

Unable to read data from the transport connection: 你的主机中的软件中止了一个已建立的连接。. ---> System.Net.Sockets.SocketException: 你的主机中的软件中止了一个已建立的连接。

Unexpected end of stream; expected type 'Bulk'

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

连接终止了,然后跟着读取数据不正确。

可下载源码搜索【Unexpected end of stream; expected type】,只有一个地方

from csredis.

JimReal avatar JimReal commented on June 27, 2024

我也遇到同样的问题,目前可以确定的是我这边使用HGetAllAsync方法是必现的,改为HGetAll不出现此问题,或许从异步方面排查会有线索,Linux服务器、3.0.53版本

from csredis.

yescent avatar yescent commented on June 27, 2024

使用 HGetAll方法时候出现,csreids 错误【10.0.0.36:6379/0】:Unexpected end of stream; expected type 'MultiBulk'; data = at CSRedis.CSRedisClient.GetAndExecute[T](RedisClientPool pool, Func`2 handler, Int32 jump, Int32 errtimes)

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

@JimReal @yescent 是必然出现的吗?增加 tryit=1 参数试试

from csredis.

yescent avatar yescent commented on June 27, 2024

@JimReal @yescent 是必然出现的吗?增加 tryit=1 参数试试

增加 tryit=1 还是报错
系统为linux,timeout设置为0

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

是否开启了 ssl

from csredis.

yescent avatar yescent commented on June 27, 2024

没有开启

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

使用同步方法呢?

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

是 HGetAllAsync 还是 HGetAll 出的错?

from csredis.

yescent avatar yescent commented on June 27, 2024

HGetAll

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

代码发出来看下

from csredis.

yescent avatar yescent commented on June 27, 2024
var csredis = new CSRedisClient(null,connectionString);
//初始化 RedisHelper
RedisHelper.Initialization(csredis);



public class RedisDb: IRedisDb
{
    public  List<T> HashGetAll<T>(string key)
    {
        List<T> list = new List<T>();
        try
        {
            return RedisHelper.HGetAll<T>(key)?.Select(x => x.Value).ToList();
        }
        catch (Exception) { }
        return list;
    }
}

from csredis.

JimReal avatar JimReal commented on June 27, 2024

var res = RedisHelper.HGetAllAsync(string.Format(gxin_users_{0}, id));
id是一个guid。

from csredis.

vincentelite avatar vincentelite commented on June 27, 2024

is there a solution ?we run into the same Dilemma.

from csredis.

JimReal avatar JimReal commented on June 27, 2024

There is nothing for the time being,you can try async or not async in two ways.

from csredis.

2881099 avatar 2881099 commented on June 27, 2024

Did redis-server turn SSL on?

from csredis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.