kasis22588-111
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # WIP: 0L Incident Report Dec 16-18 INCIDENT NOT FULLY RESOLVED 7pm ET Dec 18 # TL;DR 0L Network temporarily halted due to DOS seemingly caused by end-user transactions with incorrect sequence numbers. The hypothesis is that some amplification of errors caused Validator nodes to rate-limit connections to each other, and stop propagating votes. # Definitions Diem-node: the validator and fullnode software. 0L Network runs on a fork of Diem core 1.3.1. Epoch Boundary: 0L changes epochs every 24h at approx 10:30 AM ET. Carpe: a desktop miner and wallet app for 0L. It sends transactions via 4 public fullnodes designated for those users. Hot Upgrade: An upgrade procedure for 0L which issues a writeset at a coordinated time (round 2) of an epoch. ### Dec 16 An automated "Hot Upgrade" took place at 10:35 ET. There were some issues with this upgrade which affected individual validators (10/51), but the state on chain was correct and the upgrade succeeded at implementing bytcode and state migration. ### Dec 17 By morning it appeared that other nodes experienced unrelated instability, and the network had a liveness failure (f+1), making blocks slowly. Typically at any time we will see many DiemAccount::1003, sequence number errors in validator logs. However a waterfall of these logs began to appear. And then network connections began to fail between peers. Blocks stopped being produced, and the occasional log would show the same block being voted. CPUs on validator nodes were reported to being used at 100%. After a number of validators async and uncoordinatedly restarted diem-node, eventually got network moving again, with very flow blocks and eventually crossed the 24h epoch boundary. Then a number of nodes dropped off in the new epoch (now 26 validators) Initially block production was fast, but then again a waterfall of DiemAccount::1003 erorrs appeared, and the network slowly went to a halt. It required a coordinated stop by all 26 validators, plust shutting down fullnodes serving Carpe app, to regain consensus and block production. ### Dec 18 After a day of normal block production with clean logs, we conducted a test with the Fullnode devices that were serving Carpe users (which had been off since the coordinated stop). A new epoch begins with 46 validators. Attempting to open up for transactions Saturday 4:30 PM ET - Got all the network running smoothly, all validators online - Got fullnodes up to sync with network, firewall blocking 8080 connections - Open port 8080 on 1 fullnode: (ODL), no issues for 20 minutes. - Tested an account creation transaction successfully. No error logs. - Unclear if any Carpe users were connected to this node. Unlikely. - Start second fullnode (MB) and within 2 minutes the network halts - Roughly 10 different IP addresses (Carpe users) connect to this fullnode - Start seeing some error logs on Validator nodes: DiemAccount::1002 sequence number too old. 10-20 of these errors. - A minute later see a deluge of DiemAccount::1003 sequence number too new - Block production slows down. - Start seeing `Outbound connection failed for peer` - No blocks produced, just network connection attempts to all peers. - Shut down the two Fullnodes which had been online. - The network had halted at this point. - Approx 22/46 of validators were available to synchornoussly shut down. After a 5 minute shutdown, the nodes were brought back online, and block production resumed, and the 1003 errors were no longer present (the fullnodes remained off). The fullnodes serving Carpe users remain off. # Hypothesis A validator node that is not synced will start displaying 1003 errors from incoming end-user transactions. The node can get overwhelmed and CPU starts thrashing. Mempool resubmission makes this worse. Eventual the Validators deny service to other Validators, and blocks stop being produced. We think this is the case because of the "Test starting an unsynced validator" below. Besides this, there seems to be caching of user transactions that is happening external to mempool, possibly client software. Additionally if an end user is using a Json-rpc endpoint whose sync is off, they may be sending txs with invalid sequence numbers. We think this is the case because of the "Test opening 8080 of a synced Fullnoder" below. What's unclear is why any amount of tx prologue rejections would cause the Validator nodes from not being able to reach one another. There's some thermal runaway effect where errors are multiplying. Another possibility is that diem-nodes become faulty and attempt to reconnect to each other maxing-out the rate-limit which is intended to prevent DDOS, but effectively contributing to the DOS. ## Observations The 1003 appear because a tx uses a sequence number more advanced than one validator knows about, it then is getting stuck in mempool of a validator. What we also notice is that the same validator is rebroadcasting that stuck tx to other validators repeatedly, and those will see 1006 errors. ### The same TXS in mempool seem to be repeatedly attempted ![](https://i.imgur.com/yxyv454.png) ### Bandwidth Usage ![](https://i.imgur.com/y4pcXqT.png) ### Carpe fullnodes are the culprit ![](https://i.imgur.com/vpbcOZS.png) ## Test starting an unsynced validator Users are sending transactions to network, and there are many validators already in sync and processing transasasa 0. Start syncing in validator mode 1. Start seeing prologue errors 2. Hangs with CPU at 100% 3. More prologue errors 4. Hangs on kill ## Test opening 8080 of a synced Fullnode Users are sending transactions to network, and there are many validators already in sync and processing transactions. 0. Fullnode is synced, but JSON_RPC on 8080 is closed 1. Open port 8080 2. Validator node (that are in sync) begin to see 1003 errors 3. block production slows 4. Cascade of prologue errors 5. Hangs with CPU at 100% ## Contributing factors - State sync is slow. Fullnodes seem to fall out of sync and have a difficult time catching up - Validators which need to recover have a long time syncing, can't advance to the current network state, and must use a snapshot restore point. - Validators on 0L are running as public fullnodes (without the VFN intermediary layer). This is possibly causing self-dial and thermal runaway. # Error code Reference ## DiemAccount::1002 PROLOGUE_ESEQUENCE_NUMBER_TOO_OLD The user account's transaction sequence number submitted is too OLD (low number) compared to what is on the chain for that user. Move: https://github.com/0o-de-lally/libra/blob/d3c474a8752cb869a57fb7c7f98422d290a3a56c/language/diem-framework/modules/DiemAccount.move#L2679-L2682 Rust: https://github.com/OLSF/libra/blob/9b9e5eb0ef1f57ce8470995c037ab4574a909dfb/language/diem-vm/src/errors.rs#L68 ## DiemAccount::1003 PROLOGUE_ESEQUENCE_NUMBER_TOO_NEW The user account's transaction sequence number submitted is too NEW (high number) compared to what is on the chain for that user. Move: https://github.com/0o-de-lally/libra/blob/d3c474a8752cb869a57fb7c7f98422d290a3a56c/language/diem-framework/modules/DiemAccount.move#L2790-L2799 Rust: https://github.com/OLSF/libra/blob/9b9e5eb0ef1f57ce8470995c037ab4574a909dfb/language/diem-vm/src/errors.rs#L17 ## DiemAccount::1006 PROLOGUE_ETRANSACTION_EXPIRED transaction expiration time exceeds block time. Move: https://github.com/OLSF/libra/blob/d3c474a8752cb869a57fb7c7f98422d290a3a56c/language/diem-framework/modules/DiemAccount.move#L217 Rust: https://github.com/OLSF/libra/blob/9b9e5eb0ef1f57ce8470995c037ab4574a909dfb/language/diem-vm/src/errors.rs#L20 # Post Mortem The network could get into a split-brain mode easily because of certain validator.node.yaml configurations, that state was near impossible to recover from giving compounding effects of sync delays, and incorrect networking parameters. ## Root Causes A combination of factors contributed to the outage, including runaway CPU usage and networking failures: 1. State sync is slow in Diem, with no mechanism to skip to an advanced waypoint. A validator can spend all day behind sync. The further back a validator node gets the more susceptible it is to synchronization bugs, as seen below. 1. The Diem mempool management for all node types does not wait for the node to be in sync. So mempool related work continues to occur while the node is behind sso making it harder to catch up. Admitting txs to the mempool is expensive work, especially if it includes Tower proof verification. 1. 0L's network topology contributed to the errors since serving on the fullnodes and validator networks on the same instance can create a panoply of issues in failing networks. See writeup below. 1. Parameters: The mempool was accepting up to 100 transactions per user concurrently, there's no reasonable use case for that with 0L. Possibly backlogged Miner tranasactions were staying in mempool for extended periods. 1. Parameters: Max failed ping requests was set very low. When nodes became overwhelmed they would quickly shut down new connections from a requesting node. This meant that fewer nodes could connect to each other, and pockets of nodes (split brains) would be proposing different blocks. 1. Parameters: Max out-going connections. If nodes were failing due to CPU runaway and ping failure requests, they needed to connect to other nodes, however one setting was limiting each node from initiating more than 10 oubound connections. In a split brain case this exacerbates the inability to recover. 1. Sending expensive transactions to the network (verify VDF is extremely expensive at 150ms per verification) while in this situation may lead to the Validator processing that transaction in the a) json rpc admission control (if the port was open), b) mempool sync as a fullnode c) validator node voting/proposing the block. 1. When the network is in split brain mode, it will ordinarily consume more resources to compare forks. To do this while the above failures are happening will cause the CPU to reach maximum usage, which make networking and other tasks impossible. ## Network Topology Effects Having the network topology diverge from Diem's design worked for happy cases, but made recovery in slow and stalled networks worse or impossible without a coordinated restart. Like many BFT networks there is an intermediary proxy node that isolates the Validator from transactions. In diem this is the VFN (Validator Fullnode). 0L experimenting with removing this requirement from validators but it causes a number of issues. ![](https://i.imgur.com/BRWIOpE.png) 0L configs instead had the validator share duties, connecting to the Validator network and to the Public Fullnode network simultaneously. This was to simplify the architecture and cost, to make 0L more accessible to non-professional validators. By design the Validator should only connect to a Private fullnode, which in turn is connected to the public fullnodes. Here's the list of things we think goes wrong with this one instance of `diem-node` serving on public fullnode network, and validator network: 1. By design the Validator node does not trust information from the Public fullnode network. Even if they are running the same instance, the validator's DB is only incremented with transactions from other validators. The fullnode functions however will be using the same database (without incrementing). There could be resource contention issues related to this. 1. If the validator falls out of sync, fullnode network will be further ahead. But the validator cannot benefit from that new data. So the node may be seeing transactions in the future from mempool synchronization, but can't make blocks from it. So the `diem-node` is working on two forks at the same time. 1. These issues compound when the network has split brain, and leaders are failing and there are competing proposals. The validator network and fullnodes may be syncing and verifying different trees. ## Mempool and Sync issues There are three variants of state: 1. validator-produced block state (true state) -- this is consistent. All validators see the same state. 2. FN chain state. This is possibly consistent with true state, but likely older. It's never some random state, always represents some older version of true state, depending on how far behind the node is. 3. proposed txn state. This is like a ort cloud of state that originates with clients but is propagated around by FNs. txns get into the ort cloud if and only if they pass through a FN that believes (at the time) that the txn is valid. That validation is performed in the context of that node's current chain state. Now, set up like this, we have a machine prone to thermal runaway whenever FNs fall significantly behind true state. Because the FNs will allow though more and more invalid txn the further behind they get. Having a dedicated private fullnode for a validator improves this situation because it ensures that no txn can reach a validator without passing through an up-to-date FN. For this situation it's not the existence of the peer FN per se that fixes the problem, but rather that the FN is properly managed and hence synced up. That's not to minimize the otheer issues that occur when a `diem-node` instance is serving on both public and validator node There's a secondary mechanism necessary fro the meltdown : the more the FNs get behind the more bogus txn they allow through, which in turn burns more CPU in the validators, and eventually the weak validators drop out of quorum. (Also exacerbated if the nodes cannot reconnect to each other).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully