Skip to content

[ISSUE] fatal error: found pointer to free object #275

Closed as not planned
Closed as not planned

Description

@niger-prequel

Description
Our program is uploading parquet files to stages on different goroutines. Each goroutine is uploading to a different unity volume via PUT '{{.LocalFilePath}}' INTO '{{.UnityVolumePath}}' OVERWRITE; When one goroutine fails with a rate limit error, we non deterministically encounter a panic (and therefore crash of the program) from other concurrent goroutines with message fatal error: found pointer to free object. This panic was raised by the go runtime reportZombies function. Sometimes the error is also runtime: marked free object in span 0x7e6b8843ecd8, elemsize=48 freeindex=0 (bad use of unsafe.Pointer? try -d=checkptr). These errors are non deterministic as far as we can tell.

The stack trace confirms that goroutines running when the panic occurs are all Databricks PUT executions. All the other goroutines in the program are sleeping on channels and mutexes. We are also not running enough goroutines to trigger a rate limit on the bucket or Databricks. We're running on the order of 10 to 20 goroutines worth of uploads. The rate limit seems to be due to other traffic on the same bucket, unrelated to our program.

Reproduction
This is hard to outline with test code as its pretty coupled to a lot of other business logic we have and requires the underlying bucket of the unity volume to raise a rate limit.

Expected behavior
Expected behavior is that the other goroutines should succesfully upload their files regardless of the rate limit error on one of the other goroutines.

Is it a regression?
The code running on this deployment hasn't changed in a few months, including dependencies. So it is unlikely to be a regression.

Debug Logs
Here is the original error we got about the rate limit

staging operation over HTTP was unsuccessful: 503-<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ServerBusy</Code><Message>Operations per second is over the account limit.\nRequestId:[redacted]\nTime:2025-06-04T19:37:48.5111742Z</Message></Error>","time":"2025-06-04T19:37:48Z","message":"databricks: failed to execute query: query \n\tPUT '/tmp/1913351475.parquet' INTO '/Volumes/finance/[redacted]/invoice_pbrszrkigdtsnob_0_temp/1913351475.parquet' OVERWRITE

it appears to be a rate limit passed through by the underlying Azure storage account backing the unity volume.

Other Information

  • OS: Debian (Bullseye)
  • Versions:
    • go 1.23.6
    • github.com/databricks/databricks-sql-go v1.6.1
    • github.com/databricks/databricks-sdk-go v0.54.0

Activity

  1. jayantsing-db commented on Jul 1, 2025

    @jayantsing-db
    Contributor

    hello @niger-prequel, we will look into this. Could you please share any pointers to client side code on your end? For example, how are you using connections across go-routines, any available memory debugging (this seems to be related to unsafe concurrent access), running the program with race detection

  2. niger-prequel commented on Jul 7, 2025

    @niger-prequel
    Author

    @jayantsing-db this is running on an instance of our code that our customer self hosts, so we don't have full insight into the profiling data. That being said, this is using the same sql.DB connection accross multiple different goroutines, with db.SetMaxOpenConns(1) executed when the instance is first initialized.

  3. vikrantpuppala commented on Feb 22, 2026

    @vikrantpuppala
    Collaborator

    Hi @niger-prequel, thanks for reporting the issue. I've been investigating this and have some follow-up questions.

    I wrote a few concurrency tests that exercise multiple goroutines calling db.ExecContext() concurrently through sql.DB with SetMaxOpenConns(1) - matching your described setup. The Go race detector (-race) was not able to reproduce the issue.

    To help narrow down the root cause, could you share:

    1. The full goroutine stack trace from the crash. You mentioned "the stack trace confirms that goroutines running when the panic occurs are all Databricks PUT executions" — could you share the complete dump? We'd like to see exactly which functions each goroutine is in at the time of the panic.
    2. Confirmation on how sql.DB is being used. When you say "using the same sql.DB connection across multiple different goroutines" — do you mean you're sharing the *sql.DB pool (standard usage), or are you extracting individual connections via db.Conn(ctx) and sharing those?
  4. niger-prequel commented on Mar 11, 2026

    @niger-prequel
    Author

    @vikrantpuppala sorry for the delayed response.

    1. I don't have the full goroutine stack trace. we only keep those for 24 hours after they occur because they can contain sensitive data from our customers. I haven't seen that error today but if I do see another one I'll try to provide a trace
    2. we are doing *sql.DB standard usage. passing it to multiple goroutines and we set db.SetMaxOpenConns(n) to throttle concurrency.

    By the looks of this, it seems you might have identified the root cause?

  5. vikrantpuppala commented on Mar 12, 2026

    @vikrantpuppala
    Collaborator

    @niger-prequel without the goroutine stack trace, we can only make guesses on where the race condition might've happened. #325 might not necessarily fix your issue, we haven't been able to reproduce the issue with the setup you described.

  6. vuanhphung commented on Oct 29, 2026

    @vuanhphung
    Collaborator

    We tried to reproduce this on current main and on v1.6.1: 20 goroutines running concurrent PUT ... OVERWRITE staging operations through a single *sql.DB (SetMaxOpenConns of 1, 4 and 20), with the object store returning 503 ServerBusy for a share of uploads. We ran it under -race and under -gcflags=all=-d=checkptr with GOGC=1, and saw no crash or heap corruption. The default (Thrift) path uses no unsafe or cgo.

    Without a goroutine dump we can't narrow this down further, so closing as not reproducible. If it happens again, please reopen with the full stack trace from the crash.

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions