System.Exception: database disk image is malformed

20 views
Skip to first unread message

workatf...@gmail.com

unread,
Nov 11, 2021, 4:28:38 PM11/11/21
to rqlite
Hello,

Started having this intermittent error after creating a cluster with one read-write node (call it node.1) and 8 read-only nodes:

      System.Exception: database disk image is malformed

After some time I noticied this happening while another process was writing (through node.1) (my "reading service" only queries read-only nodes) 

Bellow the status query (don't know if this has something meaningful):

"build": {
        "branch": "master",
        "build_time": "unknown",
        "commit": "0cbff00dc99261576cc7dd95b902ec1fd7d7bb8f",
        "compiler": "gc",
        "version": "6"
    },
    "cluster": {
        "addr": "192.168.67.204:4002",
        "api_addr": "vm-16cores:4001",
        "https": "false"
    },
    "http": {
        "auth": "disabled",
        "bind_addr": "192.168.67.204:4001",
        "cluster": {
            "local_node_addr": "192.168.67.204:4002",
            "timeout": 30000000000
        }
    },
    "node": {
        "start_time": "2021-11-11T17:49:52.6710257Z",
        "uptime": "3h20m31.2287012s"
    },
    "os": {
        "executable": "C:\\Program Files\\Finantech\\MemFeedSetup\\rqlited.exe",
        "hostname": "VM-16cores",
        "page_size": 4096,
        "pid": 12660,
        "ppid": 11316
    },
    "runtime": {
        "GOARCH": "amd64",
        "GOMAXPROCS": 16,
        "GOOS": "windows",
        "num_cpu": 16,
        "num_goroutine": 64,
        "version": "go1.17.1"
    },
    "store": {
        "addr": "192.168.67.204:4002",
        "apply_timeout": "10s",
        "db_applied_index": 22838,
        "db_conf": {
            "memory": true,
            "fk_constraints": false
        },
        "dir": "C:\\Program Files\\Finantech\\MemFeedSetup\\node.1",
        "dir_size": 138844593,
        "election_timeout": "1s",
        "fsm_index": 22838,
        "heartbeat_timeout": "1s",
        "leader": {
            "addr": "192.168.67.204:4002",
            "node_id": "vm-16cores:4002"
        },
        "node_id": "vm-16cores:4002",
        "nodes": [
            {
                "id": "vm-16cores:4002",
                "addr": "192.168.67.204:4002",
                "suffrage": "Voter"
            },
            {
                "id": "vm-16cores:4004",
                "addr": "192.168.67.204:4004",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4006",
                "addr": "192.168.67.204:4006",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4008",
                "addr": "192.168.67.204:4008",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4010",
                "addr": "192.168.67.204:4010",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4012",
                "addr": "192.168.67.204:4012",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4014",
                "addr": "192.168.67.204:4014",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4016",
                "addr": "192.168.67.204:4016",
                "suffrage": "Nonvoter"
            },
            {
                "id": "vm-16cores:4018",
                "addr": "192.168.67.204:4018",
                "suffrage": "Nonvoter"
            }
        ],
        "raft": {
            "applied_index": 22838,
            "bolt": {
                "num_free_pages": 573,
                "num_pending_pages": 9,
                "free_alloc": 2383872,
                "free_list_inuse": 4672,
                "num_tx_read": 2743,
                "num_tx_open": 0,
                "tx_stats": {
                    "page_count": 125375,
                    "page_alloc": 1220620288,
                    "cursor_count": 74025,
                    "node_count": 94140,
                    "node_deref": 38,
                    "rebalance": 6247,
                    "rebalance_time": 3817100,
                    "split": 11540,
                    "spill": 102529,
                    "spill_time": 1370412300,
                    "write": 148221,
                    "write_time": 222163569800
                }
            },
            "commit_index": 22838,
            "fsm_pending": 0,
            "last_contact": 0,
            "last_log_index": 22838,
            "last_log_term": 2,
            "last_snapshot_index": 16461,
            "last_snapshot_term": 2,
            "latest_configuration": "[{Suffrage:Voter ID:vm-16cores:4002 Address:192.168.67.204:4002} {Suffrage:Nonvoter ID:vm-16cores:4012 Address:192.168.67.204:4012} {Suffrage:Nonvoter ID:vm-16cores:4014 Address:192.168.67.204:4014} {Suffrage:Nonvoter ID:vm-16cores:4010 Address:192.168.67.204:4010} {Suffrage:Nonvoter ID:vm-16cores:4004 Address:192.168.67.204:4004} {Suffrage:Nonvoter ID:vm-16cores:4016 Address:192.168.67.204:4016} {Suffrage:Nonvoter ID:vm-16cores:4018 Address:192.168.67.204:4018} {Suffrage:Nonvoter ID:vm-16cores:4006 Address:192.168.67.204:4006} {Suffrage:Nonvoter ID:vm-16cores:4008 Address:192.168.67.204:4008}]",
            "latest_configuration_index": 0,
            "log_size": 134217728,
            "num_peers": 0,
            "protocol_version": 3,
            "protocol_version_max": 3,
            "protocol_version_min": 0,
            "snapshot_version_max": 1,
            "snapshot_version_min": 0,
            "state": "Leader",
            "term": 2
        },
        "request_marshaler": {
            "compression_batch": 5,
            "compression_size": 150,
            "force_compression": false
        },
        "snapshot_interval": 30000000000,
        "snapshot_threshold": 8192,
        "sqlite3": {
            "compile_options": [
                "COMPILER=gcc-10.3.0",
                "DEFAULT_WAL_SYNCHRONOUS=1",
                "ENABLE_DBSTAT_VTAB",
                "ENABLE_FTS3",
                "ENABLE_FTS3_PARENTHESIS",
                "ENABLE_JSON1",
                "ENABLE_RTREE",
                "ENABLE_UPDATE_DELETE_LIMIT",
                "OMIT_DEPRECATED",
                "OMIT_SHARED_CACHE",
                "SYSTEM_MALLOC",
                "THREADSAFE=1"
            ],
            "conn_pool_stats": {
                "ro": {
                    "max_open_connections": 0,
                    "open_connections": 2,
                    "in_use": 0,
                    "idle": 2,
                    "wait_count": 0,
                    "wait_duration": 0,
                    "max_idle_closed": 0,
                    "max_idle_time_closed": 0,
                    "max_lifetime_closed": 0
                },
                "rw": {
                    "max_open_connections": 1,
                    "open_connections": 1,
                    "in_use": 0,
                    "idle": 1,
                    "wait_count": 0,
                    "wait_duration": 0,
                    "max_idle_closed": 0,
                    "max_idle_time_closed": 0,
                    "max_lifetime_closed": 0
                }
            },
            "db_size": 9199616,
            "mem_stats": {
                "cache_size": -2000,
                "freelist_count": 2,
                "hard_heap_limit": 0,
                "max_page_count": 1073741823,
                "page_count": 2246,
                "page_size": 4096,
                "soft_heap_limit": 0
            },
            "path": ":memory:",
            "ro_dsn": "file:/CnbqfGggdPkhBtANlAph?mode=ro\u0026vfs=memdb\u0026_txlock=deferred\u0026_fk=false",
            "rw_dsn": "file:/CnbqfGggdPkhBtANlAph?mode=rw\u0026vfs=memdb\u0026_txlock=immediate\u0026_fk=false",
            "version": "3.36.0"
        },
        "trailing_logs": 10240
    }
}

My read request:

curl --location --request POST 'http://vm-16cores:4003/db/query?level=none' \
--header 'Content-Type: application/json' \
--data-raw '["WITH grupos_ AS MATERIALIZED (\r\n    -- Grupos associados a \u00C3\u00ADndices\r\n    SELECT \r\n          sg.SECURITY_GROUP_TYPE\tGRUPO,\r\n          sg.SECURITY_GROUP_ID\t\tDSC_INDICE,\r\n          sg.DESCR\t\t\t\t\t      DESCRICAO, \r\n          --fn.COD_MNEMONICA,\r\n          --'\'''\''\t\t\t\t\t\tCODIGO,\r\n          --( SELECT ALIAS FROM SMS_EXCHANGE_ALIAS WHERE EXCHANGE_ID = se.EXCHANGE_ID AND TYPE = '\''COD_BOLSA'\'' )\r\n          --\t\t\t\t\t\t\tCOD_BOLSA, \t\t\tAS COD_BOLSA, -- Exemplo: 24\r\n          '\''I'\'' \t\t\t\t\t\t        TIPO,\r\n          se.SECURITY_EXCHANGE_ID,\r\n          se.EXCHANGE_ID,\r\n          se.SYMBOL,\r\n          se.SECURITY_TYPE\r\n    FROM  SMS_SECURITY_GROUP sg\r\n          JOIN SMS_SECURITY_EXCHANGE se ON se.SECURITY_EXCHANGE_ID = sg.SECURITY_EXCHANGE_ID\r\n    WHERE\r\n          ( '\''PSI20'\'' IS NULL OR sg.SECURITY_GROUP_ID = '\''PSI20'\'' )\r\n    AND\t  ( null IS NULL  OR sg.SECURITY_GROUP_TYPE = null )\r\n    UNION ALL\r\n    -- T\u00C3\u00ADtulos dos grupos (retornar se 1 > 0)\r\n    SELECT \r\n          sg.SECURITY_GROUP_TYPE\tGRUPO,\r\n          sg.SECURITY_GROUP_ID\t  DSC_INDICE,\r\n          '\'''\''  \t\t\t\t\t          DESCRICAO,\r\n          --sgd.SYMBOL\t\t\t\tCOD_MNEMONICA,\r\n          --se.COD_ISIN\t\t\t\tCODIGO,\r\n          --( SELECT ALIAS FROM SMS_EXCHANGE_ALIAS WHERE EXCHANGE_ID = se.EXCHANGE_ID AND TYPE = '\''COD_BOLSA'\'' )\r\n          --\t\t\t\t\t\t\tCOD_BOLSA, \t\t\tAS COD_BOLSA, -- Exemplo: 24\r\n          '\''D'\'' \t\t\t\t\t          TIPO,\r\n          sgd.SECURITY_EXCHANGE_ID,\r\n          sgd.EXCHANGE_ID,\r\n          sgd.SYMBOL,\r\n          sgd.SECURITY_TYPE\r\n    FROM \r\n           SMS_SECURITY_GROUP sg\r\n           JOIN SMS_SECURITY_GROUP_DETAIL sgd ON sgd.SECURITY_GROUP_ID = sg.SECURITY_GROUP_ID\r\n           \/*JOIN SMS_SECURITY_EXCHANGE se      ON se.EXCHANGE_ID = sgd.EXCHANGE_ID\r\n                                             AND se.SYMBOL = sgd.SYMBOL\r\n                                             AND se.SECURITY_TYPE = sgd.SECURITY_TYPE*\/\r\n    WHERE \r\n        1 > 0\r\n    AND\t( '\''PSI20'\'' IS NULL OR sg.SECURITY_GROUP_ID = '\''PSI20'\'' )\r\n    AND\t( null IS NULL  OR sg.SECURITY_GROUP_TYPE = null )\r\n) \r\nSELECT \/* SGCFGruposTitulos *\/\r\n\t\t-- ****\r\n\t\t-- Grupo\r\n\t\t--\r\n\t\ttit.GRUPO,\r\n\t\ttit.DSC_INDICE,\r\n\t\ttit.DESCRICAO,\r\n\t\t-- ****\r\n\t\t-- \u00C3\u008Dndice \/ T\u00C3\u00ADtulo\r\n\t\t--\r\n\t\ttit.TIPO, -- '\''I'\''-\u00C3\u008Dndice (grupo) \/ '\''D'\''-Detalhe (t\u00C3\u00ADtulo grupo)\r\n\t\ttit_fn.COD_MNEMONICA,\r\n\t\ttit_fn.VAL_BOLSA,\r\n\t\ttit_fn.DSC_BOLSA,\r\n\t\t-- ****\r\n\t\t-- IF @COTACAO > 0\r\n\t\t--\r\n\t\tcot.DATA_COTACAO,\r\n\t\tcot.HORA_COTACAO,\r\n\t\tcot.VAL_COT_ABERTURA,\r\n\t\tcot.VAL_COT_MAX,\r\n\t\tcot.VAL_COT_MIN,\r\n\t\tcot.VAL_COT_FECHO, \r\n\t\tcot.VAL_COT_ULTIMA,\r\n\t\tcot.VAL_QT_ULTIMA,\r\n\t\tcot.VAL_COT_COMPRA,\r\n\t\tcot.VAL_COT_VENDA,\r\n\t\tcot.VAL_QT_COMPRA,\r\n\t\tcot.VAL_QT_VENDA,\r\n\t\tcot.VAL_QT_TRANS,\r\n\t\tcot.VAL_VARIACAO,\r\n\t\tcot.VAL_VARIACAO_ABS,\r\n\t\tcot.VAL_PRECO_MEDIO,\r\n\t\tcot.VAL_MONT_TRANS,\r\n\t\tcot.VAL_VARIACAO_ANO,\r\n\t\tcot.VAL_MONT_TOTAL,\r\n\t\t-- ****\r\n\t\t-- \u00C3\u008Dndice \/ T\u00C3\u00ADtulo\r\n\t\t--\r\n\t\tCASE WHEN tit.TIPO = '\''D'\'' THEN tit_fn.CODIGO END CODIGO,\r\n\t\ttit_fn.COD_BOLSA, \r\n\t\ttit_fn.COD_MOEDA,\r\n\t\ttit_fn.DSC_LONGA\r\nFROM grupos_ tit\r\n  \t LEFT JOIN V_TP_FEED_NOMES tit_fn ON tit_fn.SECURITY_EXCHANGE_ID = tit.SECURITY_EXCHANGE_ID\r\n                                       --tit_fn.EXCHANGE_ID = tit.EXCHANGE_ID AND tit_fn.SECURITY_TYPE = tit.SECURITY_TYPE AND tit_fn.SYMBOL = tit.SYMBOL\r\n\t  -- IF @COTACAO > 0\r\n\t  LEFT JOIN V_TP_FEED_COTACOES_ONLINE_DELAY cot ON 1 > 0\r\n                          --AND cot.SECURITY_EXCHANGE_ID = tit.SECURITY_EXCHANGE_ID\r\n\t\t\t\t\t\t\t\t\t\t\t\t  AND cot.EXCHANGE_ID = tit.EXCHANGE_ID\r\n\t\t\t\t\t\t\t\t\t\t\t\t  AND cot.SYMBOL = tit.SYMBOL\r\n\t\t\t\t\t\t\t\t\t\t\t\t  AND cot.SECURITY_TYPE = tit.SECURITY_TYPE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  --IF @REALTIME > 0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  --\t\tSET @TYPE = '\''TP_FEED_COTACOES'\''\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  --\tELSE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t  --\t\tSET @TYPE = '\''vCotacoesMix'\''\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t  AND cot.ONLINE_DELAY = CASE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t     WHEN 1 > 0 THEN '\''O'\''\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t     WHEN tit_fn.FLAG_BCP = '\''Y'\'' THEN '\''O'\''\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t     WHEN tit_fn.FLAG_EURONEXT = '\''Y'\'' AND tit_fn.FLAG_INDEX = '\''Y'\'' THEN '\''O'\''\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t     ELSE '\''D'\''\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t     END\r\nORDER BY\r\n\ttit.GRUPO,\r\n\ttit.DSC_INDICE,\r\n\ttit.TIPO DESC\r\nLIMIT\t\t\t\r\n\tIFNULL(1000,0);"]'

If it helps at all, I can provide postman collection with db schema creation and DML.

Philip O'Toole

unread,
Nov 11, 2021, 5:20:33 PM11/11/21
to rql...@googlegroups.com
Hmmm, that's not great. Sorry you're hitting that. First time I've received any report of this.

It's going to be difficult to debug this unless you can reproduce it. Any chance you can do that?

--
You received this message because you are subscribed to the Google Groups "rqlite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rqlite+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rqlite/878ac821-2e85-4d08-83e4-e25169c64ee0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages