Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
a69878a2
Commit
a69878a2
authored
7 years ago
by
Sree Kuchibhotla
Browse files
Options
Downloads
Patches
Plain Diff
fix memory leaks due to not calling grpc_shutdown in bm_cq_multiple_threads
parent
bd4439c4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/lib/iomgr/ev_posix.c
+4
-0
4 additions, 0 deletions
src/core/lib/iomgr/ev_posix.c
src/core/lib/iomgr/ev_posix.h
+3
-1
3 additions, 1 deletion
src/core/lib/iomgr/ev_posix.h
test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
+11
-1
11 additions, 1 deletion
test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
with
18 additions
and
2 deletions
src/core/lib/iomgr/ev_posix.c
+
4
−
0
View file @
a69878a2
...
@@ -121,6 +121,10 @@ void grpc_set_event_engine_test_only(
...
@@ -121,6 +121,10 @@ void grpc_set_event_engine_test_only(
g_event_engine
=
ev_engine
;
g_event_engine
=
ev_engine
;
}
}
const
grpc_event_engine_vtable
*
grpc_get_event_engine_test_only
()
{
return
g_event_engine
;
}
/* Call this only after calling grpc_event_engine_init() */
/* Call this only after calling grpc_event_engine_init() */
const
char
*
grpc_get_poll_strategy_name
()
{
return
g_poll_strategy_name
;
}
const
char
*
grpc_get_poll_strategy_name
()
{
return
g_poll_strategy_name
;
}
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/ev_posix.h
+
3
−
1
View file @
a69878a2
...
@@ -153,7 +153,9 @@ void grpc_pollset_set_del_fd(grpc_exec_ctx *exec_ctx,
...
@@ -153,7 +153,9 @@ void grpc_pollset_set_del_fd(grpc_exec_ctx *exec_ctx,
typedef
int
(
*
grpc_poll_function_type
)(
struct
pollfd
*
,
nfds_t
,
int
);
typedef
int
(
*
grpc_poll_function_type
)(
struct
pollfd
*
,
nfds_t
,
int
);
extern
grpc_poll_function_type
grpc_poll_function
;
extern
grpc_poll_function_type
grpc_poll_function
;
/* This should be used for testing purposes ONLY */
/* WARNING: The following two functions should be used for testing purposes
* ONLY */
void
grpc_set_event_engine_test_only
(
const
grpc_event_engine_vtable
*
);
void
grpc_set_event_engine_test_only
(
const
grpc_event_engine_vtable
*
);
const
grpc_event_engine_vtable
*
grpc_get_event_engine_test_only
();
#endif
/* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */
#endif
/* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */
This diff is collapsed.
Click to expand it.
test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
+
11
−
1
View file @
a69878a2
...
@@ -41,6 +41,7 @@ namespace testing {
...
@@ -41,6 +41,7 @@ namespace testing {
static
void
*
g_tag
=
(
void
*
)(
intptr_t
)
10
;
// Some random number
static
void
*
g_tag
=
(
void
*
)(
intptr_t
)
10
;
// Some random number
static
grpc_completion_queue
*
g_cq
;
static
grpc_completion_queue
*
g_cq
;
static
grpc_event_engine_vtable
g_vtable
;
static
grpc_event_engine_vtable
g_vtable
;
static
const
grpc_event_engine_vtable
*
g_old_vtable
;
static
void
pollset_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_pollset
*
ps
,
static
void
pollset_shutdown
(
grpc_exec_ctx
*
exec_ctx
,
grpc_pollset
*
ps
,
grpc_closure
*
closure
)
{
grpc_closure
*
closure
)
{
...
@@ -72,7 +73,7 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
...
@@ -72,7 +73,7 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps,
grpc_pollset_worker
**
worker
,
gpr_timespec
now
,
grpc_pollset_worker
**
worker
,
gpr_timespec
now
,
gpr_timespec
deadline
)
{
gpr_timespec
deadline
)
{
if
(
gpr_time_cmp
(
deadline
,
gpr_time_0
(
GPR_CLOCK_MONOTONIC
))
==
0
)
{
if
(
gpr_time_cmp
(
deadline
,
gpr_time_0
(
GPR_CLOCK_MONOTONIC
))
==
0
)
{
gpr_log
(
GPR_
ERROR
,
"no-op"
);
gpr_log
(
GPR_
DEBUG
,
"no-op"
);
return
GRPC_ERROR_NONE
;
return
GRPC_ERROR_NONE
;
}
}
...
@@ -98,7 +99,12 @@ static void init_engine_vtable() {
...
@@ -98,7 +99,12 @@ static void init_engine_vtable() {
static
void
setup
()
{
static
void
setup
()
{
grpc_init
();
grpc_init
();
/* Override the event engine with our test event engine (g_vtable); but before
* that, save the current event engine in g_old_vtable. We will have to set
* g_old_vtable back before calling grpc_shutdown() */
init_engine_vtable
();
init_engine_vtable
();
g_old_vtable
=
grpc_get_event_engine_test_only
();
grpc_set_event_engine_test_only
(
&
g_vtable
);
grpc_set_event_engine_test_only
(
&
g_vtable
);
g_cq
=
grpc_completion_queue_create_for_next
(
NULL
);
g_cq
=
grpc_completion_queue_create_for_next
(
NULL
);
...
@@ -115,6 +121,10 @@ static void teardown() {
...
@@ -115,6 +121,10 @@ static void teardown() {
}
}
grpc_completion_queue_destroy
(
g_cq
);
grpc_completion_queue_destroy
(
g_cq
);
/* Restore the old event engine before calling grpc_shutdown */
grpc_set_event_engine_test_only
(
g_old_vtable
);
grpc_shutdown
();
}
}
/* A few notes about Multi-threaded benchmarks:
/* A few notes about Multi-threaded benchmarks:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment