[GitHub] [apisix] moonming commented on a change in pull request #5682: fix(patch): add global `math.randomseed` patch support

2021-12-06 Thread GitBox


moonming commented on a change in pull request #5682:
URL: https://github.com/apache/apisix/pull/5682#discussion_r763560122



##
File path: apisix/patch.lua
##
@@ -86,6 +93,64 @@ do
 end
 
 
+do -- `math.randomseed` patch
+
+-- Seeds the random generator, use with care.
+-- Once - properly - seeded, this method is replaced with a stub
+-- one. This is to enforce best-practices for seeding in ngx_lua,
+-- and prevents third-party modules from overriding our correct seed
+-- (many modules make a wrong usage of `math.randomseed()` by calling
+-- it multiple times or by not using unique seeds for Nginx workers).
+-- Inspired by kong.globalpatches

Review comment:
   if these codes are copied from kong, you MUST add copyright in 
https://github.com/apache/apisix/blob/master/LICENSE.
   if not, please remove this line.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [apisix] moonming commented on a change in pull request #5682: fix(patch): add global `math.randomseed` patch support

2021-12-04 Thread GitBox


moonming commented on a change in pull request #5682:
URL: https://github.com/apache/apisix/pull/5682#discussion_r762510942



##
File path: apisix/patch.lua
##
@@ -86,6 +92,53 @@ do
 end
 
 
+-- Inspired by kong.globalpatches
+do -- `_G.math.randomseed` patch

Review comment:
   why we need this patch?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org