Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on for list comprehension at certain size #87

Open
avitkauskas opened this issue Aug 18, 2024 · 3 comments
Open

Segmentation fault on for list comprehension at certain size #87

avitkauskas opened this issue Aug 18, 2024 · 3 comments
Labels

Comments

@avitkauskas
Copy link
Contributor

commit 45d7de0 on Mac OS 14.6.1 Apple M1, memory 8G.

The following code gives segmentation fault at size 137953 and higer:

(def size 137953) 
(for [a (range size)] 1)

With 2 bindings it segfaults at size 97 and higer:

(def size 97) 
(for [a (range size) 
      b (range size)]
  1)

With 3 bindings it segfauts at size 21 and higer:

(def size 21) 
(for [a (range size) 
      b (range size)
      c (range size)]
  1)
@quoll
Copy link

quoll commented Sep 19, 2024

Also on a Mac:
MBP, MacOS 15.0, Apple M3 Max, memory 36G.
Configured/compiled with env:

CPLUS_INCLUDE_PATH=/opt/homebrew/include
LDFLAGS=/opt/homebrew/lib/libcrypto.a
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk

The first test did not fail for me until 138017. The second and third tests both segfault.

Interestingly, I had a typo while testing 138017. The following sequence at a new repl does work for me:

(def size 13801)
(def size 138017)
(for [a (range size)] 1)

@avitkauskas
Copy link
Contributor Author

avitkauskas commented Sep 20, 2024

This will be related to chunking of the sequences.
These for loops work until certain number of 32-element-size chunks and then segfaults on the next chunk boundary.

@jeaye
Copy link
Member

jeaye commented Oct 2, 2024

Thanks for taking the time to report this!

This will be related to chunking of the sequences. These for loops work until certain number of 32-element-size chunks and then segfaults on the next chunk boundary.

I think this is an accurate assessment. I have some changes I'm planning to make to jank's sequences which will alleviate most of the common crashes by simplifying the API. I'll leave this open until that is fixed.

Compared to figuring out AOT compilation, getting a REPL server going, getting release binaries for everyone, etc. this is low priority for me. However, this is something which I will fix, when it makes sense, since I recognize it's a blocker issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants