在应用程序中启动多个 grpc::ServerBuilders 是否有任何限制?
Are there any limitations to starting multiple grpc::ServerBuilders in an application?
我的 C++ 应用程序 运行ning 在 Ubuntu 14.04 上有问题。我正在使用 grpc 与一个 go 网络服务器应用程序通信,该应用程序正在使用 c++ 应用程序的 status/configuration 为网页提供服务。
我一直在使用 1 年前的 grpc 0.14 版本,所以在发帖之前,我升级了所有东西(grpc 1.3.1,go 版本 1.8.1)。
看来我的 c++ 应用程序在 1.3.1(以及 1.0.0、1.2.5、1.2.0 等)grpc 版本中经常崩溃。
我收到带有双重免费警告的 sigabort。该应用程序会 运行 一段时间,但在 Web 应用程序从 C++ 应用程序请求数据一段时间后,它会崩溃:gdb 输出:
[New LWP 9908]
[New LWP 9881]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./bhio'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 _int_malloc (av=0x7fb3ac000020, bytes=16) at malloc.c:3351
3351 malloc.c: No such file or directory.
(gdb) where
#0 _int_malloc (av=0x7fb3ac000020, bytes=16) at malloc.c:3351
#1 0x00007fb4205db6c0 in __GI___libc_malloc (bytes=16) at malloc.c:2891
#2 0x000000000076bb2f in gpr_malloc ()
#3 0x000000000077678d in grpc_error_create ()
#4 0x000000000078ba94 in ?? ()
#5 0x000000000078dbee in grpc_chttp2_fail_pending_writes ()
#6 0x000000000078e19f in grpc_chttp2_mark_stream_closed ()
#7 0x000000000078e2eb in grpc_chttp2_cancel_stream ()
#8 0x000000000078ef1c in ?? ()
#9 0x000000000077597e in grpc_combiner_continue_exec_ctx ()
#10 0x0000000000777678 in grpc_exec_ctx_flush ()
#11 0x000000000078095f in grpc_call_cancel_with_status ()
#12 0x0000000000780be1 in grpc_call_destroy ()
#13 0x0000000000769bd7 in grpc::ServerContext::~ServerContext() ()
#14 0x0000000000768c7c in grpc::Server::SyncRequest::CallData::~CallData() ()
#15 0x00000000007691e3 in
grpc::Server::SyncRequestThreadManager::DoWork(void*, bool) ()
#16 0x000000000076aff1 in grpc::ThreadManager::MainWorkLoop() ()
#17 0x000000000076b04c in grpc::ThreadManager::WorkerThread::Run() ()
#18 0x00007fb420eebbf0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#19 0x00007fb421146184 in start_thread (arg=0x7fb3ca686700)
at pthread_create.c:312
#20 0x00007fb42065337d in clone ()
---Type <return> to continue, or q <return> to quit---
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
(gdb) quit
或此处:
[Thread 0x7fff7d7fa700 (LWP 3521) exited]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff7e7fc700 (LWP 3524)]
__GI___libc_free (mem=0xb5) at malloc.c:2929
2929 malloc.c: No such file or directory.
(gdb)
(gdb) where
#0 __GI___libc_free (mem=0xb5) at malloc.c:2929
#1 0x000000000077b7b5 in grpc_byte_buffer_destroy ()
#2 0x0000000000773ac3 in grpc::Server::SyncRequest::CallData::~CallData() ()
#3 0x000000000077405a in grpc::Server::SyncRequestThreadManager::DoWork(void*, bool) ()
#4 0x0000000000776111 in grpc::ThreadManager::MainWorkLoop() ()
#5 0x000000000077616c in grpc::ThreadManager::WorkerThread::Run() ()
#6 0x00007ffff6c9fbf0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007ffff6efa184 in start_thread (arg=0x7fff7e7fc700)
at pthread_create.c:312
#8 0x00007ffff640737d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
因此,如果可以启动多个 serverbuilder s ,那么上述错误还能指出我在使用 grpc 库时可能做错了什么。我正在将这段代码交给编写它的其他人,所以我对grpc的使用知识不足。。。我觉得grpc没有那么不稳定,肯定是我用错了。
任何想法都会有所帮助..
任何更好地调试它的建议都会有所帮助。
对于grpc构建,我只是做了以下事情:
$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc
$ git 子模块更新 --init
$ 制作
$ [sudo] 安装
是否有可能提供更多信息的不同编译选项?
提前感谢 help/suggestions。
鲍勃
事实证明,注册服务函数中的小内存泄漏(缺少套接字文件描述符的关闭)导致了问题。
我的 C++ 应用程序 运行ning 在 Ubuntu 14.04 上有问题。我正在使用 grpc 与一个 go 网络服务器应用程序通信,该应用程序正在使用 c++ 应用程序的 status/configuration 为网页提供服务。
我一直在使用 1 年前的 grpc 0.14 版本,所以在发帖之前,我升级了所有东西(grpc 1.3.1,go 版本 1.8.1)。
看来我的 c++ 应用程序在 1.3.1(以及 1.0.0、1.2.5、1.2.0 等)grpc 版本中经常崩溃。
我收到带有双重免费警告的 sigabort。该应用程序会 运行 一段时间,但在 Web 应用程序从 C++ 应用程序请求数据一段时间后,它会崩溃:gdb 输出:
[New LWP 9908]
[New LWP 9881]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./bhio'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 _int_malloc (av=0x7fb3ac000020, bytes=16) at malloc.c:3351
3351 malloc.c: No such file or directory.
(gdb) where
#0 _int_malloc (av=0x7fb3ac000020, bytes=16) at malloc.c:3351
#1 0x00007fb4205db6c0 in __GI___libc_malloc (bytes=16) at malloc.c:2891
#2 0x000000000076bb2f in gpr_malloc ()
#3 0x000000000077678d in grpc_error_create ()
#4 0x000000000078ba94 in ?? ()
#5 0x000000000078dbee in grpc_chttp2_fail_pending_writes ()
#6 0x000000000078e19f in grpc_chttp2_mark_stream_closed ()
#7 0x000000000078e2eb in grpc_chttp2_cancel_stream ()
#8 0x000000000078ef1c in ?? ()
#9 0x000000000077597e in grpc_combiner_continue_exec_ctx ()
#10 0x0000000000777678 in grpc_exec_ctx_flush ()
#11 0x000000000078095f in grpc_call_cancel_with_status ()
#12 0x0000000000780be1 in grpc_call_destroy ()
#13 0x0000000000769bd7 in grpc::ServerContext::~ServerContext() ()
#14 0x0000000000768c7c in grpc::Server::SyncRequest::CallData::~CallData() ()
#15 0x00000000007691e3 in
grpc::Server::SyncRequestThreadManager::DoWork(void*, bool) ()
#16 0x000000000076aff1 in grpc::ThreadManager::MainWorkLoop() ()
#17 0x000000000076b04c in grpc::ThreadManager::WorkerThread::Run() ()
#18 0x00007fb420eebbf0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#19 0x00007fb421146184 in start_thread (arg=0x7fb3ca686700)
at pthread_create.c:312
#20 0x00007fb42065337d in clone ()
---Type <return> to continue, or q <return> to quit---
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
(gdb) quit
或此处:
[Thread 0x7fff7d7fa700 (LWP 3521) exited]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff7e7fc700 (LWP 3524)]
__GI___libc_free (mem=0xb5) at malloc.c:2929
2929 malloc.c: No such file or directory.
(gdb)
(gdb) where
#0 __GI___libc_free (mem=0xb5) at malloc.c:2929
#1 0x000000000077b7b5 in grpc_byte_buffer_destroy ()
#2 0x0000000000773ac3 in grpc::Server::SyncRequest::CallData::~CallData() ()
#3 0x000000000077405a in grpc::Server::SyncRequestThreadManager::DoWork(void*, bool) ()
#4 0x0000000000776111 in grpc::ThreadManager::MainWorkLoop() ()
#5 0x000000000077616c in grpc::ThreadManager::WorkerThread::Run() ()
#6 0x00007ffff6c9fbf0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007ffff6efa184 in start_thread (arg=0x7fff7e7fc700)
at pthread_create.c:312
#8 0x00007ffff640737d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
因此,如果可以启动多个 serverbuilder s ,那么上述错误还能指出我在使用 grpc 库时可能做错了什么。我正在将这段代码交给编写它的其他人,所以我对grpc的使用知识不足。。。我觉得grpc没有那么不稳定,肯定是我用错了。
任何想法都会有所帮助..
任何更好地调试它的建议都会有所帮助。
对于grpc构建,我只是做了以下事情:
$ git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc
$ git 子模块更新 --init
$ 制作
$ [sudo] 安装
是否有可能提供更多信息的不同编译选项?
提前感谢 help/suggestions。
鲍勃
事实证明,注册服务函数中的小内存泄漏(缺少套接字文件描述符的关闭)导致了问题。