QuokkaStake / cosmos-proposals-checker

A tool to notify you if you miss a proposal vote on any cosmos-sdk chain
GNU General Public License v3.0
14 stars 25 forks source link

panic: Could not query SQLite database #109

Open bombermine3 opened 4 days ago

bombermine3 commented 4 days ago

The app is likely supposed to create a database on the first run. Instead, I’m getting this error.

1:51PM INF Provided config is valid.                                                   
1:51PM PNC Could not query SQLite database component=database                                                                                                                 
panic: Could not query SQLite database                                                 

goroutine 1 [running]:                                                                 
main/pkg/database.(*SqliteDatabase).Init.(*Logger).Panic.func2({0xc5d0e2?, 0x0?})  
        /home/runner/go/pkg/mod/github.com/rs/zerolog@v1.26.1/log.go:359 +0x27         
github.com/rs/zerolog.(*Event).msg(0xc00007ec00, {0xc5d0e2, 0x1f})                 
        /home/runner/go/pkg/mod/github.com/rs/zerolog@v1.26.1/event.go:149 +0x2b9                                                                                             
github.com/rs/zerolog.(*Event).Msg(...)                                                                                                                                       
        /home/runner/go/pkg/mod/github.com/rs/zerolog@v1.26.1/event.go:108
main/pkg/database.(*SqliteDatabase).Init(0xc0001c5e60)                                                                                                                        
        /home/runner/work/cosmos-proposals-checker/cosmos-proposals-checker/pkg/database/sqlite.go:59 +0x12a
main/pkg.(*App).Start(0xc000090a00)     
        /home/runner/work/cosmos-proposals-checker/cosmos-proposals-checker/pkg/app.go:104 +0x28
main.ExecuteMain({0x7ffef375259e?, 0xc00019fce0?})                                     
        /home/runner/work/cosmos-proposals-checker/cosmos-proposals-checker/cmd/cosmos-proposals-checker.go:18 +0x39
main.main.func1(0xc0000e2c00?, {0xc479dd?, 0x7?, 0xc452d1?})                           
        /home/runner/work/cosmos-proposals-checker/cosmos-proposals-checker/cmd/cosmos-proposals-checker.go:48 +0x1e
github.com/spf13/cobra.(*Command).execute(0xc0001b9608, {0xc0000342b0, 0x2, 0x2})                                                                                             
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x684    
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001b9608)                               
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x38d                                                                                           
github.com/spf13/cobra.(*Command).Execute(...)                                         
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902                                                                                                  
main.main()                                                                            
        /home/runner/work/cosmos-proposals-checker/cosmos-proposals-checker/cmd/cosmos-proposals-checker.go:68 +0x265
freak12techno commented 3 days ago

Weird that I do not have it, and you're the 2nd person who can reproduce it.

Can you build from source, change this line https://github.com/QuokkaStake/cosmos-proposals-checker/blob/main/pkg/database/sqlite.go#L59 to have Err(versionErr) and try running and sharing its output? Would help a lot.

(I have a typo there, will fix a bit later, but with this typo it doesn't show the real error.)

bombermine3 commented 3 days ago

This is very strange because everything is working now. Yesterday, I tried installing from both the deb package and the source code, but the result was the same. Today, after making this changes and rebuilding, everything works.

$ ./cosmos-proposals-checker --config /etc/cosmos-proposals-checker/config.toml 
7:02AM INF Provided config is valid.
7:02AM INF SQLite database connected component=database path=/var/lib/cosmos-proposals-checker/database.sqlite version=3.46.1
7:02AM DBG OK   20241015181844_add_proposals.sql (4.58ms) component=migrations
7:02AM DBG OK   20241015214518_add_votes.sql (4.2ms) component=migrations
7:02AM DBG OK   20241016191744_add_query_last_block.sql (6.66ms) component=migrations
7:02AM DBG OK   20241018131531_add_mutes.sql (5.12ms) component=migrations
7:02AM DBG goose: successfully migrated database to version: 20241018131531 component=migrations
7:02AM INF Init reporter component=report_dispatcher name=pagerduty-reporter
7:02AM INF Init reporter component=report_dispatcher name=telegram-reporter
7:02AM DBG Discord credentials not set, not creating Discord reporter component=discord_reporter
7:02AM INF Scheduled proposals reporting interval="@every 30m"
bombermine3 commented 3 days ago

I just checked again, this time running it through systemd (in case I made a mistake) – the deb version still doesn’t work. The freshly built one works fine.

freak12techno commented 2 days ago

@bombermine3 I just released v6.0.1 that doesn't fix the issue (or well it shouldn't), but should display the error you're getting. can you try running it from a deb package and share the output?

bombermine3 commented 2 days ago
10:46PM PNC Could not query SQLite database error="Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub" component=database
panic: Could not query SQLite database
freak12techno commented 2 days ago

@bombermine3 okay gotcha, it seems to be goreleaser issue then, thanks for investigating! I'll fix it probably today or tomorrow, for now you can use the version built from source, as it is likely to work now.