From 869110b5c70c54b22d60467be045aeb8427f397a Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Thu, 31 Aug 2023 15:50:08 -0700 Subject: [PATCH 1/9] Sending a second copy of command line args with "FUNCTIONS_" prefix --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index 50dd7d54ee..b005afdbc0 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -44,7 +44,11 @@ public RpcWorkerContext(string requestId, public override string GetFormattedArguments() { - return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength}"; + // We are adding a second copy of the commandline arguments with the FUNCTIONS_ prefix. + // Once all workers starts using the new parameters, we can retire the old ones. + // Tracking item: https://github.com/Azure/azure-functions-host/issues/9504 + + return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --FUNCTIONS_HOST {ServerUri.Host} --FUNCTIONS_PORT {ServerUri.Port} --FUNCTIONS_WORKERID {WorkerId} --requestId {RequestId} --FUNCTIONS_GRPCMAXMESSAGELENGTH {MaxMessageLength}"; } } } From a8a502105677abf481dd2c60172159e7b61635e6 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Thu, 31 Aug 2023 17:02:59 -0700 Subject: [PATCH 2/9] Cleanup --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index b005afdbc0..e70b38d7b7 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -44,9 +44,8 @@ public RpcWorkerContext(string requestId, public override string GetFormattedArguments() { - // We are adding a second copy of the commandline arguments with the FUNCTIONS_ prefix. - // Once all workers starts using the new parameters, we can retire the old ones. - // Tracking item: https://github.com/Azure/azure-functions-host/issues/9504 + // Adding a second copy of the commandline arguments with the FUNCTIONS_ prefix to prevent any conflicts caused by the existing generic names(ex:HOST). + // Language workers are advised to use the FUNCTIONS_ prefix ones and if not present fallback to existing ones. return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --FUNCTIONS_HOST {ServerUri.Host} --FUNCTIONS_PORT {ServerUri.Port} --FUNCTIONS_WORKERID {WorkerId} --requestId {RequestId} --FUNCTIONS_GRPCMAXMESSAGELENGTH {MaxMessageLength}"; } From ad8423ceae9ea456237cefd5a1faf8a6c8c9b83f Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Fri, 1 Sep 2023 06:29:37 -0700 Subject: [PATCH 3/9] Sending a second copy of command line args with "FUNCTIONS_" prefix --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 2 +- .../Workers/DefaultWorkerProcessFactoryTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index e70b38d7b7..ec50512656 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -47,7 +47,7 @@ public override string GetFormattedArguments() // Adding a second copy of the commandline arguments with the FUNCTIONS_ prefix to prevent any conflicts caused by the existing generic names(ex:HOST). // Language workers are advised to use the FUNCTIONS_ prefix ones and if not present fallback to existing ones. - return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --FUNCTIONS_HOST {ServerUri.Host} --FUNCTIONS_PORT {ServerUri.Port} --FUNCTIONS_WORKERID {WorkerId} --requestId {RequestId} --FUNCTIONS_GRPCMAXMESSAGELENGTH {MaxMessageLength}"; + return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --FUNCTIONS_HOST {ServerUri.Host} --FUNCTIONS_PORT {ServerUri.Port} --FUNCTIONS_WORKERID {WorkerId} --FUNCTIONS_REQUESTID {RequestId} --FUNCTIONS_GRPCMAXMESSAGELENGTH {MaxMessageLength}"; } } } diff --git a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs index 2286612603..d8f06e7896 100644 --- a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs +++ b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs @@ -82,7 +82,7 @@ public void DefaultWorkerProcessFactory_Returns_ExpectedProcess(WorkerContext wo } if (workerContext is RpcWorkerContext) { - Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647", childProcess.StartInfo.Arguments); + Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647 --FUNCTIONS_HOST localhost --FUNCTIONS_PORT 80 --FUNCTIONS_WORKERID testWorkerId --FUNCTIONS_REQUESTID testId --FUNCTIONS_GRPCMAXMESSAGELENGTH 2147483647", childProcess.StartInfo.Arguments); } else { From 10d27cb3f8b7a802ac9dbcc382af609a731a85a0 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Thu, 7 Sep 2023 11:00:30 -0700 Subject: [PATCH 4/9] switched to functions- prefix --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 6 +++--- .../Workers/DefaultWorkerProcessFactoryTests.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index ec50512656..95b30f992c 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -44,10 +44,10 @@ public RpcWorkerContext(string requestId, public override string GetFormattedArguments() { - // Adding a second copy of the commandline arguments with the FUNCTIONS_ prefix to prevent any conflicts caused by the existing generic names(ex:HOST). - // Language workers are advised to use the FUNCTIONS_ prefix ones and if not present fallback to existing ones. + // Adding a second copy of the commandline arguments with the "functions-" prefix to prevent any conflicts caused by the existing generic names. + // Language workers are advised to use the "functions-" prefix ones and if not present fallback to existing ones. - return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --FUNCTIONS_HOST {ServerUri.Host} --FUNCTIONS_PORT {ServerUri.Port} --FUNCTIONS_WORKERID {WorkerId} --FUNCTIONS_REQUESTID {RequestId} --FUNCTIONS_GRPCMAXMESSAGELENGTH {MaxMessageLength}"; + return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --functions-uri {ServerUri.AbsoluteUri.TrimEnd('/')}:{ServerUri.Port} --functions-workerid {WorkerId} --functions-requestid {RequestId} --functions-grpcmaxmessagelength {MaxMessageLength}"; } } } diff --git a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs index d8f06e7896..627d4bb8b0 100644 --- a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs +++ b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs @@ -82,7 +82,7 @@ public void DefaultWorkerProcessFactory_Returns_ExpectedProcess(WorkerContext wo } if (workerContext is RpcWorkerContext) { - Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647 --FUNCTIONS_HOST localhost --FUNCTIONS_PORT 80 --FUNCTIONS_WORKERID testWorkerId --FUNCTIONS_REQUESTID testId --FUNCTIONS_GRPCMAXMESSAGELENGTH 2147483647", childProcess.StartInfo.Arguments); + Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647 --functions-uri http://localhost:80 --functions-workerid testWorkerId --functions-requestid testId --functions-grpcmaxmessagelength 2147483647", childProcess.StartInfo.Arguments); } else { From f62f567df2d878ce414d18042c521efcbaebada1 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Mon, 11 Sep 2023 14:35:32 -0700 Subject: [PATCH 5/9] Removed duplicate port from functions_uri --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index 95b30f992c..baaff91134 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -47,7 +47,7 @@ public override string GetFormattedArguments() // Adding a second copy of the commandline arguments with the "functions-" prefix to prevent any conflicts caused by the existing generic names. // Language workers are advised to use the "functions-" prefix ones and if not present fallback to existing ones. - return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --functions-uri {ServerUri.AbsoluteUri.TrimEnd('/')}:{ServerUri.Port} --functions-workerid {WorkerId} --functions-requestid {RequestId} --functions-grpcmaxmessagelength {MaxMessageLength}"; + return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --functions-uri {ServerUri.AbsoluteUri} --functions-workerid {WorkerId} --functions-requestid {RequestId} --functions-grpcmaxmessagelength {MaxMessageLength}"; } } } From af2c41c393bc1d0118f30bd4d503787cf742fde6 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Mon, 11 Sep 2023 19:15:45 -0700 Subject: [PATCH 6/9] Switching to kebab case for the new args --- src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs index baaff91134..e39ce55adb 100644 --- a/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs +++ b/src/WebJobs.Script/Workers/Rpc/RpcWorkerContext.cs @@ -47,7 +47,7 @@ public override string GetFormattedArguments() // Adding a second copy of the commandline arguments with the "functions-" prefix to prevent any conflicts caused by the existing generic names. // Language workers are advised to use the "functions-" prefix ones and if not present fallback to existing ones. - return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --functions-uri {ServerUri.AbsoluteUri} --functions-workerid {WorkerId} --functions-requestid {RequestId} --functions-grpcmaxmessagelength {MaxMessageLength}"; + return $" --host {ServerUri.Host} --port {ServerUri.Port} --workerId {WorkerId} --requestId {RequestId} --grpcMaxMessageLength {MaxMessageLength} --functions-uri {ServerUri.AbsoluteUri} --functions-worker-id {WorkerId} --functions-request-id {RequestId} --functions-grpc-max-message-length {MaxMessageLength}"; } } } From 39499e14d23a8630698afec767134419c6235e01 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Tue, 12 Sep 2023 11:40:24 -0700 Subject: [PATCH 7/9] Update test --- .../Workers/DefaultWorkerProcessFactoryTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs index 627d4bb8b0..5952481759 100644 --- a/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs +++ b/test/WebJobs.Script.Tests/Workers/DefaultWorkerProcessFactoryTests.cs @@ -82,7 +82,7 @@ public void DefaultWorkerProcessFactory_Returns_ExpectedProcess(WorkerContext wo } if (workerContext is RpcWorkerContext) { - Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647 --functions-uri http://localhost:80 --functions-workerid testWorkerId --functions-requestid testId --functions-grpcmaxmessagelength 2147483647", childProcess.StartInfo.Arguments); + Assert.Equal(" httpvalue1 TestVal httpvalue2 --host localhost --port 80 --workerId testWorkerId --requestId testId --grpcMaxMessageLength 2147483647 --functions-uri http://localhost/ --functions-worker-id testWorkerId --functions-request-id testId --functions-grpc-max-message-length 2147483647", childProcess.StartInfo.Arguments); } else { From 514049cec623312cd347fce4bab1ba1382ed9527 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Fri, 29 Sep 2023 13:31:12 -0700 Subject: [PATCH 8/9] Update native placeholder package to handle new args --- src/WebJobs.Script/WebJobs.Script.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebJobs.Script/WebJobs.Script.csproj b/src/WebJobs.Script/WebJobs.Script.csproj index f4edb6a779..a76dd6d946 100644 --- a/src/WebJobs.Script/WebJobs.Script.csproj +++ b/src/WebJobs.Script/WebJobs.Script.csproj @@ -1,4 +1,4 @@ - + Microsoft.Azure.WebJobs.Script @@ -47,7 +47,7 @@ - + From 6b0df55de083541cb21d97a723722a762d5e5152 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Mon, 2 Oct 2023 11:47:08 -0700 Subject: [PATCH 9/9] Update release notes. --- release_notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release_notes.md b/release_notes.md index 6139d02073..f2f17c7f90 100644 --- a/release_notes.md +++ b/release_notes.md @@ -16,4 +16,5 @@ - This fixes a bug with worker indexing where we are shutting down worker channels and creating a new channel that never gets properly initialized as the invocation buffers are not created - this leads to a "Did not find initialized workers" error. - Check if a blob container or table exists before trying to create it (#9555) -- Limit dotnet-isolated specialization to 64 bit host process (#9548) \ No newline at end of file +- Limit dotnet-isolated specialization to 64 bit host process (#9548) +- Sending command line arguments to language workers with `functions-` prefix to prevent conflicts (#9514) \ No newline at end of file