NixOS / NixOS/nix

free(): invalid pointer

Open
#3,973 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
17.7k
Forks
2k
Avg merge
1d 16h
Merged PRs (30d)
80

Description

Describe the bug

I'm getting a core dump when running nix-instantiate:

$ nix-instantiate foo.nix -A some.attribute
free(): invalid pointer
Aborted (core dumped)

Unfortunately I can't share the code, but it seems to be happening when running a derivation that's then imported (IFD) but I'm not sure if that actually matters. -vv doesn't show anything suspicious. nix-store --realizeing the .drv works fine so I guess the problem is not in the drv's build.

After tweaking the Nix code a bit, I get a few more errors:

$ nix-instantiate foo.nix -A some-attribute
munmap_chunk(): invalid pointer
Aborted (core dumped)

and sometimes

Segmentation fault (core dumped)

(got that one in the repl)

Happy to share as much info as I can, I'll try to boil it down to a snippet I can share.

$ nix --version
nix (Nix) 2.4pre20200721_ff314f1

I'll try to reproduce.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reducing the reported IFD case to a shareable snippet that reproduces the crash with nix-instantiate, noting whether the same .drv succeeds with nix-store --realize. Compare the invalid-pointer, segmentation-fault, and REPL cases; the work is done when the cause is identified and the reproducible invocation no longer aborts.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.