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
Invalid memory access with --release and --debug #7558
Comments
Seeing this too. Are you saying the invalid memory access is supposed to happen? |
No, it's not supposed to happen of course. But it would be strange if it doesn't happen to someone with the same version. |
Right. It's a bit annoying since I can't build anything for production that would output usable stacktraces on uncaught exceptions. Have you found any way around it? |
I'm glad that it's so easily reproducable at least. |
No I haven't found any workaround so far :/ |
Exactly my usecase too. We use sentry in production and it's pretty much useless without a readable trace. |
--debug is not needed for good traces |
@asterite care to elaborate? |
Debug line numbers are always emitted unless you pass |
Hm maybe this is unrelated but all i see is But I can confirm your statement, that it should work. I created a test project with crystal init app and then raised in a series of function calls and got a beautiful stacktrace. |
The stack is corrupted so the stack unwinding reported bogus adresses, an we can't decode it to a nice file:line backtrace. |
does the
Here's the Dockerfile: FROM jreinert/crystal-alpine AS build
WORKDIR /project
ADD . /project
RUN shards build --production --static --release
FROM scratch
COPY --from=build /project/bin/test /bin/test
CMD ["/bin/test"] and the source: def one
raise "something went wrong"
end
def two
one
end
def three
two
end
puts "Raising..."
three |
I'm getting similar results from
|
This happened multiple times already on my end, finally got a crash inside Travis CI: |
First step is to check unsafe calls. I'm seeing a bunch of unsafe calls in indivious. |
@asterite please excuse my lack of knowledge but what are unsafe calls? Are you referring to https://crystal-lang.org/reference/syntax_and_semantics/unsafe.html? |
Yes, but also searching "unsafe" in the repo I found a few to_unsafe calls. Might be the issue, might be not. |
Wasn't able to repro in ubuntu 19.10 or OS X 0.31.1 FWIW... |
|
Yup, it seems to be fixed.
I can't reproduce this either. |
Steps to reproduce:
sudo rm -rf ~/.cache/crystal/
.--release
and--debug
.Output should be:
I first encountered this without my cache cleared. It always happened when I changed my program. When I compiled with the same program again, I did not get an Invalid memory access (however doing the above always results in an Invalid memory access. My old cache was probably at a specific glitchy state at this point).
But that's not all. There's also something else to reproduce:
sudo rm -rf ~/.cache/crystal/
.--release
and--debug
.Output should be:
And now compile this program again with
--release
and--debug
and the output should be much longer: GitHubGist.After that the output no longer changes.
I'm very sure this is a bug in the cache.
The text was updated successfully, but these errors were encountered: