Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Migration causes segfault #9

Open
robbyoconnor opened this issue May 3, 2020 · 1 comment
Open

DB Migration causes segfault #9

robbyoconnor opened this issue May 3, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@robbyoconnor
Copy link

robbyoconnor commented May 3, 2020

$ dc logs go-bot   
WARNING: The POSTGRES_USER variable is not set. Defaulting to a blank string.
WARNING: The POSTGRES_PASSWORD variable is not set. Defaulting to a blank string.
Attaching to harukax_go-bot_1
go-bot_1    | time="2020-05-03T05:10:42Z" level=fatal msg="dial tcp 172.22.0.3:5432: connect: connection refused"
go-bot_1    | 2020/05/03 05:36:22 [INFO][Database] Using database in debug mode.
go-bot_1    | 2020/05/03 05:36:22 [INFO][Database] Database connected
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [21.06ms]  CREATE TABLE "users" ("user_id" serial,"user_name" text , PRIMARY KEY ("user_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [12.87ms]  CREATE TABLE "chats" ("chat_id" text,"chat_name" text , PRIMARY KEY ("chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [16.57ms]  CREATE TABLE "warns" ("user_id" text,"chat_id" text,"num_warns" integer DEFAULT 0,"reasons" varchar(64)[] , PRIMARY KEY ("user_id","chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [10.41ms]  CREATE TABLE "warn_filters" ("chat_id" text,"keyword" text,"reply" text NOT NULL , PRIMARY KEY ("chat_id","keyword"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [10.66ms]  CREATE TABLE "warn_settings" ("chat_id" text,"warn_limit" integer DEFAULT 3,"soft_warn" boolean DEFAULT false , PRIMARY KEY ("chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [9.96ms]  CREATE TABLE "black_list_filters" ("chat_id" text,"trigger" text , PRIMARY KEY ("chat_id","trigger"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [9.36ms]  CREATE TABLE "federations" ("id" text,"owner_id" text,"fed_name" text , PRIMARY KEY ("id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [9.92ms]  CREATE TABLE "fed_chats" ("chat_id" text,"fed_ref" text , PRIMARY KEY ("chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [9.57ms]  CREATE TABLE "fed_admins" ("fed_ref" text,"user_id" text , PRIMARY KEY ("fed_ref","user_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [9.89ms]  CREATE TABLE "fed_bans" ("fed_ref" text,"user_id" text,"reason" text , PRIMARY KEY ("fed_ref","user_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [10.49ms]  CREATE TABLE "notes" ("chat_id" text,"name" text,"value" text NOT NULL,"file" text,"is_reply" boolean DEFAULT false,"has_buttons" boolean DEFAULT false,"msgtype" integer DEFAULT 1 , PRIMARY KEY ("chat_id","name"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [12.69ms]  CREATE TABLE "buttons" ("id" serial,"chat_id" text,"note_name" text,"name" text NOT NULL,"url" text NOT NULL,"same_line" boolean DEFAULT false , PRIMARY KEY ("id","chat_id","note_name"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [11.05ms]  CREATE TABLE "welcomes" ("chat_id" text,"custom_welcome" text,"should_welcome" boolean DEFAULT true,"should_mute" boolean DEFAULT true,"del_joined" boolean DEFAULT false,"clean_welcome" integer DEFAULT 0,"welcome_type" integer DEFAULT 0,"mute_time" integer DEFAULT 0 , PRIMARY KEY ("chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:22]  [10.23ms]  CREATE TABLE "welcome_buttons" ("id" serial,"chat_id" text,"name" text NOT NULL,"url" text NOT NULL,"same_line" boolean DEFAULT false , PRIMARY KEY ("id","chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:23]  [11.21ms]  CREATE TABLE "muted_users" ("user_id" text,"chat_id" text,"button_clicked" boolean DEFAULT false , PRIMARY KEY ("user_id","chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 2020/05/03 05:36:23 Auto-migrated database schema
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/db.go:50) 
go-bot_1    | [2020-05-03 05:36:23]  [10.88ms]  CREATE TABLE "rules" ("chat_id" text,"rules" text , PRIMARY KEY ("chat_id"))  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:43) 
go-bot_1    | [2020-05-03 05:36:24]  [2.20ms]  UPDATE "users" SET "user_name" = 'TermuxHackersBot'  WHERE "users"."user_id" = 1142587681  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:43) 
go-bot_1    | [2020-05-03 05:36:24]  [2.14ms]  SELECT * FROM "users"  WHERE "users"."user_id" = 1142587681 ORDER BY "users"."user_id" ASC LIMIT 1  
go-bot_1    | [0 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:43) 
go-bot_1    | [2020-05-03 05:36:24]  [1.38ms]  INSERT INTO "users" ("user_id","user_name") VALUES (1142587681,'TermuxHackersBot') RETURNING "users"."user_id"  
go-bot_1    | [1 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:89) 
go-bot_1    | [2020-05-03 05:36:24]  [0.93ms]  SELECT * FROM "users"    
go-bot_1    | [1 rows affected or returned ] 
go-bot_1    | panic: runtime error: invalid memory address or nil pointer dereference
go-bot_1    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x54e246]
go-bot_1    | 
go-bot_1    | goroutine 1 [running]:
go-bot_1    | github.com/allegro/bigcache.(*BigCache).Set(0x0, 0x97c5bd, 0x5, 0xc000140400, 0x37, 0x40, 0x0, 0x0)
go-bot_1    | 	/go/pkg/mod/github.com/allegro/bigcache@v1.2.1/bigcache.go:115 +0x26
go-bot_1    | github.com/HarukaNetwork/HarukaX/harukax/modules/sql.cacheUser(0xc0002581a0, 0x8ba520, 0xc00036a2c0)
go-bot_1    | 	/harukax/harukax/modules/sql/users_sql.go:91 +0x145
go-bot_1    | github.com/HarukaNetwork/HarukaX/harukax/modules/sql.EnsureBotInDb(0xc000275220)
go-bot_1    | 	/harukax/harukax/modules/sql/users_sql.go:44 +0x8f
go-bot_1    | main.main()
go-bot_1    | 	/harukax/main.go:55 +0x2b1
go-bot_1    | 2020/05/03 07:44:33 [INFO][Database] Using database in debug mode.
go-bot_1    | 2020/05/03 07:44:33 [INFO][Database] Database connected
go-bot_1    | 2020/05/03 07:44:33 Auto-migrated database schema
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:43) 
go-bot_1    | [2020-05-03 07:44:34]  [2.18ms]  UPDATE "users" SET "user_name" = 'TermuxHackersBot'  WHERE "users"."user_id" = 1142587681  
go-bot_1    | [1 rows affected or returned ] 
go-bot_1    | 
go-bot_1    | (/harukax/harukax/modules/sql/users_sql.go:89) 
go-bot_1    | [2020-05-03 07:44:34]  [0.81ms]  SELECT * FROM "users"    
go-bot_1    | [1 rows affected or returned ] 
go-bot_1    | panic: runtime error: invalid memory address or nil pointer dereference
go-bot_1    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x54e246]
go-bot_1    | 
go-bot_1    | goroutine 1 [running]:
go-bot_1    | github.com/allegro/bigcache.(*BigCache).Set(0x0, 0x97c5bd, 0x5, 0xc0003dc1c0, 0x37, 0x40, 0x0, 0x10)
go-bot_1    | 	/go/pkg/mod/github.com/allegro/bigcache@v1.2.1/bigcache.go:115 +0x26
go-bot_1    | github.com/HarukaNetwork/HarukaX/harukax/modules/sql.cacheUser(0xc000210270, 0x8ba520, 0xc0003cc100)
go-bot_1    | 	/harukax/harukax/modules/sql/users_sql.go:91 +0x145
go-bot_1    | github.com/HarukaNetwork/HarukaX/harukax/modules/sql.EnsureBotInDb(0xc0002690e0)
go-bot_1    | 	/harukax/harukax/modules/sql/users_sql.go:44 +0x8f
go-bot_1    | main.main()
go-bot_1    | 	/harukax/main.go:55 +0x2b1

@SphericalKat SphericalKat self-assigned this May 3, 2020
@SphericalKat SphericalKat added the bug Something isn't working label May 3, 2020
@robbyoconnor
Copy link
Author

I ran it using a modified dockerfile: #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants