Skip to content

Commit d7aa989

Browse files
authored
Revert changes for setting grpc max message size (#2752) (#2756)
* Revert changes for setting grpc max message size * Revert proto file updates * Fixing test. * fix typo
1 parent acc8c40 commit d7aa989

File tree

28 files changed

+142
-763
lines changed

28 files changed

+142
-763
lines changed

schemas/json/host.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,6 @@
244244
}
245245
},
246246

247-
"languageWorker": {
248-
"description": "Configuration settings for Language Workers.",
249-
"type": "object",
250-
251-
"properties": {
252-
"maxMessageLength": {
253-
"description": "Defines maximum message size in MegaBytes (MB) for the streaming messages between the functions host and a language worker",
254-
"type": "integer",
255-
"minimum": 4,
256-
"default": 32
257-
}
258-
}
259-
},
260-
261247
"applicationInsights": {
262248
"description": "Configuration settings for Application Insights logging.",
263249
"type": "object",

src/WebJobs.Script.Grpc/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
Messages
2-
node_modules
3-
azure-functions-language-worker-protobuf
2+
node_modules
Lines changed: 13 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ service FunctionRpc {
1717
}
1818

1919
message StreamingMessage {
20-
// Used to identify message between host and worker
2120
string request_id = 1;
22-
23-
// Payload of the message
2421
oneof content {
25-
26-
// Worker initiates stream
2722
StartStream start_stream = 20;
2823

2924
// Host sends capabilities/init data to worker
@@ -53,17 +48,12 @@ message StreamingMessage {
5348
// Worker responds after loading with the load result
5449
FunctionLoadResponse function_load_response = 9;
5550

56-
// Host requests a given invocation
5751
InvocationRequest invocation_request = 4;
58-
59-
// Worker responds to a given invocation
6052
InvocationResponse invocation_response = 5;
61-
6253
// Host sends cancel message to attempt to cancel an invocation.
6354
// If an invocation is cancelled, host will receive an invocation response with status cancelled.
6455
InvocationCancel invocation_cancel = 21;
6556

66-
// Worker logs a message back to the host
6757
RpcLog rpc_log = 2;
6858
}
6959
}
@@ -73,15 +63,11 @@ message StreamingMessage {
7363
// protocol type
7464
// protocol version
7565

76-
// Worker sends the host information identifying itself
7766
message StartStream {
78-
// id of the worker
7967
string worker_id = 2;
8068
}
8169

82-
// Host requests the worker to initialize itself
8370
message WorkerInitRequest {
84-
// version of the host sending init request
8571
string host_version = 1;
8672

8773
// A map of host supported features/capabilities
@@ -92,40 +78,27 @@ message WorkerInitRequest {
9278
map<string, RpcLog.Level> log_categories = 3;
9379
}
9480

95-
// Worker responds with the result of initializing itself
9681
message WorkerInitResponse {
97-
// Version of worker
9882
string worker_version = 1;
9983
// A map of worker supported features/capabilities
10084
map<string, string> capabilities = 2;
101-
102-
// Status of the response
10385
StatusResult result = 3;
10486
}
10587

106-
// Used by the host to determine success/failure/cancellation
10788
message StatusResult {
108-
// Indicates Failure/Success/Cancelled
10989
enum Status {
11090
Failure = 0;
11191
Success = 1;
11292
Cancelled = 2;
11393
}
114-
// Status for the given result
11594
Status status = 4;
116-
117-
// Specific message about the result
11895
string result = 1;
119-
120-
// Exception message (if exists) for the status
12196
RpcException exception = 2;
122-
12397
// Captured logs or relevant details can use the logs property
12498
repeated RpcLog logs = 3;
12599
}
126100

127101
// TODO: investigate grpc heartbeat - don't limit to grpc implemention
128-
129102
// Message is empty by design - Will add more fields in future if needed
130103
message WorkerHeartbeat {}
131104

@@ -135,170 +108,113 @@ message WorkerTerminate {
135108
google.protobuf.Duration grace_period = 1;
136109
}
137110

138-
// Host notifies worker of file content change
139111
message FileChangeEventRequest {
140-
// Types of File change operations (See link for more info: https://msdn.microsoft.com/en-us/library/t6xf43e0(v=vs.110).aspx)
112+
// https://msdn.microsoft.com/en-us/library/t6xf43e0(v=vs.110).aspx
141113
enum Type {
142-
Unknown = 0;
114+
Unknown = 0;
143115
Created = 1;
144116
Deleted = 2;
145117
Changed = 4;
146118
Renamed = 8;
147119
All = 15;
148120
}
149121

150-
// type for this event
151122
Type type = 1;
152-
153-
// full file path for the file change notification
154123
string full_path = 2;
155-
156-
// Name of the function affected
157124
string name = 3;
158125
}
159126

160-
// Indicates whether worker reloaded successfully or needs a restart
161127
message WorkerActionResponse {
162-
// indicates whether a restart is needed, or reload succesfully
163128
enum Action {
164129
Restart = 0;
165130
Reload = 1;
166131
}
167132

168-
// action for this response
169133
Action action = 1;
170-
171-
// text reason for the response
172134
string reason = 2;
173135
}
174136

175-
// NOT USED
176137
message WorkerStatusRequest{
177138
}
178139

179-
// NOT USED
180140
message WorkerStatusResponse {
181141
}
182142

183-
// Host tells the worker to load a Function
184143
message FunctionLoadRequest {
185144
// unique function identifier (avoid name collisions, facilitate reload case)
186145
string function_id = 1;
187-
188-
// Metadata for the request
189146
RpcFunctionMetadata metadata = 2;
190147
}
191148

192-
// Worker tells host result of reload
193149
message FunctionLoadResponse {
194-
// unique function identifier
195150
string function_id = 1;
196-
197-
// Result of load operation
198151
StatusResult result = 2;
199152
// TODO: return type expected?
200153
}
201154

202-
// Information on how a Function should be loaded and its bindings
203155
message RpcFunctionMetadata {
204156
// TODO: do we want the host's name - the language worker might do a better job of assignment than the host
205157
string name = 4;
206158

207-
// base directory for the Function
208159
string directory = 1;
209-
210-
// Script file specified
211160
string script_file = 2;
212-
213-
// Entry point specified
214161
string entry_point = 3;
215162

216-
// Bindings info
217163
map<string, BindingInfo> bindings = 6;
164+
165+
// not adding disabled or excluded as those (currently) are only relevant to host
218166
}
219167

220-
// Host requests worker to invoke a Function
221168
message InvocationRequest {
222-
// Unique id for each invocation
223169
string invocation_id = 1;
224-
225-
// Unique id for each Function
226170
string function_id = 2;
227-
228-
// Input bindings (include trigger)
229171
repeated ParameterBinding input_data = 3;
230-
231-
// binding metadata from trigger
232172
map<string, TypedData> trigger_metadata = 4;
233173
}
234174

235-
// Host requests worker to cancel invocation
236175
message InvocationCancel {
237-
// Unique id for invocation
238176
string invocation_id = 2;
239-
240-
// Time period before force shutdown
241177
google.protobuf.Duration grace_period = 1; // could also use absolute time
242178
}
243179

244-
// Worker responds with status of Invocation
245180
message InvocationResponse {
246-
// Unique id for invocation
247181
string invocation_id = 1;
248-
249-
// Output binding data
250182
repeated ParameterBinding output_data = 2;
251-
252-
// data returned from Function (for $return and triggers with return support)
253183
TypedData return_value = 4;
254-
255-
// Status of the invocation (success/failure/canceled)
256184
StatusResult result = 3;
257185
}
258186

259-
// Used to encapsulate data which could be a variety of types
260187
message TypedData {
261188
oneof data {
262189
string string = 1;
263190
string json = 2;
264191
bytes bytes = 3;
265192
bytes stream = 4;
266193
RpcHttp http = 5;
267-
sint64 int = 6;
194+
sint64 int = 6;
268195
double double = 7;
269196
}
270197
}
271198

272-
// Used to describe a given binding on invocation
273199
message ParameterBinding {
274-
// Name for the binding
275200
string name = 1;
276-
277-
// Data for the binding
278201
TypedData data = 2;
279202
}
280203

281-
// Used to describe a given binding on load
282204
message BindingInfo {
283-
// Indicates whether it is an input or output binding (or a fancy inout binding)
284-
enum Direction {
285-
in = 0;
286-
out = 1;
287-
inout = 2;
288-
}
289-
290-
// Type of binding (e.g. HttpTrigger)
291205
string type = 2;
292-
293-
// Direction of the given binding
294206
Direction direction = 3;
207+
208+
enum Direction {
209+
in = 0;
210+
out = 1;
211+
inout = 2;
212+
}
295213
}
296214

297-
// Used to send logs back to the Host
298215
message RpcLog {
299216
// Matching ILogger semantics
300217
// https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs
301-
// Level for the Log
302218
enum Level {
303219
Trace = 0;
304220
Debug = 1;
@@ -309,42 +225,24 @@ message RpcLog {
309225
None = 6;
310226
}
311227

312-
// Unique id for invocation (if exists)
313228
string invocation_id = 1;
314-
315-
// TOD: This should be an enum
316-
// Category for the log (startup, load, invocation, etc.)
317229
string category = 2;
318-
319-
// Level for the given log message
320230
Level level = 3;
321-
322-
// Message for the given log
323231
string message = 4;
324-
325-
// Id for the even associated with this log (if exists)
326232
string event_id = 5;
327-
328-
// Exception (if exists)
329233
RpcException exception = 6;
330234

331235
// json serialized property bag, or could use a type scheme like map<string, TypedData>
332236
string properties = 7;
333237
}
334238

335-
// Encapsulates an Exception
336239
message RpcException {
337-
// Source of the exception
338240
string source = 3;
339-
340-
// Stack trace for the exception
341241
string stack_trace = 1;
342-
343-
// Textual message describing hte exception
344242
string message = 2;
345243
}
346244

347-
// TODO - solidify this or remove it
245+
// TODO - solidify this
348246
message RpcHttp {
349247
string method = 1;
350248
string url = 2;
@@ -353,6 +251,6 @@ message RpcHttp {
353251
map<string,string> params = 10;
354252
string status_code = 12;
355253
map<string,string> query = 15;
356-
bool enable_content_negotiation= 16;
254+
bool is_raw = 16;
357255
TypedData rawBody = 17;
358256
}
File renamed without changes.

src/WebJobs.Script.Grpc/Server/GrpcServer.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5-
using System.Collections.Generic;
65
using System.Linq;
76
using System.Threading.Tasks;
87
using Grpc.Core;
@@ -16,13 +15,9 @@ public class GrpcServer : IRpcServer, IDisposable
1615
private Server _server;
1716
private bool _disposed = false;
1817

19-
public GrpcServer(FunctionRpc.FunctionRpcBase serviceImpl, int grpcMaxMessageLength)
18+
public GrpcServer(FunctionRpc.FunctionRpcBase serviceImpl)
2019
{
21-
ChannelOption maxReceiveMessageLength = new ChannelOption(ChannelOptions.MaxReceiveMessageLength, grpcMaxMessageLength);
22-
ChannelOption maxSendMessageLength = new ChannelOption(ChannelOptions.MaxSendMessageLength, grpcMaxMessageLength);
23-
ChannelOption[] grpcChannelOptions = { maxReceiveMessageLength, maxSendMessageLength };
24-
25-
_server = new Server(grpcChannelOptions)
20+
_server = new Server
2621
{
2722
Services = { FunctionRpc.BindService(serviceImpl) },
2823
Ports = { new ServerPort("127.0.0.1", ServerPort.PickUnused, ServerCredentials.Insecure) }

src/WebJobs.Script.Grpc/WebJobs.Script.Grpc.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<Folder Include="Messages\DotNet\" />
3131
</ItemGroup>
3232

33-
<Target Name="GenerateProtoFiles" BeforeTargets="BeforeBuild" Inputs="azure-functions-language-worker-protobuf/src/proto/FunctionRpc.proto" Outputs="Messages/DotNet/FunctionRpc.cs;Messages/DotNet/FunctionRpcGrpc.cs">
33+
<Target Name="GenerateProtoFiles" BeforeTargets="BeforeBuild" Inputs="Proto/FunctionRpc.proto" Outputs="Messages/DotNet/FunctionRpc.cs;Messages/DotNet/FunctionRpcGrpc.cs">
3434
<Exec Command="./generate_protos.$(Ext)" />
3535
<ItemGroup>
3636
<Compile Include="**/*$(DefaultLanguageSourceExtension)" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(BaseIntermediateOutputPath)**;$(BaseOutputPath)**;@(Compile)" />

0 commit comments

Comments
 (0)