urgent bug fix 100% CPU, pprof with DEBUG env,

pull/655/head
hunterlong 2020-06-10 23:11:39 -07:00
parent 6fd87b7a2f
commit 1b68476b81
7 changed files with 160 additions and 161 deletions

View File

@ -143,160 +143,160 @@ jobs:
env: env:
COVERALLS: ${{ secrets.COVERALLS }} COVERALLS: ${{ secrets.COVERALLS }}
# test-postman-sqlite: test-postman-sqlite:
# needs: compile needs: compile
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/setup-go@v2 - uses: actions/setup-go@v2
# with: with:
# go-version: '1.14.2' go-version: '1.14.2'
#
# - name: Setting ENV's - name: Setting ENV's
# run: | run: |
# echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
# echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin" echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin"
# echo ::set-env name=VERSION::$(cat version.txt) echo ::set-env name=VERSION::$(cat version.txt)
# shell: bash shell: bash
#
# - name: Download Compiled Frontend (rice-box.go) - name: Download Compiled Frontend (rice-box.go)
# uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
# with: with:
# name: static-rice-box name: static-rice-box
# path: ./source path: ./source
#
# - name: Install Statping - name: Install Statping
# env: env:
# VERSION: ${{ env.VERSION }} VERSION: ${{ env.VERSION }}
# run: | run: |
# make build make build
# chmod +x statping chmod +x statping
# mv statping $(go env GOPATH)/bin/ mv statping $(go env GOPATH)/bin/
#
# - name: Run Statping - name: Run Statping
# run: | run: |
# API_SECRET=demosecret123 statping --port=8585 > /dev/null & API_SECRET=demosecret123 statping --port=8585 > /dev/null &
# sleep 5 sleep 5
#
# - name: Postman SQLite Tests - name: Postman SQLite Tests
# uses: matt-ball/newman-action@master uses: matt-ball/newman-action@master
# with: with:
# apiKey: ${{ secrets.POSTMAN_API }} apiKey: ${{ secrets.POSTMAN_API }}
# collection: ./dev/postman.json collection: ./dev/postman.json
# environment: ./dev/postman_env_sqlite.json environment: ./dev/postman_env_sqlite.json
# timeoutRequest: 30000 timeoutRequest: 30000
# delayRequest: 600 delayRequest: 600
#
# test-postman-mysql: test-postman-mysql:
# needs: compile needs: compile
# runs-on: ubuntu-latest runs-on: ubuntu-latest
#
# services: services:
# mysql: mysql:
# image: mysql:5.7 image: mysql:5.7
# env: env:
# MYSQL_ROOT_PASSWORD: password123 MYSQL_ROOT_PASSWORD: password123
# MYSQL_DATABASE: statping MYSQL_DATABASE: statping
# ports: ports:
# - 3306:3306 - 3306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
#
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/setup-go@v2 - uses: actions/setup-go@v2
# with: with:
# go-version: '1.14.2' go-version: '1.14.2'
#
# - name: Setting ENV's - name: Setting ENV's
# run: | run: |
# echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
# echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin" echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin"
# echo ::set-env name=VERSION::$(cat version.txt) echo ::set-env name=VERSION::$(cat version.txt)
# shell: bash shell: bash
#
# - name: Download Compiled Frontend (rice-box.go) - name: Download Compiled Frontend (rice-box.go)
# uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
# with: with:
# name: static-rice-box name: static-rice-box
# path: ./source path: ./source
#
# - name: Install Statping - name: Install Statping
# env: env:
# VERSION: ${{ env.VERSION }} VERSION: ${{ env.VERSION }}
# run: | run: |
# make build make build
# chmod +x statping chmod +x statping
# mv statping $(go env GOPATH)/bin/ mv statping $(go env GOPATH)/bin/
#
# - name: Run Statping - name: Run Statping
# run: | run: |
# API_SECRET=demosecret123 statping --port=8585 > /dev/null & API_SECRET=demosecret123 statping --port=8585 > /dev/null &
# sleep 5 sleep 5
#
# - name: Postman MySQL Tests - name: Postman MySQL Tests
# uses: matt-ball/newman-action@master uses: matt-ball/newman-action@master
# with: with:
# apiKey: ${{ secrets.POSTMAN_API }} apiKey: ${{ secrets.POSTMAN_API }}
# collection: ./dev/postman.json collection: ./dev/postman.json
# environment: ./dev/postman_env_mysql.json environment: ./dev/postman_env_mysql.json
# timeoutRequest: 30000 timeoutRequest: 30000
# delayRequest: 600 delayRequest: 600
#
# test-postman-postgres: test-postman-postgres:
# needs: compile needs: compile
# runs-on: ubuntu-latest runs-on: ubuntu-latest
#
# services: services:
# postgres: postgres:
# image: postgres:10.8 image: postgres:10.8
# env: env:
# POSTGRES_USER: root POSTGRES_USER: root
# POSTGRES_PASSWORD: password123 POSTGRES_PASSWORD: password123
# POSTGRES_DB: statping POSTGRES_DB: statping
# ports: ports:
# - 5432:5432 - 5432:5432
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
#
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/setup-go@v2 - uses: actions/setup-go@v2
# with: with:
# go-version: '1.14.2' go-version: '1.14.2'
#
# - name: Setting ENV's - name: Setting ENV's
# run: | run: |
# echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
# echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin" echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin"
# echo ::set-env name=VERSION::$(cat version.txt) echo ::set-env name=VERSION::$(cat version.txt)
# shell: bash shell: bash
#
# - name: Download Compiled Frontend (rice-box.go) - name: Download Compiled Frontend (rice-box.go)
# uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
# with: with:
# name: static-rice-box name: static-rice-box
# path: ./source path: ./source
#
# - name: Install Statping - name: Install Statping
# env: env:
# VERSION: ${{ env.VERSION }} VERSION: ${{ env.VERSION }}
# run: | run: |
# make build make build
# chmod +x statping chmod +x statping
# mv statping $(go env GOPATH)/bin/ mv statping $(go env GOPATH)/bin/
#
# - name: Run Statping - name: Run Statping
# run: | run: |
# API_SECRET=demosecret123 statping --port=8585 > /dev/null & API_SECRET=demosecret123 statping --port=8585 > /dev/null &
# sleep 5 sleep 5
#
# - name: Postman Postgres Tests - name: Postman Postgres Tests
# uses: matt-ball/newman-action@master uses: matt-ball/newman-action@master
# with: with:
# apiKey: ${{ secrets.POSTMAN_API }} apiKey: ${{ secrets.POSTMAN_API }}
# collection: ./dev/postman.json collection: ./dev/postman.json
# environment: ./dev/postman_env_postgres.json environment: ./dev/postman_env_postgres.json
# timeoutRequest: 30000 timeoutRequest: 30000
# delayRequest: 600 delayRequest: 600
build-binaries: build-binaries:
needs: compile needs: compile
@ -361,7 +361,7 @@ jobs:
path: ./build path: ./build
upload-release: upload-release:
needs: [test, build-binaries] needs: [test, test-postman-sqlite, test-postman-mysql, test-postman-postgres, build-binaries]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -1,4 +1,5 @@
# 0.90.47 (06-10-2020) # 0.90.47 (06-10-2020)
- Fixed Urgent bug taking 100% of CPU (Timer)
- Modified HTTP server, now in it's own go routine/channel - Modified HTTP server, now in it's own go routine/channel
- Fixed Service form for editing - Fixed Service form for editing
- Added pprof golang debugging http server if `GO_ENV` == "test" - Added pprof golang debugging http server if `GO_ENV` == "test"
@ -8,6 +9,7 @@
- Added `LOGS_MAX_COUNT` - Added `LOGS_MAX_COUNT`
- Added `LOGS_MAX_AGE` - Added `LOGS_MAX_AGE`
- Added `LOGS_MAX_SIZE` - Added `LOGS_MAX_SIZE`
- Added `DEBUG` (starts a pprof golang debugging http server on port 9090, defaults to false)
- Confirmed `DISABLE_LOGS` is working - Confirmed `DISABLE_LOGS` is working
- Modified Mobile Notifier to fit new push notification server endpoint - Modified Mobile Notifier to fit new push notification server endpoint
- PR Merged: Fix time conversion in overview and charts #645 - PR Merged: Fix time conversion in overview and charts #645

View File

@ -34,12 +34,12 @@ CacheRoutine:
case <-s.running: case <-s.running:
break CacheRoutine break CacheRoutine
case <-time.After(duration): case <-time.After(duration):
duration = 5 * time.Second
for k, v := range s.List() { for k, v := range s.List() {
if v.Expired() { if v.Expired() {
s.Delete(k) s.Delete(k)
} }
} }
duration = 5 * time.Second
} }
} }
} }

View File

@ -67,8 +67,6 @@ func RunHTTPServer() error {
select { select {
case err := <-httpError: case err := <-httpError:
return err return err
default:
} }
} }
} }

View File

@ -49,7 +49,7 @@ func Router() *mux.Router {
r.Use(sendLog) r.Use(sendLog)
} }
if utils.Params.GetString("GO_ENV") == "test" { if utils.Params.GetBool("DEBUG") {
go func() { go func() {
log.Infoln("Starting pprof web server on http://0.0.0.0:9090") log.Infoln("Starting pprof web server on http://0.0.0.0:9090")
r := http.NewServeMux() r := http.NewServeMux()

View File

@ -47,8 +47,6 @@ CheckLoop:
} else { } else {
s.SleepDuration = s.Checkpoint.Sub(time.Now()) s.SleepDuration = s.Checkpoint.Sub(time.Now())
} }
default:
} }
} }
} }

View File

@ -30,6 +30,7 @@ func InitEnvs() {
Params.SetDefault("DISABLE_HTTP", false) Params.SetDefault("DISABLE_HTTP", false)
Params.SetDefault("STATPING_DIR", defaultDir) Params.SetDefault("STATPING_DIR", defaultDir)
Params.SetDefault("GO_ENV", "production") Params.SetDefault("GO_ENV", "production")
Params.SetDefault("DEBUG", false)
Params.SetDefault("DB_CONN", "") Params.SetDefault("DB_CONN", "")
Params.SetDefault("DISABLE_LOGS", false) Params.SetDefault("DISABLE_LOGS", false)
Params.SetDefault("USE_ASSETS", false) Params.SetDefault("USE_ASSETS", false)