[brpc] branch master updated: add max concurrency for timeout concurrency limiter (#2087)

2023-01-15 Thread wwbmmm
This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new c9dc47a0 add max concurrency for timeout concurrency limiter (#2087)
c9dc47a0 is described below

commit c9dc47a00ef92908c7708d15456b33e8d465c730
Author: Yang,Liming 
AuthorDate: Mon Jan 16 15:52:36 2023 +0800

add max concurrency for timeout concurrency limiter (#2087)
---
 src/brpc/policy/timeout_concurrency_limiter.cpp | 13 ++---
 src/brpc/policy/timeout_concurrency_limiter.h   |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/brpc/policy/timeout_concurrency_limiter.cpp 
b/src/brpc/policy/timeout_concurrency_limiter.cpp
index d35f1c03..94ee8df4 100644
--- a/src/brpc/policy/timeout_concurrency_limiter.cpp
+++ b/src/brpc/policy/timeout_concurrency_limiter.cpp
@@ -48,6 +48,9 @@ DEFINE_double(
 "the configuration item, the more aggressive the penalty strategy.");
 DEFINE_int32(timeout_cl_default_timeout_ms, 500,
  "Default timeout for rpc request");
+DEFINE_int32(timeout_cl_max_concurrency, 100,
+ "When average latency statistics not refresh, this flag can keep "
+ "requests not exceed this max concurrency");
 
 TimeoutConcurrencyLimiter::TimeoutConcurrencyLimiter()
 : _avg_latency_us(FLAGS_timeout_cl_initial_avg_latency_us),
@@ -58,12 +61,14 @@ TimeoutConcurrencyLimiter *TimeoutConcurrencyLimiter::New(
 return new (std::nothrow) TimeoutConcurrencyLimiter;
 }
 
-bool TimeoutConcurrencyLimiter::OnRequested(int, Controller *cntl) {
+bool TimeoutConcurrencyLimiter::OnRequested(int current_concurrency,
+Controller *cntl) {
 auto timeout_ms = FLAGS_timeout_cl_default_timeout_ms;
 if (cntl != nullptr && cntl->timeout_ms() != UNSET_MAGIC_NUM) {
 timeout_ms = cntl->timeout_ms();
 }
-return _avg_latency_us < timeout_ms * 1000;
+return current_concurrency <= FLAGS_timeout_cl_max_concurrency &&
+   _avg_latency_us < timeout_ms * 1000;
 }
 
 void TimeoutConcurrencyLimiter::OnResponded(int error_code,
@@ -94,7 +99,9 @@ void TimeoutConcurrencyLimiter::OnResponded(int error_code,
 }
 }
 
-int TimeoutConcurrencyLimiter::MaxConcurrency() { return 0; }
+int TimeoutConcurrencyLimiter::MaxConcurrency() {
+return FLAGS_timeout_cl_max_concurrency;
+}
 
 bool TimeoutConcurrencyLimiter::AddSample(int error_code, int64_t latency_us,
   int64_t sampling_time_us) {
diff --git a/src/brpc/policy/timeout_concurrency_limiter.h 
b/src/brpc/policy/timeout_concurrency_limiter.h
index 716df577..ca045dd6 100644
--- a/src/brpc/policy/timeout_concurrency_limiter.h
+++ b/src/brpc/policy/timeout_concurrency_limiter.h
@@ -27,7 +27,7 @@ class TimeoutConcurrencyLimiter : public ConcurrencyLimiter {
public:
 TimeoutConcurrencyLimiter();
 
-bool OnRequested(int, Controller* cntl) override;
+bool OnRequested(int current_concurrency, Controller* cntl) override;
 
 void OnResponded(int error_code, int64_t latency_us) override;
 


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] wwbmmm merged pull request #2087: add max concurrency for timeout concurrency limiter

2023-01-15 Thread GitBox


wwbmmm merged PR #2087:
URL: https://github.com/apache/brpc/pull/2087


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[brpc] branch master updated: fix doc && code style (#2089)

2023-01-15 Thread wwbmmm
This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new 645cebd2 fix doc && code style (#2089)
645cebd2 is described below

commit 645cebd21eca8eefb9fe0d835974ecc039df7a2a
Author: caidj <31362185+cdjin...@users.noreply.github.com>
AuthorDate: Mon Jan 16 14:27:31 2023 +0800

fix doc && code style (#2089)
---
 docs/cn/mbvar_c++.md| 2 ++
 src/brpc/parallel_channel.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/cn/mbvar_c++.md b/docs/cn/mbvar_c++.md
index 4abe2f6b..b7a0d417 100644
--- a/docs/cn/mbvar_c++.md
+++ b/docs/cn/mbvar_c++.md
@@ -199,6 +199,7 @@ class MVariable {
 | mbvar_dump_format| common | Dump mbvar write format  
common:文本格式,Key和Value用冒号分割(和目前的单维度dump文件格式一致)  
prometheus:文本格式,Key和Value用空格分开protobuf:二进制格式,暂时不支持|
 | bvar_dump_interval | 10 |Seconds between consecutive dump |
 | mbvar_dump_prefix | \ | Every dumped name starts with this prefix |
+| bvar_max_dump_multi_dimension_metric_number | 0 | 
最多导出的mbvar的bvar个数,默认是0,即不导出任何mbvar |
 
 用户可在程序启动前加上对应的gflags。
 
@@ -212,6 +213,7 @@ class MVariable {
 | mbvar_dump_format| common | Dump mbvar write format  
common:文本格式,Key和Value用冒号分割(和目前的单维度dump文件格式一致)  
prometheus:文本格式,Key和Value用空格分开protobuf:二进制格式,暂时不支持|
 | bvar_dump_interval | 10 |Seconds between consecutive dump |
 | mbvar_dump_prefix | mbvar | Every dumped name starts with this prefix |
+| bvar_max_dump_multi_dimension_metric_number | 2000 | 
最多导出的mbvar的bvar个数,默认是0,即不导出任何mbvar |
 
 导出的本地文件为monitor/mbvar.\.data:
 ```
diff --git a/src/brpc/parallel_channel.h b/src/brpc/parallel_channel.h
index 3ee8d58a..aa2739a2 100644
--- a/src/brpc/parallel_channel.h
+++ b/src/brpc/parallel_channel.h
@@ -94,7 +94,7 @@ struct SubCall {
 class CallMapper : public SharedObject {
 public:
 virtual SubCall Map(int channel_index/*starting from 0*/,
-   int channel_count,
+int channel_count,
 const google::protobuf::MethodDescriptor* method,
 const google::protobuf::Message* request,
 google::protobuf::Message* response) {


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] wwbmmm merged pull request #2089: WIP: fix doc && code style

2023-01-15 Thread GitBox


wwbmmm merged PR #2089:
URL: https://github.com/apache/brpc/pull/2089


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] cdjingit opened a new pull request, #2089: WIP: fix doc && code style

2023-01-15 Thread GitBox


cdjingit opened a new pull request, #2089:
URL: https://github.com/apache/brpc/pull/2089

   ### What problem does this PR solve?
   fix code style and doc
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[brpc] branch master updated: Explicitly listing all third-part licensed files (#2088)

2023-01-15 Thread wwbmmm
This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new 0448075c Explicitly listing all third-part licensed files (#2088)
0448075c is described below

commit 0448075c8ce9774ef891d38b6ca6de4466b70e22
Author: Xiaofeng Wang 
AuthorDate: Mon Jan 16 14:06:27 2023 +0800

Explicitly listing all third-part licensed files (#2088)
---
 LICENSE | 136 +++-
 1 file changed, 135 insertions(+), 1 deletion(-)

diff --git a/LICENSE b/LICENSE
index 0d7ec6a3..feac1ef6 100644
--- a/LICENSE
+++ b/LICENSE
@@ -757,7 +757,141 @@ src/brpc/callback.h: 3-clause BSD
 
 

 
-src/butil/(some files), test/(some files): 3-clause BSD
+src/butil/at_exit.*
+src/butil/atomic*
+src/butil/auto_reset.h
+src/butil/base64.*
+src/butil/base_export.h
+src/butil/base_paths.cc
+src/butil/basictypes.h
+src/butil/big_endian.*
+src/butil/bits.h
+src/butil/build_config.h
+src/butil/cancelable_callback.h
+src/butil/compiler_specific.h
+src/butil/containers/*
+src/butil/cpu.*
+src/butil/debug/*
+src/butil/environment.*
+src/butil/file_*
+src/butil/files/dir_reader_fallback.h
+src/butil/files/dir_reader_linux.h
+src/butil/files/dir_reader_posix.h
+src/butil/files/file.*
+src/butil/files/file_enumerator*
+src/butil/files/file_p*
+src/butil/files/memory_mapped_file*
+src/butil/files/scoped*
+src/butil/float_util.h
+src/butil/format_macros.h
+src/butil/gtest_prod_util.h
+src/butil/guid.cc
+src/butil/guid.h
+src/butil/guid_posix.cc
+src/butil/hash.cc
+src/butil/hash.h
+src/butil/lazy_instance.cc
+src/butil/lazy_instance.h
+src/butil/location.cc
+src/butil/location.h
+src/butil/mac/bundle_locations.h
+src/butil/mac/bundle_locations.mm
+src/butil/mac/foundation_util.h
+src/butil/mac/foundation_util.mm
+src/butil/mac/scoped_cftyperef.h
+src/butil/mac/scoped_mach_port.cc
+src/butil/mac/scoped_mach_port.h
+src/butil/mac/scoped_typeref.h
+src/butil/macros.h
+src/butil/memory/aligned_memory.cc
+src/butil/memory/aligned_memory.h
+src/butil/memory/linked_ptr.h
+src/butil/memory/manual_constructor.h
+src/butil/memory/raw_scoped_refptr_mismatch_checker.h
+src/butil/memory/ref_counted.cc
+src/butil/memory/ref_counted.h
+src/butil/memory/ref_counted_memory.cc
+src/butil/memory/ref_counted_memory.h
+src/butil/memory/scoped_open_process.h
+src/butil/memory/scoped_policy.h
+src/butil/memory/scoped_ptr.h
+src/butil/memory/scoped_vector.h
+src/butil/memory/singleton.cc
+src/butil/memory/singleton.h
+src/butil/memory/singleton_objc.h
+src/butil/memory/weak_ptr.cc
+src/butil/memory/weak_ptr.h
+src/butil/move.h
+src/butil/numerics/safe_conversions.h
+src/butil/numerics/safe_conversions_impl.h
+src/butil/numerics/safe_math.h
+src/butil/numerics/safe_math_impl.h
+src/butil/observer_list.h
+src/butil/port.h
+src/butil/posix/eintr_wrapper.h
+src/butil/posix/file_descriptor_shuffle.cc
+src/butil/posix/file_descriptor_shuffle.h
+src/butil/posix/global_descriptors.cc
+src/butil/posix/global_descriptors.h
+src/butil/rand_util.cc
+src/butil/rand_util.h
+src/butil/rand_util_posix.cc
+src/butil/safe_strerror_posix.cc
+src/butil/safe_strerror_posix.h
+src/butil/scoped_clear_errno.h
+src/butil/scoped_generic.h
+src/butil/scoped_observer.h
+src/butil/sha1.h
+src/butil/sha1_portable.cc
+src/butil/stl_util.h
+src/butil/strings/latin1_string_conversions.cc
+src/butil/strings/latin1_string_conversions.h
+src/butil/strings/nullable_string16.cc
+src/butil/strings/nullable_string16.h
+src/butil/strings/safe_sprintf.cc
+src/butil/strings/safe_sprintf.h
+src/butil/strings/string16.cc
+src/butil/strings/string16.h
+src/butil/strings/string_number_conversions.cc
+src/butil/strings/string_number_conversions.h
+src/butil/strings/string_piece.cc
+src/butil/strings/string_piece.h
+src/butil/strings/string_split.cc
+src/butil/strings/string_split.h
+src/butil/strings/string_tokenizer.h
+src/butil/strings/string_util.cc
+src/butil/strings/string_util.h
+src/butil/strings/string_util_constants.cc
+src/butil/strings/string_util_posix.h
+src/butil/strings/stringize_macros.h
+src/butil/strings/stringprintf.cc
+src/butil/strings/stringprintf.h
+src/butil/strings/sys_string_conversions.h
+src/butil/strings/sys_string_conversions_mac.mm
+src/butil/strings/sys_string_conversions_posix.cc
+src/butil/strings/utf_offset_string_conversions.cc
+src/butil/strings/utf_offset_string_conversions.h
+src/butil/strings/utf_string_conversion_utils.cc
+src/butil/strings/utf_string_conversion_utils.h
+src/butil/strings/utf_string_conversions.cc
+src/butil/strings/utf_string_conversions.h
+src/butil/synchronization/cancellation_flag.*
+src/butil/synchronization/condition_variable.h
+src/butil/synchronization/condition_variable_posix.cc
+src/butil/synchronization/spin_wait.h

[GitHub] [brpc] wwbmmm merged pull request #2088: Explicitly listing all third-part licensed files

2023-01-15 Thread GitBox


wwbmmm merged PR #2088:
URL: https://github.com/apache/brpc/pull/2088


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] wasphin opened a new pull request, #2088: Explicitly listing all third-part licensed files

2023-01-15 Thread GitBox


wasphin opened a new pull request, #2088:
URL: https://github.com/apache/brpc/pull/2088

   ### What problem does this PR solve?
   
   Issue Number: NONE
   
   Problem Summary:
   
   ### What is changed and the side effects?
   
   Changed:
   Update LICENSE to list files porting from Chromium.
   
   Side effects:
   - Performance effects(性能影响): N/A
   
   - Breaking backward compatibility(向后兼容性):  N/A
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related 
tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of 
Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] wwbmmm commented on a diff in pull request #2086: Fix butex wait_pthread handle EINTR

2023-01-15 Thread GitBox


wwbmmm commented on code in PR #2086:
URL: https://github.com/apache/brpc/pull/2086#discussion_r1070816953


##
src/bthread/butex.cpp:
##
@@ -137,7 +137,21 @@ static void wakeup_pthread(ButexPthreadWaiter* pw) {
 
 bool erase_from_butex(ButexWaiter*, bool, WaiterState);
 
-int wait_pthread(ButexPthreadWaiter& pw, timespec* ptimeout) {
+int wait_pthread(ButexPthreadWaiter& pw, const timespec* abstime) {
+timespec * ptimeout = NULL;
+timespec timeout;
+int64_t timeout_us;
+
+if (abstime != NULL) {
+timeout_us = butil::timespec_to_microseconds(*abstime) - 
butil::gettimeofday_us();
+if (timeout_us < MIN_SLEEP_US) {
+errno = ETIMEDOUT;
+return -1;
+}
+timeout = butil::microseconds_to_timespec(timeout_us);
+ptimeout = 
+}
+
 while (true) {
 const int rc = futex_wait_private(, PTHREAD_NOT_SIGNALLED, 
ptimeout);

Review Comment:
   可以把计算ptimeout的逻辑移到while里面,futex_wait_private的前面,这样可以减少重复逻辑



##
src/bthread/butex.cpp:
##
@@ -137,7 +137,21 @@ static void wakeup_pthread(ButexPthreadWaiter* pw) {
 
 bool erase_from_butex(ButexWaiter*, bool, WaiterState);
 
-int wait_pthread(ButexPthreadWaiter& pw, timespec* ptimeout) {
+int wait_pthread(ButexPthreadWaiter& pw, const timespec* abstime) {
+timespec * ptimeout = NULL;
+timespec timeout;
+int64_t timeout_us;
+
+if (abstime != NULL) {
+timeout_us = butil::timespec_to_microseconds(*abstime) - 
butil::gettimeofday_us();
+if (timeout_us < MIN_SLEEP_US) {
+errno = ETIMEDOUT;
+return -1;

Review Comment:
   这里直接return,没走erase_from_butex的逻辑,是不是不对。



##
src/bthread/butex.cpp:
##
@@ -146,13 +160,19 @@ int wait_pthread(ButexPthreadWaiter& pw, timespec* 
ptimeout) {
 // Acquire fence makes this thread sees changes before wakeup.
 return rc;
 }
-if (rc != 0 && errno == ETIMEDOUT) {
-// Note that we don't handle the EINTR from futex_wait here since
-// pthreads waiting on a butex should behave similarly as bthreads
-// which are not able to be woken-up by signals.
-// EINTR on butex is only producible by TaskGroup::interrupt().
+if (rc != 0 && ptimeout != NULL) {
+// Handle the EINTR from futex_wait
+if (errno != ETIMEDOUT)
+{

Review Comment:
   {  不用换行



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn commented on issue #2013: 基于请求延迟的并发控制

2023-01-15 Thread GitBox


yanglimingcn commented on issue #2013:
URL: https://github.com/apache/brpc/issues/2013#issuecomment-1383417016

   OK,等我有时间补充一下哈


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] ysj1173886760 commented on issue #845: 在aarch64下编译之后,运行会触发 LOG(FATAL) << "bthread=" << g->current_tid() << " sched_to itself!"; 请问下哪种情况下会有这个情况?

2023-01-15 Thread GitBox


ysj1173886760 commented on issue #845:
URL: https://github.com/apache/brpc/issues/845#issuecomment-1383387003

   > > 在Mac M1上也遇到了相同的问题。在并发数偏高的时候会出现`sched_to itself`的错误。
   > > 尝试去除掉这次修改中的`if #define(_linux_)`后问题仍然存在。
   > > 奇怪的是在我把我自己的项目设置成Release模式构建之后,就不会出现`sched_to itself`的错误了。
   > 
   > 使用的是master的最新代码吗?
   
   是的。尝试使用了这个PR中的修改--在Mac下禁用了那两个函数的优化,仍然会出现问题。后来试了几次发现-O2 
-O1优化下可以正常运行,-O0就会出现`sched_to 
itself`以及`task_group.cpp:298`出现空指针的问题。目前还不清楚原因,就在我自己的项目中用-O2先缓解这个问题了。
   我是在自己的项目中将brpc作为subdirectory引入的,不清楚我的Cmake中的编译选项会不会影响到brpc的编译。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] yanglimingcn opened a new pull request, #2087: add max concurrency for timeout concurrency limiter

2023-01-15 Thread GitBox


yanglimingcn opened a new pull request, #2087:
URL: https://github.com/apache/brpc/pull/2087

   基于延迟的并发控制,在average 
latency的统计还没有刷新的时候,有可能因为一些慢请求导致服务排队很多请求,这个最大并发的设置,可以在这种情况下保护服务不被太多的请求压垮。
   @wwbmmm 请PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] wwbmmm commented on issue #845: 在aarch64下编译之后,运行会触发 LOG(FATAL) << "bthread=" << g->current_tid() << " sched_to itself!"; 请问下哪种情况下会有这个情况?

2023-01-15 Thread GitBox


wwbmmm commented on issue #845:
URL: https://github.com/apache/brpc/issues/845#issuecomment-1383350427

   > 在Mac M1上也遇到了相同的问题。在并发数偏高的时候会出现`sched_to itself`的错误。
   > 
   > 尝试去除掉这次修改中的`if #define(_linux_)`后问题仍然存在。
   > 
   > 奇怪的是在我把我自己的项目设置成Release模式构建之后,就不会出现`sched_to itself`的错误了。
   
   使用的是master的最新代码吗?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] jenrryyou opened a new pull request, #2086: Fix butex wait_pthread handle EINTR

2023-01-15 Thread GitBox


jenrryyou opened a new pull request, #2086:
URL: https://github.com/apache/brpc/pull/2086

   wait_pthread处理被信号中断的情况。
   
没有这个处理之前,假设butex_wait_from_pthread的timeout设置为100s,但是这个线程每隔10s会被信号中断(如正在进行profile,会定时中断采集线程堆栈),futex_wait_private会返回EINTR,导致butex_wait_from_pthread永远不会超时返回。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] ysj1173886760 commented on issue #845: 在aarch64下编译之后,运行会触发 LOG(FATAL) << "bthread=" << g->current_tid() << " sched_to itself!"; 请问下哪种情况下会有这个情况?

2023-01-15 Thread GitBox


ysj1173886760 commented on issue #845:
URL: https://github.com/apache/brpc/issues/845#issuecomment-1383136246

   在Mac M1上也遇到了相同的问题。在并发数偏高的时候会出现`sched_to itself`的错误。
   
   尝试去除掉这次修改中的`if #define(_linux_)`后问题仍然存在。
   
奇怪的是在我把我自己的项目设置成Release模式构建之后,就不会出现`sched_to itself`的错误了。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[brpc] branch master updated: Keep bthread TaskGroup abi compatible with NDEBUG macro

2023-01-15 Thread lorinlee
This is an automated email from the ASF dual-hosted git repository.

lorinlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new 3a82c275 Keep bthread TaskGroup abi compatible with NDEBUG macro
 new 745514e4 Merge pull request #2047 from wwbmmm/fix-task-group-abi
3a82c275 is described below

commit 3a82c2755a9d2d73254ce76ff8589c8a6f3cf845
Author: wwbmmm 
AuthorDate: Mon Dec 12 16:45:47 2022 +0800

Keep bthread TaskGroup abi compatible with NDEBUG macro
---
 src/bthread/task_group.cpp | 6 +++---
 src/bthread/task_group.h   | 6 ++
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/bthread/task_group.cpp b/src/bthread/task_group.cpp
index 94ce5eb7..31d8bb41 100644
--- a/src/bthread/task_group.cpp
+++ b/src/bthread/task_group.cpp
@@ -175,9 +175,6 @@ void TaskGroup::run_main_task() {
 
 TaskGroup::TaskGroup(TaskControl* c)
 :
-#ifndef NDEBUG
-_sched_recursive_guard(0),
-#endif
 _cur_meta(NULL)
 , _control(c)
 , _num_nosignal(0)
@@ -192,6 +189,9 @@ TaskGroup::TaskGroup(TaskControl* c)
 , _main_tid(0)
 , _remote_num_nosignal(0)
 , _remote_nsignaled(0)
+#ifndef NDEBUG
+, _sched_recursive_guard(0)
+#endif
 {
 _steal_seed = butil::fast_rand();
 _steal_offset = OFFSET_TABLE[_steal_seed % ARRAY_SIZE(OFFSET_TABLE)];
diff --git a/src/bthread/task_group.h b/src/bthread/task_group.h
index 12ee126c..7ac366a0 100644
--- a/src/bthread/task_group.h
+++ b/src/bthread/task_group.h
@@ -221,10 +221,6 @@ friend class TaskControl;
 return _control->steal_task(tid, &_steal_seed, _steal_offset);
 }
 
-#ifndef NDEBUG
-int _sched_recursive_guard;
-#endif
-
 TaskMeta* _cur_meta;
 
 // the control that this group belongs to
@@ -251,6 +247,8 @@ friend class TaskControl;
 RemoteTaskQueue _remote_rq;
 int _remote_num_nosignal;
 int _remote_nsignaled;
+
+int _sched_recursive_guard;
 };
 
 }  // namespace bthread


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] lorinlee merged pull request #2047: Keep bthread TaskGroup abi compatible with NDEBUG macro

2023-01-15 Thread GitBox


lorinlee merged PR #2047:
URL: https://github.com/apache/brpc/pull/2047


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[brpc] branch master updated: typo fix for bthread introduction

2023-01-15 Thread lorinlee
This is an automated email from the ASF dual-hosted git repository.

lorinlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new 518d216d typo fix for bthread introduction
 new 9e8c0dbf Merge pull request #2083 from freemandealer/fix-an
518d216d is described below

commit 518d216da22761333f2f4cd29f3b63f848baa0cb
Author: freemandealer 
AuthorDate: Wed Jan 11 21:44:32 2023 +0800

typo fix for bthread introduction

As term 'M:N' starts with a vowel sound [e], so it should be 'an' instead of
'a' grammatically.

Signed-off-by: freemandealer 
---
 docs/en/threading_overview.md  | 2 +-
 src/bthread/bthread.cpp| 2 +-
 src/bthread/bthread.h  | 2 +-
 src/bthread/butex.cpp  | 2 +-
 src/bthread/butex.h| 2 +-
 src/bthread/comlog_initializer.h   | 2 +-
 src/bthread/condition_variable.cpp | 2 +-
 src/bthread/condition_variable.h   | 2 +-
 src/bthread/countdown_event.cpp| 2 +-
 src/bthread/countdown_event.h  | 2 +-
 src/bthread/errno.cpp  | 2 +-
 src/bthread/errno.h| 2 +-
 src/bthread/execution_queue.cpp| 2 +-
 src/bthread/execution_queue.h  | 2 +-
 src/bthread/execution_queue_inl.h  | 2 +-
 src/bthread/fd.cpp | 2 +-
 src/bthread/id.cpp | 2 +-
 src/bthread/id.h   | 2 +-
 src/bthread/interrupt_pthread.cpp  | 2 +-
 src/bthread/interrupt_pthread.h| 2 +-
 src/bthread/key.cpp| 2 +-
 src/bthread/list_of_abafree_id.h   | 2 +-
 src/bthread/log.h  | 2 +-
 src/bthread/mutex.cpp  | 2 +-
 src/bthread/mutex.h| 2 +-
 src/bthread/parking_lot.h  | 2 +-
 src/bthread/processor.h| 2 +-
 src/bthread/remote_task_queue.h| 2 +-
 src/bthread/stack.cpp  | 2 +-
 src/bthread/stack.h| 2 +-
 src/bthread/stack_inl.h| 2 +-
 src/bthread/sys_futex.cpp  | 2 +-
 src/bthread/sys_futex.h| 2 +-
 src/bthread/task_control.cpp   | 2 +-
 src/bthread/task_control.h | 2 +-
 src/bthread/task_group.cpp | 2 +-
 src/bthread/task_group.h   | 2 +-
 src/bthread/task_group_inl.h   | 2 +-
 src/bthread/task_meta.h| 2 +-
 src/bthread/timer_thread.cpp   | 2 +-
 src/bthread/timer_thread.h | 2 +-
 src/bthread/types.h| 2 +-
 src/bthread/unstable.h | 2 +-
 src/bthread/work_stealing_queue.h  | 2 +-
 src/butil/object_pool.h| 2 +-
 src/butil/object_pool_inl.h| 2 +-
 src/butil/resource_pool.h  | 2 +-
 src/butil/resource_pool_inl.h  | 2 +-
 48 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/docs/en/threading_overview.md b/docs/en/threading_overview.md
index f30ed5ed..d67d14d9 100644
--- a/docs/en/threading_overview.md
+++ b/docs/en/threading_overview.md
@@ -28,7 +28,7 @@ How multi-threaded reactors work and problems related are 
demonstrated below:
 
 ## M:N threading library
 
-This model maps M user threads into N system threads. A M:N threading library 
is able to decide when and where to run a piece of code and when to end the 
execution, which is more flexible at scheduling compared to multi-threaded 
reactors. But full-featured M:N threading libraries are difficult to implement 
and remaining as active research topics. The M:N threading library that we're 
talking about is specialized for building online services, in which case, some 
of the requirements can be  [...]
+This model maps M user threads into N system threads. An M:N threading library 
is able to decide when and where to run a piece of code and when to end the 
execution, which is more flexible at scheduling compared to multi-threaded 
reactors. But full-featured M:N threading libraries are difficult to implement 
and remaining as active research topics. The M:N threading library that we're 
talking about is specialized for building online services, in which case, some 
of the requirements can be [...]
 
 # Issues
 
diff --git a/src/bthread/bthread.cpp b/src/bthread/bthread.cpp
index bcffaa41..5ac0c3b1 100644
--- a/src/bthread/bthread.cpp
+++ b/src/bthread/bthread.cpp
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-// bthread - A M:N threading library to make applications more concurrent.
+// bthread - An M:N threading library to make applications more concurrent.
 
 // Date: Tue Jul 10 17:40:58 CST 2012
 
diff --git a/src/bthread/bthread.h b/src/bthread/bthread.h
index c5fa4c6d..3f55eb67 100644
--- a/src/bthread/bthread.h
+++ b/src/bthread/bthread.h
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-// bthread - A M:N threading library to make applications more concurrent.
+// bthread - An M:N threading library to make applications more 

[GitHub] [brpc] lorinlee merged pull request #2083: typo fix for bthread introduction

2023-01-15 Thread GitBox


lorinlee merged PR #2083:
URL: https://github.com/apache/brpc/pull/2083


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [brpc] lorinlee commented on issue #2084: my_ip_cstr获取本机ip为127.0.0.1

2023-01-15 Thread GitBox


lorinlee commented on issue #2084:
URL: https://github.com/apache/brpc/issues/2084#issuecomment-1383112440

   @xiaohei520321 获取不到ip的服务器上,hosts文件里有写127.0.0.1吗,删掉看可以不


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org