diodechain / diode_server

Diode Server
https://diode.io
Other
39 stars 9 forks source link

Server stuck syncing #26

Closed tuhalf closed 1 year ago

tuhalf commented 2 years ago

My server was running for a long time. It stoped when I ran out of disk space. I extended the disk and now it's stuck syncing blocks. It starts extending from 4610000 and goes to 4620000 but then turns back to 4610000. It's stuck in that block. While extending, it's printing out extended alt messages multiple times.

Chain.add_block: Extending main #4611312[0x000049134a](1 TX) @enrich_turtle 
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle
Chain.add_block: Extended   alt #4611312[0x000049134a](1 TX) @enrich_turtle | (@#4611312[0x000049134a](1 TX) @enrich_turtle

And constantly printing out this error:

Ancestors: [Model.Sql, Diode.Supervisor, #PID<0.343.0>]
Message Queue Length: 17
Messages: ["$gen_cast": {:submit, ......I cut this part because it was so long....... }]
Links: [#PID<0.23491.0>, #PID<0.23506.0>, #PID<0.346.0>]
Dictionary: [{Stats, ""}]
Trapping Exits: false
Status: :running
Heap Size: 833026
Stack Size: 29
Reductions: 5852961
Neighbours:
    #PID<0.23491.0>
        Initial Call: Sqlitex.Server.init/1
        Current Call: :gen_server.loop/7
        Ancestors: [Model.ChainSql.Writer, Model.Sql, Diode.Supervisor, #PID<0.343.0>]
        Message Queue Length: 0
        Links: [#PID<0.23489.0>]
        Trapping Exits: false
        Status: :waiting
        Heap Size: 2984878
        Stack Size: 12
        Reductions: 781153
        Current Stacktrace:
            (stdlib 3.17.1) gen_server.erl:443: :gen_server.loop/7
            (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

14:54:47.249 [error] Child Model.ChainSql.Writer of Supervisor Model.Sql terminated
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Chain.Block.state/1
    (Elixir.Diode 1.0.3) lib/chain/block.ex:41: Chain.Block.state(nil)
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:523: Model.ChainSql.prepare_state/1
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:254: Model.ChainSql.do_put_new_block/2
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:124: Model.ChainSql.Writer.write/1
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:98: Model.ChainSql.Writer.handle_cast/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Pid: #PID<0.23489.0>
Start Call: Model.ChainSql.Writer.start_link([])
Restart: :permanentShutdown: 5000
Type: :worker

What might be the problem?

dominicletz commented 1 year ago

@tuhalf specifically this issue was fixed in the last version:

** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Chain.Block.state/1
    (Elixir.Diode 1.0.3) lib/chain/block.ex:41: Chain.Block.state(nil)
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:523: Model.ChainSql.prepare_state/1
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:254: Model.ChainSql.do_put_new_block/2
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:124: Model.ChainSql.Writer.write/1
    (Elixir.Diode 1.0.3) lib/model/chainsql.ex:98: Model.ChainSql.Writer.handle_cast/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_li

So a new sync should work now -- that said I don't think there is really way to fix an old database that has data holes...