This is an automated email from the ASF dual-hosted git repository.
jmjoy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-php.git
The following commit(s) were added to refs/heads/master by this push:
new 8ad379f Fix php-fpm freeze after large amount of request. (#39)
8ad379f is described below
commit 8ad379fa9bcbf7ddaf36712cfc20bfb838c26868
Author: jmjoy <[email protected]>
AuthorDate: Sat Jan 7 11:28:07 2023 +0800
Fix php-fpm freeze after large amount of request. (#39)
---
src/plugin/mod.rs | 16 ++++++++--------
src/worker.rs | 8 +++++---
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs
index 070185c..e16ad07 100644
--- a/src/plugin/mod.rs
+++ b/src/plugin/mod.rs
@@ -27,14 +27,14 @@ use once_cell::sync::Lazy;
// Register plugins here.
static PLUGINS: Lazy<Vec<Box<DynPlugin>>> = Lazy::new(|| {
vec![
- Box::new(plugin_curl::CurlPlugin::default()),
- Box::new(plugin_pdo::PdoPlugin::default()),
- Box::new(plugin_mysqli::MySQLImprovedPlugin::default()),
- Box::new(plugin_swoole::SwooleServerPlugin::default()),
- Box::new(plugin_swoole::SwooleHttpResponsePlugin::default()),
- Box::new(plugin_predis::PredisPlugin::default()),
- Box::new(plugin_memcached::MemcachedPlugin::default()),
- Box::new(plugin_redis::RedisPlugin::default()),
+ Box::<plugin_curl::CurlPlugin>::default(),
+ Box::<plugin_pdo::PdoPlugin>::default(),
+ Box::<plugin_mysqli::MySQLImprovedPlugin>::default(),
+ Box::<plugin_swoole::SwooleServerPlugin>::default(),
+ Box::<plugin_swoole::SwooleHttpResponsePlugin>::default(),
+ Box::<plugin_predis::PredisPlugin>::default(),
+ Box::<plugin_memcached::MemcachedPlugin>::default(),
+ Box::<plugin_redis::RedisPlugin>::default(),
]
});
diff --git a/src/worker.rs b/src/worker.rs
index d82674c..1a8d63d 100644
--- a/src/worker.rs
+++ b/src/worker.rs
@@ -32,7 +32,7 @@ use tokio::{
runtime::{self, Runtime},
select,
signal::unix::{signal, SignalKind},
- sync::mpsc,
+ sync::mpsc::{self, error::TrySendError},
time::sleep,
};
use tonic::{
@@ -153,9 +153,11 @@ async fn start_worker(server_addr: String) {
Ok(i) => Ok(i),
};
- if let Err(err) = tx.send(r).await {
+ if let Err(err) = tx.try_send(r) {
error!(?err, "Send failed");
- return;
+ if !matches!(err, TrySendError::Full(_)) {
+ return;
+ }
}
}
});