-
Notifications
You must be signed in to change notification settings - Fork 22
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
[crash] Invalid objects returned from my module function #2
Comments
Interesting. I'll check it out. |
Thanks ! |
Can you upload an input string that causes the crash somewhere? |
The associated Lisp code that uses the lib would also help. |
I tried this on a large JSON array (10k elements, 7MB) and got a similar crash when trying to print out the whole returned list. It looks like Emacs has problem printing it. |
Sure, I will provide a reproducible case, I should have done that first. |
I have attached a json file, and here is a lisp code that make emacs crash: (let* ((buffer (find-file-noselect "data.json"))
(json (emacs-json-parse-string
(with-current-buffer buffer (buffer-string))))
(params (gethash "params" json))
(symbols (gethash "symbols" params)))
(maphash (lambda (key val)
(equal key "test")
(equal val "test"))
symbols)) The stack trace with this code : Stack traces
There is a |
I think I know the problem. I assumed all raw This is potentially an Emacs's bug (or bad design) though. If you have access to Emacs 26, can you help me check if it also crashes there? |
FWIW, that assumption was in line with this https://phst.github.io/emacs-modules#value-lifetime. That's not an official doc though. |
This temp workaround works for me (I got a different way to reproduce the issue locally): After this line https://github.com/ubolonton/emacs-module-rs/blob/master/src/lib.rs#L168, add // Leak all values.
raw_call_no_exit!(env, make_global_ref, raw); |
I'm using emacs' master branch so it would crash there too.
I think that it's the person who wrote emacs module system, so it's a legit source.
Yes that fix it for me too :) |
Yes, that would definitely be a bug. Can you file a bug against Emacs with a minimal example? Thanks. |
That's great to hear. I'll try to make a minimal example (without json parsing). |
I'm getting closer to a minimal example https://github.com/ubolonton/emacs-module-rs/blob/crash/test-module/src/test_basics.rs#L130 It could be some weird interaction between Emacs, Rust compiler and this lib.
I'll try to reproduce this in C. |
@phst I'm not sure if it's the same thing, but I got minimal examples in https://github.com/ubolonton/emacs-module-crash. I've filed an Emacs bug report. |
Indeed, the life-time described there reflects an early design. It was changed before emacs-modules were integrated into an Emacs release. The system used instead is that |
It reflects the current and intended design. The Emacs implementation is simply buggy. |
Hi,
I'm using
emacs-module-rs
in some of my projects. I just made a small module that convert a json string to a lisp object.You can see the code here, it's very small.
When a big json object is returned, it makes emacs crash. It doesn't happen with small objects.
It seems that the lisp object is not valid:
Stack traces
Am I doing something wrong in my code ?
Is it the conversion from rust to emacs that fails somewhere ?
Or do you think it's a bug in emacs ?
Note that git-tube also makes crash my emacs when the buffer contains lots of diffs
The text was updated successfully, but these errors were encountered: