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
9c6e902c
Commit
9c6e902c
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Dont crash on too many pluckers
parent
137511f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/surface/completion_queue.c
+16
-4
16 additions, 4 deletions
src/core/surface/completion_queue.c
with
16 additions
and
4 deletions
src/core/surface/completion_queue.c
+
16
−
4
View file @
9c6e902c
...
...
@@ -201,12 +201,15 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
return
ret
;
}
static
void
add_plucker
(
grpc_completion_queue
*
cc
,
void
*
tag
,
grpc_pollset_worker
*
worker
)
{
GPR_ASSERT
(
cc
->
num_pluckers
!=
GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
);
static
int
add_plucker
(
grpc_completion_queue
*
cc
,
void
*
tag
,
grpc_pollset_worker
*
worker
)
{
if
(
cc
->
num_pluckers
==
GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
)
{
return
0
;
}
cc
->
pluckers
[
cc
->
num_pluckers
].
tag
=
tag
;
cc
->
pluckers
[
cc
->
num_pluckers
].
worker
=
worker
;
cc
->
num_pluckers
++
;
return
1
;
}
static
void
del_plucker
(
grpc_completion_queue
*
cc
,
void
*
tag
,
...
...
@@ -259,7 +262,16 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
ret
.
type
=
GRPC_QUEUE_SHUTDOWN
;
break
;
}
add_plucker
(
cc
,
tag
,
&
worker
);
if
(
!
add_plucker
(
cc
,
tag
,
&
worker
))
{
gpr_log
(
GPR_DEBUG
,
"Too many outstanding grpc_completion_queue_pluck calls: maximum is %d"
.
GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
);
gpr_mu_unlock
(
GRPC_POLLSET_MU
(
&
cc
->
pollset
));
memset
(
&
ret
,
0
,
sizeof
(
ret
));
/* TODO(ctiller): should we use a different result here */
ret
.
type
=
GRPC_QUEUE_TIMEOUT
;
break
;
}
if
(
!
grpc_pollset_work
(
&
cc
->
pollset
,
&
worker
,
deadline
))
{
del_plucker
(
cc
,
tag
,
&
worker
);
gpr_mu_unlock
(
GRPC_POLLSET_MU
(
&
cc
->
pollset
));
...
...
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