Warning on global variable usages

オープン
#82 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
lua, nginx
領域
backend

調査の方向性

Start with the Lua files named in the warnings: /usr/local/openresty/nginx/lualib/router.lua, ceryx/utils.lua, and ceryx/routes.lua; inspect the assignments at the reported lines and how those functions are used. Confirm the affected files in the repository, then run the relevant project checks. Done when the reported globals are local and the warnings no longer occur.

索引モデルが issue の本文から書いたものです。

説明

Hi,
I get the following warnings when the debug is turned on:

today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('formatTarget') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:12: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('redirect') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:19: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('proxy') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:24: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('routeRequest') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:29: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 207.46.13.223 - - [17/Mar/2020:15:20:44 +0000] "GET / HTTP/1.1" 301 175 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
today at 11:20 AM 2020/03/17 15:20:44 [info] 13#13: *34 client 207.46.13.223 closed keepalive connection
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('starts_with') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:3: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('ends_with') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:7: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('starts_with_protocol') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:11: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('has_trailing_slash') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:15: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getRouteKeyForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:5: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getSettingsKeyForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:9: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('targetIsInValid') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:13: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getTargetForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:17: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getModeForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:40: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getRouteForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:52: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:14: client(): Preparing Redis client.
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:27: client(): Redis client prepared.
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:37: client(): Authenticated with Redis.
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('formatTarget') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:12: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('redirect') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:19: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('proxy') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:24: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('routeRequest') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:

All of these variables need to be declared as local.

Thanks

主要言語
Python
スター
814
フォーク
145
平均マージ
3時間 42分
マージ済み PR(30日)
6

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

withlogicco/ceryx のほかの issue

withlogicco/ceryx の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。