[Nix#8880] Regression: nix-shell crashes #123

Open
opened 2024-03-16 06:45:01 +00:00 by lix-bot · 5 comments
Member

Upstream-Issue: NixOS/nix#8880

Describe the bug

Starting with nix 2.16, nix-shell on macOS crashes with Bus error: 10 during the evaluation stage.
Bisecting identified this commit as the first commit where this crash happens: 94812cca98

Steps To Reproduce

  1. Example project:
    example.zip

  2. Run nix-shell without arguments

  3. See error

Expected behavior

nix-shell does not crash during the evaluation stage, downloads the dependencies and in this particular example, fails with Python-related errors.

Additional context

  • Tested on macOS 12.6.8 and 13.5.1.
  • Segmentation fault (core dumped) occurs on Linux as well

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/8880 **Describe the bug** Starting with nix 2.16, `nix-shell` on macOS crashes with `Bus error: 10` during the evaluation stage. Bisecting identified this commit as the first commit where this crash happens: 94812cca98fbb157e5f64a15a85a2b852d289feb **Steps To Reproduce** 1. Example project: [example.zip](https://github.com/NixOS/nix/files/12465612/example.zip) 2. Run `nix-shell` without arguments 3. See error **Expected behavior** `nix-shell` does not crash during the evaluation stage, downloads the dependencies and in this particular example, fails with Python-related errors. **Additional context** - Tested on macOS 12.6.8 and 13.5.1. - `Segmentation fault (core dumped)` occurs on Linux as well **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
bug
imported
labels 2024-03-16 06:45:01 +00:00
Owner
Downloads/example » nix-shell --show-trace
error: stack overflow (possible infinite recursion)
Downloads/example » nix --version         
nix (Lix, like Nix) 2.90.0-lixpre20240326-58d8445

still reproduces as a stack overflow here.

This is actually causing the daemon to dump core, very interestingly:

       Message: Process 336168 (nix-daemon) of user 0 dumped core.
                
                Module libattr.so.1 without build-id.
                Module libkeyutils.so.1 without build-id.
                Module libkrb5support.so.0 without build-id.
                Module libcom_err.so.3 without build-id.
                Module libk5crypto.so.3 without build-id.
                Module libkrb5.so.3 without build-id.
                Module libunistring.so.5 without build-id.
                Module libxml2.so.2 without build-id.
                Module libbz2.so.1 without build-id.
                Module liblzma.so.5 without build-id.
                Module libacl.so.1 without build-id.
                Module libbrotlicommon.so.1 without build-id.
                Module libaws-c-common.so.1 without build-id.
                Module libaws-checksums.so.1.0.0 without build-id.
                Module libaws-c-sdkutils.so.1.0.0 without build-id.
                Module libaws-c-cal.so.1.0.0 without build-id.
                Module libaws-c-compression.so.1.0.0 without build-id.
                Module libs2n.so.1 without build-id.
                Module libaws-c-io.so.1.0.0 without build-id.
                Module libaws-c-http.so.1.0.0 without build-id.
                Module libaws-c-auth.so.1.0.0 without build-id.
                Module libaws-c-s3.so.0unstable without build-id.
                Module libaws-c-event-stream.so.1.0.0 without build-id.
                Module libaws-c-mqtt.so.1.0.0 without build-id.
                Module libzstd.so.1 without build-id.
                Module libgssapi_krb5.so.2 without build-id.
                Module libpsl.so.5 without build-id.
                Module libssh2.so.1 without build-id.
                Module libidn2.so.0 without build-id.
                Module libnghttp2.so.14 without build-id.
                Module libz.so.1 without build-id.
                Module libcpuid.so.16 without build-id.
                Module libarchive.so.13 without build-id.
                Module libbrotlidec.so.1 without build-id.
                Module libbrotlienc.so.1 without build-id.
                Module libseccomp.so.2 without build-id.
                Module libaws-crt-cpp.so without build-id.
                Module libaws-cpp-sdk-core.so without build-id.
                Module libaws-cpp-sdk-s3.so without build-id.
                Module libaws-cpp-sdk-transfer.so without build-id.
                Module libboost_context.so.1.81.0 without build-id.
                Module libgcc_s.so.1 without build-id.
                Module libstdc++.so.6 without build-id.
                Module liblowdown.so.1 without build-id.
                Module libeditline.so.1 without build-id.
                Stack trace of thread 336168:
                #0  0x00007fe5de6a407c __pthread_kill_implementation (libc.so.6 + 0x8d07c)
                #1  0x00007fe5de654e06 raise (libc.so.6 + 0x3de06)
                #2  0x00007fe5de63d8f5 abort (libc.so.6 + 0x268f5)
                #3  0x00007fe5de8acc0b _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold (libstdc++.so.6 + 0xacc0b)
                #4  0x00007fe5de8bc21a _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xbc21a)
                #5  0x00007fe5de8bb299 __cxa_call_terminate (libstdc++.so.6 + 0xbb299)
                #6  0x00007fe5de8bb9a6 __gxx_personality_v0 (libstdc++.so.6 + 0xbb9a6)
                #7  0x00007fe5deedb9f9 _Unwind_RaiseException_Phase2 (libgcc_s.so.1 + 0x1a9f9)
                #8  0x00007fe5deedc121 _Unwind_RaiseException (libgcc_s.so.1 + 0x1b121)
                #9  0x00007fe5de8bc4ca __cxa_throw (libstdc++.so.6 + 0xbc4ca)
                #10 0x00007fe5def2cfcd _ZN3nix8FdSource14readUnbufferedEPcm.cold (libnixutil.so + 0x44fcd)
                #11 0x00007fe5def86902 _ZN3nix14BufferedSource4readEPcm (libnixutil.so + 0x9e902)
                #12 0x00007fe5def88398 _ZN3nix6SourceclEPcm (libnixutil.so + 0xa0398)
                #13 0x00007fe5decd754a _ZN3nix7readNumIjEET_RNS_6SourceE (libnixstore.so + 0xd754a)
                #14 0x00007fe5decc190f _ZN3nix12FramedSourceD2Ev (libnixstore.so + 0xc190f)
                #15 0x00007fe5dec8f05a _ZZN3nix6daemonL9performOpEPNS0_12TunnelLoggerENS_3refINS_5StoreEEENS_11TrustedFlagENS0_13RecursiveFlagEjRNS_6SourceERNS_12BufferedSinkENS_11WorkerProto2OpEENKUlvE_clEv.cold (libnixstore.so + 0x8f05a)
                #16 0x00007fe5ded37951 _ZN3nix6daemonL9performOpEPNS0_12TunnelLoggerENS_3refINS_5StoreEEENS_11TrustedFlagENS0_13RecursiveFlagEjRNS_6SourceERNS_12BufferedSinkENS_11WorkerProto2OpE.lto_priv.0 (libnixstore.so + 0x137951)
                #17 0x00007fe5ded3fb69 _ZN3nix6daemon17processConnectionENS_3refINS_5StoreEEERNS_8FdSourceERNS_6FdSinkENS_11TrustedFlagENS0_13RecursiveFlagE (libnixstore.so + 0x13fb69)
                #18 0x000055f398d4d86b _ZNSt17_Function_handlerIFvvEZL10daemonLoopSt8optionalIN3nix11TrustedFlagEEEUlvE_E9_M_invokeERKSt9_Any_data (nix + 0xfa86b)
                #19 0x00007fe5def9a26d _ZNSt17_Function_handlerIFvvEZN3nix12startProcessESt8functionIS0_ERKNS1_14ProcessOptionsEEUlvE_E9_M_invokeERKSt9_Any_data (libnixutil.so + 0xb226d)
                #20 0x00007fe5def9a127 _ZN3nix12startProcessESt8functionIFvvEERKNS_14ProcessOptionsE (libnixutil.so + 0xb2127)
                #21 0x000055f398d4e0f2 _ZL10daemonLoopSt8optionalIN3nix11TrustedFlagEE (nix + 0xfb0f2)
                #22 0x000055f398d4ee73 _ZL15main_nix_daemoniPPc (nix + 0xfbe73)
                #23 0x000055f398d8990e _ZN3nix11mainWrappedEiPPc (nix + 0x13690e)
                #24 0x00007fe5df0b6957 _ZN3nix16handleExceptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvvEE (libnixmain.so + 0x23957)
                #25 0x000055f398ce86fc main (nix + 0x956fc)
                #26 0x00007fe5de63f0ce __libc_start_call_main (libc.so.6 + 0x280ce)
                #27 0x00007fe5de63f189 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x28189)
                #28 0x000055f398cebaf5 _start (nix + 0x98af5)
                ELF object binary architecture: AMD x86-64
``` Downloads/example » nix-shell --show-trace error: stack overflow (possible infinite recursion) Downloads/example » nix --version nix (Lix, like Nix) 2.90.0-lixpre20240326-58d8445 ``` still reproduces as a stack overflow here. This is actually causing the daemon to dump core, very interestingly: ``` Message: Process 336168 (nix-daemon) of user 0 dumped core. Module libattr.so.1 without build-id. Module libkeyutils.so.1 without build-id. Module libkrb5support.so.0 without build-id. Module libcom_err.so.3 without build-id. Module libk5crypto.so.3 without build-id. Module libkrb5.so.3 without build-id. Module libunistring.so.5 without build-id. Module libxml2.so.2 without build-id. Module libbz2.so.1 without build-id. Module liblzma.so.5 without build-id. Module libacl.so.1 without build-id. Module libbrotlicommon.so.1 without build-id. Module libaws-c-common.so.1 without build-id. Module libaws-checksums.so.1.0.0 without build-id. Module libaws-c-sdkutils.so.1.0.0 without build-id. Module libaws-c-cal.so.1.0.0 without build-id. Module libaws-c-compression.so.1.0.0 without build-id. Module libs2n.so.1 without build-id. Module libaws-c-io.so.1.0.0 without build-id. Module libaws-c-http.so.1.0.0 without build-id. Module libaws-c-auth.so.1.0.0 without build-id. Module libaws-c-s3.so.0unstable without build-id. Module libaws-c-event-stream.so.1.0.0 without build-id. Module libaws-c-mqtt.so.1.0.0 without build-id. Module libzstd.so.1 without build-id. Module libgssapi_krb5.so.2 without build-id. Module libpsl.so.5 without build-id. Module libssh2.so.1 without build-id. Module libidn2.so.0 without build-id. Module libnghttp2.so.14 without build-id. Module libz.so.1 without build-id. Module libcpuid.so.16 without build-id. Module libarchive.so.13 without build-id. Module libbrotlidec.so.1 without build-id. Module libbrotlienc.so.1 without build-id. Module libseccomp.so.2 without build-id. Module libaws-crt-cpp.so without build-id. Module libaws-cpp-sdk-core.so without build-id. Module libaws-cpp-sdk-s3.so without build-id. Module libaws-cpp-sdk-transfer.so without build-id. Module libboost_context.so.1.81.0 without build-id. Module libgcc_s.so.1 without build-id. Module libstdc++.so.6 without build-id. Module liblowdown.so.1 without build-id. Module libeditline.so.1 without build-id. Stack trace of thread 336168: #0 0x00007fe5de6a407c __pthread_kill_implementation (libc.so.6 + 0x8d07c) #1 0x00007fe5de654e06 raise (libc.so.6 + 0x3de06) #2 0x00007fe5de63d8f5 abort (libc.so.6 + 0x268f5) #3 0x00007fe5de8acc0b _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold (libstdc++.so.6 + 0xacc0b) #4 0x00007fe5de8bc21a _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xbc21a) #5 0x00007fe5de8bb299 __cxa_call_terminate (libstdc++.so.6 + 0xbb299) #6 0x00007fe5de8bb9a6 __gxx_personality_v0 (libstdc++.so.6 + 0xbb9a6) #7 0x00007fe5deedb9f9 _Unwind_RaiseException_Phase2 (libgcc_s.so.1 + 0x1a9f9) #8 0x00007fe5deedc121 _Unwind_RaiseException (libgcc_s.so.1 + 0x1b121) #9 0x00007fe5de8bc4ca __cxa_throw (libstdc++.so.6 + 0xbc4ca) #10 0x00007fe5def2cfcd _ZN3nix8FdSource14readUnbufferedEPcm.cold (libnixutil.so + 0x44fcd) #11 0x00007fe5def86902 _ZN3nix14BufferedSource4readEPcm (libnixutil.so + 0x9e902) #12 0x00007fe5def88398 _ZN3nix6SourceclEPcm (libnixutil.so + 0xa0398) #13 0x00007fe5decd754a _ZN3nix7readNumIjEET_RNS_6SourceE (libnixstore.so + 0xd754a) #14 0x00007fe5decc190f _ZN3nix12FramedSourceD2Ev (libnixstore.so + 0xc190f) #15 0x00007fe5dec8f05a _ZZN3nix6daemonL9performOpEPNS0_12TunnelLoggerENS_3refINS_5StoreEEENS_11TrustedFlagENS0_13RecursiveFlagEjRNS_6SourceERNS_12BufferedSinkENS_11WorkerProto2OpEENKUlvE_clEv.cold (libnixstore.so + 0x8f05a) #16 0x00007fe5ded37951 _ZN3nix6daemonL9performOpEPNS0_12TunnelLoggerENS_3refINS_5StoreEEENS_11TrustedFlagENS0_13RecursiveFlagEjRNS_6SourceERNS_12BufferedSinkENS_11WorkerProto2OpE.lto_priv.0 (libnixstore.so + 0x137951) #17 0x00007fe5ded3fb69 _ZN3nix6daemon17processConnectionENS_3refINS_5StoreEEERNS_8FdSourceERNS_6FdSinkENS_11TrustedFlagENS0_13RecursiveFlagE (libnixstore.so + 0x13fb69) #18 0x000055f398d4d86b _ZNSt17_Function_handlerIFvvEZL10daemonLoopSt8optionalIN3nix11TrustedFlagEEEUlvE_E9_M_invokeERKSt9_Any_data (nix + 0xfa86b) #19 0x00007fe5def9a26d _ZNSt17_Function_handlerIFvvEZN3nix12startProcessESt8functionIS0_ERKNS1_14ProcessOptionsEEUlvE_E9_M_invokeERKSt9_Any_data (libnixutil.so + 0xb226d) #20 0x00007fe5def9a127 _ZN3nix12startProcessESt8functionIFvvEERKNS_14ProcessOptionsE (libnixutil.so + 0xb2127) #21 0x000055f398d4e0f2 _ZL10daemonLoopSt8optionalIN3nix11TrustedFlagEE (nix + 0xfb0f2) #22 0x000055f398d4ee73 _ZL15main_nix_daemoniPPc (nix + 0xfbe73) #23 0x000055f398d8990e _ZN3nix11mainWrappedEiPPc (nix + 0x13690e) #24 0x00007fe5df0b6957 _ZN3nix16handleExceptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvvEE (libnixmain.so + 0x23957) #25 0x000055f398ce86fc main (nix + 0x956fc) #26 0x00007fe5de63f0ce __libc_start_call_main (libc.so.6 + 0x280ce) #27 0x00007fe5de63f189 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x28189) #28 0x000055f398cebaf5 _start (nix + 0x98af5) ELF object binary architecture: AMD x86-64 ```
Owner

Simpler reproducer:

$ nix eval -f shell.nix drvPath
copying '/nix/store/bz7zbz60h868h609yzkc6jb5nj4pf9hy-source/server' to the storeerror: stack overflow (possible infinite recursion)
Simpler reproducer: ``` $ nix eval -f shell.nix drvPath copying '/nix/store/bz7zbz60h868h609yzkc6jb5nj4pf9hy-source/server' to the storeerror: stack overflow (possible infinite recursion) ```
Owner

doesn't crash under Rosetta on aarch64-darwin, though it doesn't actually enter the shell either

doesn't crash under Rosetta on aarch64-darwin, though it doesn't actually enter the shell either
Owner

n.b. the daemon crash is a red herring. we double throw if the protocol disconnects leading to core dump as above, but that is not the bug here. It's the client stack overflow that is.

n.b. the daemon crash is a red herring. we double throw if the protocol disconnects leading to core dump as above, but that is not the bug here. It's the client stack overflow that is.
Owner

Daemon no longer dumps core as of 2.92-dev! This is still a bug that there is infinite recursion, but it's a different bug.

Daemon no longer dumps core as of 2.92-dev! This is still a bug that there is infinite recursion, but it's a different bug.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#123
No description provided.