dotnetcore / CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
http://cap.dotnetcore.xyz
MIT License
6.71k stars 1.29k forks source link

Redis stream entry with id 1732000400810-0 missing cap headers #1611

Open zhangkeyuan opened 3 days ago

zhangkeyuan commented 3 days ago

[2024-11-19 21:02:51.692 ERR] [DotNetCore.CAP.RedisStreams.RedisConsumerClient] Redis stream entry with id 1732000400810-0 missing cap headers [2024-11-19 21:02:51.692 ERR] [DotNetCore.CAP.RedisStreams.RedisConsumerClient] Redis stream entry with id 1732000399858-0 missing cap headers [2024-11-19 21:02:51.692 ERR] [DotNetCore.CAP.Internal.ConsumerRegister] Kafka client consume error. --> System.ArgumentException: Redis stream entry with id 1732000400810-0 missing cap headers at DotNetCore.CAP.RedisStreams.RedisMessage.Create(StreamEntry streamEntry, String groupId) at DotNetCore.CAP.RedisStreams.RedisConsumerClient.<>c__DisplayClass24_0.<g__Consume|0>d.MoveNext()

使用RedisStreams 经常服务重启后会报 missing cap headers错误,清空CapSubscribe订阅的Redis Key后又恢复正常; 检查了代码都是通过ICapPublisher.PublishAsync发布的消息,理论上不应该出现没有headers的情况吧

MahmoudSamir101 commented 2 days ago

Could you please verify if the message in the Redis streams was created as Cap expected?

zhangkeyuan commented 2 days ago

Could you please verify if the message in the Redis streams was created as Cap expected?

A_1 A_2 A_3

yang-xiaodong commented 1 day ago

@zhangkeyuan Are there reproducible steps or examples for us to see?

MahmoudSamir101 commented 1 day ago

@zhangkeyuan , Additionally, you may inspect the message itself on Redis using the Redis Insights tool to verify its proper creation or the recevied table.

I noticed that the stack trace contains log messages from the Kafka consumer client. May I know if you are utilizing both Kafka and Redis in your project?

zhangkeyuan commented 1 day ago

@zhangkeyuan , Additionally, you may inspect the message itself on Redis using the Redis Insights tool to verify its proper creation or the recevied table.

I noticed that the stack trace contains log messages from the Kafka consumer client. May I know if you are utilizing both Kafka and Redis in your project?

Sorry, it is an occasional error and there is currently no way to reproduce it Only using Redis

zhangkeyuan commented 1 day ago

@zhangkeyuan , Additionally, you may inspect the message itself on Redis using the Redis Insights tool to verify its proper creation or the recevied table. I noticed that the stack trace contains log messages from the Kafka consumer client. May I know if you are utilizing both Kafka and Redis in your project?

Sorry, it is an occasional error and there is currently no way to reproduce it Only using Redis

1A 1B

MahmoudSamir101 commented 1 day ago

@zhangkeyuan , Additionally, you may inspect the message itself on Redis using the Redis Insights tool to verify its proper creation or the recevied table.

I noticed that the stack trace contains log messages from the Kafka consumer client. May I know if you are utilizing both Kafka and Redis in your project?

Sorry, it is an occasional error and there is currently no way to reproduce it Only using Redis

One of the reasons I can think of now for that issue is that the entry was created not by Cap. So we won't be sure about that unless you can check it directly on Redis streams using a client GUI tool like Redis Insights. Also, to make things clearer, we can add more info to our logs for these cases by logging the Redis value of that entry when errors happen.

MahmoudSamir101 commented 1 day ago

@zhangkeyuan , Additionally, you may inspect the message itself on Redis using the Redis Insights tool to verify its proper creation or the recevied table. I noticed that the stack trace contains log messages from the Kafka consumer client. May I know if you are utilizing both Kafka and Redis in your project?

Sorry, it is an occasional error and there is currently no way to reproduce it Only using Redis

1A 1B

This needs to be updated with Redis Streams values to resolve any conflicts in our logs with other transports.

MahmoudSamir101 commented 1 day ago

@zhangkeyuan , @yang-xiaodong

I'll make a PR for these changes over the weekend.

yang-xiaodong commented 2 hours ago

image

@MahmoudSamir101

Yes, The Pulsar, Redis Streams and Kafka used the same log type for logging, perhaps we should add a couple of generic log types.