Skip to content

fix(walletshield): linux-arm64: panic: doc is nil #74

Open

Description

@xendarboh

platform: linux-arm64
version: v0.4.2 (kp v0.0.43)

12:20:47.584 INFO katzenpost/client2: SendCiphertext error: write tcp 192.168.X.XX:35830->54.XX.XX.XX:8080: write: connection timed out
12:20:47.584 INFO client2/conn: onConnStatusChange
12:20:47.584 INFO client2/pki: Failed to fetch PKI doc for epoch 196006 from Provider: client/conn: not connected to the Gateway
12:20:47.584 INFO client2/pki: Failed to fetch PKI doc for epoch 196006 from Provider: client/conn: not connected to the Gateway
12:20:47.584 WARN client2/pki: Failed to fetch PKI for epoch 196006: client/conn: not connected to the Gateway
12:20:47.584 WARN client2/pki: Failed to fetch PKI for epoch 196006: client/conn: not connected to the Gateway
12:20:47.584 ERRO katzenpost/client2: WaitForCurrentDocument failed on updateDocument with err: client/conn: not connected to the Gateway
12:20:47.584 INFO client2/pki: Failed to fetch PKI doc for epoch 196006 from Provider: client/conn: not connected to the Gateway
12:20:47.584 WARN client2/pki: Failed to fetch PKI for epoch 196006: client/conn: not connected to the Gateway
12:20:47.584 ERRO katzenpost/client2: WaitForCurrentDocument failed on updateDocument with err: client/conn: not connected to the Gateway
12:20:47.584 WARN client2/pki: Failed to fetch PKI for epoch 196006: client/conn: not connected to the Gateway
panic: doc is nil

goroutine 32 [running]:
github.com/katzenpost/katzenpost/client2.(*Daemon).sendLoopDecoy(0x40001b6dd0, 0x4000083140)
        github.com/katzenpost/katzenpost@v0.0.43/client2/daemon.go:449 +0x498
github.com/katzenpost/katzenpost/client2.(*Daemon).egressWorker(0x40001b6dd0)
        github.com/katzenpost/katzenpost@v0.0.43/client2/daemon.go:230 +0x108
github.com/katzenpost/katzenpost/core/worker.(*Worker).Go.func1()
        github.com/katzenpost/katzenpost@v0.0.43/core/worker/worker.go:39 +0x58
created by github.com/katzenpost/katzenpost/core/worker.(*Worker).Go in goroutine 1
        github.com/katzenpost/katzenpost@v0.0.43/core/worker/worker.go:37 +0xac
  • the top log line there is connection to a gateway
  • walletshield dies with panic: doc is nil message on all ARM boards (SBC) tested, usually after 24 to 36 hours. Has not happened on ARM server or desktop yet, but looking out for that

Activity

  1. changed the title [-]fix(walletshield): panic: doc is nil[/-] [+]fix(walletshield): linux-arm64: panic: doc is nil[/+] on Nov 26, 2024
  2. xendarboh commented on Nov 26, 2024

    @xendarboh
    CollaboratorAuthor

    Possibly useful for local testing. issue not yet confirmed with this method:
    https://github.com/0KnowledgeNetwork/opt/tree/main/docker/qemu-runner

  3. infinitydaemon commented on Nov 27, 2024

    @infinitydaemon

    The error panic: doc is nil usually indicates that the code is trying to access or manipulate a document object that hasn’t been properly initialized or is explicitly set to nil. This is common in Go programs when working with structs, pointers, or database queries.

    Here’s how we can troubleshoot this issue on ARM64:

    1. Check the Document Initialization
      Ensure that the document (doc) you’re working with is initialized before accessing its fields or methods.
      Example issue:

    var doc *Document
    fmt.Println(doc.Title) // Panic: doc is nil
    Fix:
    doc := &Document{}
    fmt.Println(doc.Title)

    1. Inspect the Source of doc
      If doc is being retrieved from a database or an external function, check the return value.

    For example:
    doc, err := db.GetDocument(id)
    if err != nil {
    log.Fatal(err)
    }
    if doc == nil {
    panic("doc is nil")
    }
    Ensure the document is not nil before using it.

    The main issue is the stock shipped kernels 5.x and 6.x. ARM64 can sometimes have different behavior due to variations in hardware or software libraries. The libraries or frameworks you’re using are compatible with ARM64. The document-related operation (e.g., parsing or unmarshaling) works consistently on ARM64 and other architectures.

    If we look closely at The Crawling Serpent, it's built to handle memory fetch issues and perform error corrections. This is why walletshield for ARM64 running dg0 patch is stable. On a Linux ws-test1 6.6.61-current-rockchip64 #1 SMP PREEMPT Thu Nov 14 12:19:41 UTC 2024 aarch64 GNU/Linux the issue remains for exact same reason. The best solution would be to port TCS across generic boards Or alter the way document fetch mechanism works incase of an invalid or un-initialized to an object from document fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions