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

Error blknum: {"has already been taken", ... while persisting blocks to DB #1746

Open
unnawut opened this issue Sep 25, 2020 · 0 comments
Open
Labels
bug Something isn't working watcher-info

Comments

@unnawut
Copy link
Contributor

unnawut commented Sep 25, 2020

Reported by a user running their own watcher.

2020-09-24 08:47:32.768 [info] module=Phoenix.Endpoint.CowboyAdapter function=start_link/3 ⋅Running OMG.WatcherRPC.Web.Endpoint with cowboy 1.1.2 at :::7534 (http)⋅,
2020-09-24 08:47:32.768 [info] module=Phoenix.Endpoint.Supervisor function=log_access_info/2 ⋅Access OMG.WatcherRPC.Web.Endpoint at http://ee3c68eb410f⋅,
2020-09-24 08:47:32.858 [info] module=OMG.Watcher.Monitor function=handle_cast/2 ⋅Got a health checkin... clearing alarm main_supervisor_halted.⋅,
2020-09-24 08:47:32.858 [info] module=OMG.Watcher.Monitor function=handle_event/2 ⋅Elixir.OMG.Watcher.Monitor got event: {:clear_alarm, {:main_supervisor_halted, %{node: :watcher_info@ee3c68eb410f, reporter: OMG.Watcher.Monitor}}}. Ignoring.⋅,
2020-09-24 08:47:32.858 [info] module=OMG.Eth.EthereumHeightMonitor.AlarmHandler function=handle_event/2 ⋅Elixir.OMG.Eth.EthereumHeightMonitor.AlarmHandler got event: {:clear_alarm, {:main_supervisor_halted, %{node: :watcher_info@ee3c68eb410f, reporter: OMG.Watcher.Monitor}}}. Ignoring.⋅,
2020-09-24 08:47:33.766 [info] module=OMG.WatcherInfo.DB.Block function=insert_from_pending_block/1 ⋅Block #3246000 not persisted in WatcherDB, done in 2.112ms⋅,
2020-09-24 08:47:33.766 [info] module=OMG.WatcherInfo.DB.Block function=insert_from_pending_block/1 ⋅Error in transaction current_block: [blknum: {"has already been taken", [constraint: :unique, constraint_name: "blocks_pkey"]}] %{}⋅,
2020-09-24 08:47:33.767 [error] module=gen_server function=error_info/7 ⋅GenServer OMG.WatcherInfo.PendingBlockProcessor terminating,
** (MatchError) no match of right hand side value: {:error, "current_block", #Ecto.Changeset<action: :insert, changes: %{blknum: 3246000, eth_height: 10821896, hash: <<73, 6, 3, 130, 194, 21, 18, 13, 163, 243, 162, 14, 231, 155, 221, 178, 239, 107, 221, 219, 252, 202, 191, 96, 60, 40, 12, 4, 75, 110, 40, 24>>, timestamp: 1599580079}, errors: [blknum: {"has already been taken", [constraint: :unique, constraint_name: "blocks_pkey"]}], data: #OMG.WatcherInfo.DB.Block<>, valid?: false>, %{}},
    (omg_watcher_info 1.0.3) lib/omg_watcher_info/pending_block_processor.ex:49: OMG.WatcherInfo.PendingBlockProcessor.handle_continue/2,
    (stdlib 3.12) gen_server.erl:637: :gen_server.try_dispatch/4,
    (stdlib 3.12) gen_server.erl:388: :gen_server.loop/7,
    (stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3,
Last message: {:continue, :process_block}⋅,

The user also mentioned that he was reaching Infura's daily quota limit prior to this error. So it may have something to do with the Eth call failing beforehand:

One more note that I want to add about the amount of calls to Infura, it may have to do with the watcher container constantly rebooting because of the error.

@unnawut unnawut added bug Something isn't working watcher-info labels Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working watcher-info
Projects
None yet
Development

No branches or pull requests

1 participant