Skip to content

DAPI nil pointer dereference crash when chain RPC is unavailable #422

Closed @mfursov opened 2025-11-10 02:37 UTC 2 comments Updated 2026-02-10 03:59 UTC

Problem: DAPI crashes when chain node RPC becomes temporarily unavailable (I/O errors, restarts, network issues)

Root Cause: Missing return statement after error in tryClaimingTaskToAssign() function

** Timeline: **

00:06:26 - Chain node I/O error (trigger)
         CONSENSUS FAILURE: error writing batch to DB
         "sync /workspace/gonka-data/chain/data/blockstore.db/002855.log:
          input/output error"

         Chain RPC temporarily stops responding to connections

00:06:26 - DAPI attempts to query chain status
         ERROR: [training-task-assigner] Failed to query chain status
         err="post failed: Post \"http://localhost:26657\": EOF"

         Function logs error but CONTINUES EXECUTION (BUG!)

00:06:26 - Nil pointer dereference
         panic: runtime error: invalid memory address or nil pointer dereference
         [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3edaae2]

Fix:

func (a *Assigner) tryClaimingTaskToAssign() {
    chainStatus, err := a.tendermintClient.Status()
    if err != nil {
        slog.Error(logTag+"Failed to query chain status", "err", err)
        return  // <===============================  This is the fix =============================== 
    }


💬 Comments (2)

@AlexeySamosadov commented 2026-01-24 21:05 UTC

Fixed in PR #639 - added missing return statement after error to prevent nil pointer dereference.

@mtvnastya commented 2026-02-10 03:59 UTC

hi @mfursov, I'd like to propose a bounty for reporting this issue and proposing a fix. reached out to you via email


🔄 Auto-synced from Issue #422 every hour.