Comments (10)
I'm sorry, I don't understand what you're asking / requesting. Can you please expand on what you expected to see and what you've received?
from redis-rs.
The program is fetching data from Redis, and after running for a certain period, it consistently gets stuck at the execution of the rpop
command. You can refer to the timestamps in the attached log screenshot, where there is a prolonged duration without any output. Prior to this, the log entries were consistently appearing in a cyclic pattern during the program's execution.
from redis-rs.
try replacing get_async_connection
with get_multiplexed_async_connection
. aio::Connection
is deprecated.
from redis-rs.
Tested once, although it can run for a long time, it seems that there is still a similar problem. I am currently conducting a second test.
from redis-rs.
try replacing
get_async_connection
withget_multiplexed_async_connection
.aio::Connection
is deprecated.
The problem still exists, it took over an hour to run this time.
from redis-rs.
network change get_multiplexed_async_connection
will get stuck too.
from redis-rs.
If you could write me a minimal, locally reproducible test, preferably using only redis-rs' test infrastructure, I could try to debug it. As it is, I don't have enough info to find the source of the issue.
from redis-rs.
I wrote a example. The operating system I'm using for testing is Windows 11, with the Redis service provided by a cloud server. If the CPU usage reaches or exceeds 90 percent, the issue can be reproduced quickly.
use redis::AsyncCommands;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
struct Sender {
redis_client: redis::Client,
queue: String,
}
impl Sender {
fn init(redis_addr: &str) -> anyhow::Result<Self> {
let redis_client = redis::Client::open(redis_addr)?;
Ok(Sender {
redis_client,
queue: "test-queue".to_owned(),
})
}
fn get_redis_client(&self) -> redis::Client {
self.redis_client.clone()
}
async fn save_to_redis(&self, data: String) -> anyhow::Result<()> {
let client = self.get_redis_client();
tracing::info!("Get redis connection");
let mut conn = client.get_multiplexed_async_connection().await?;
tracing::info!("Execute save command");
conn.lpush(&self.queue, data).await?;
tracing::info!("Save to redis succeed");
Ok(())
}
async fn run(self) -> anyhow::Result<()> {
self.save_to_redis("Test Data".to_owned()).await?;
let client = self.get_redis_client();
let mut conn = client.get_multiplexed_async_connection().await?;
loop {
tracing::info!("Fetching redis data");
let data: String = conn.rpop(&self.queue, None).await?;
if data.is_empty() {
tracing::error!("Data exception");
break;
}
tracing::info!("Data fetch succeed");
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
self.save_to_redis(data).await?;
tracing::info!("Finished once data submit");
}
Ok(())
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::registry()
.with(LevelFilter::INFO)
.with(tracing_subscriber::fmt::layer())
.init();
let redis_url = "redis://remote-server/";
let sender = Sender::init(redis_url)?;
tokio::spawn(sender.run());
tracing::info!("Thread started");
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
}
}
If modify main
method like this. will be able to see a specific error message Error: Password authentication failed- AuthenticationFailed
.If the same error occurred during blocking, I don't quite understand why this error message isn't being clearly displayed.
#[tokio::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::registry()
.with(LevelFilter::INFO)
.with(tracing_subscriber::fmt::layer())
.init();
let redis_url = "redis://remote-server";
let sender = Sender::init(redis_url)?;
sender.run().await?;
Ok(())
}
from redis-rs.
sorry, this doesn't reproduce the issue when I run it locally against a local redis server.
from redis-rs.
I believe I've found the underlying issue. The high CPU usage, coupled with the unstable network conditions of the remote server, could easily give rise to the Password authentication failed- AuthenticationFailed
error. It appears that I didn't handle this error properly, which in turn led to the termination of the thread's execution. To address this, I have now implemented additional recovery mechanisms. Thank you.
from redis-rs.
Related Issues (20)
- TypeError: "Response type not convertible to numeric" HOT 16
- Missing stream commands HOT 4
- Err(Password authentication failed- AuthenticationFailed) HOT 5
- Is there a way to use tokio + rustls +webpki-roots ? HOT 13
- Attempt to scan binary keys returns Invalid UTF-8- TypeError HOT 2
- Redis TTL command returns overflow values on unsigned int HOT 1
- in cluster mode, tls mode is replaced after certs() is called HOT 2
- Allowing the requirement of a tcp timeout when using sentinel as well as when using redis client directly HOT 4
- How to run the tests? HOT 1
- Question: How to use redis-rs to test a redis module written in rust? HOT 3
- Porposal: New Clients sharding to connect to multiple Redis Nodes but sharding at client level HOT 6
- Program hangs when explicitly setting TlsMode::Insecure HOT 4
- crate feature json does not support NX and XX args HOT 1
- Questions: about the async implementation of watch/multi/exec support HOT 2
- support maybe async HOT 1
- multiplex connection doesn't recover from ErrorKind::IoError HOT 5
- add ability to specify count for scan match HOT 2
- output stops around 15k messages. Can you please help with what's wrong with this example? HOT 12
- provide two-stage api for MultiplexedConnection HOT 6
- Things to complete for 0.26v HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-rs.