-
Notifications
You must be signed in to change notification settings - Fork 6
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
Emacs hangs for 10 sec on asynchronous execution #26
Comments
Thank you for trying out ob-julia-vterm and for the report.
|
Regarding your second question, I guess you are talking about how the results are collected by Emacs Org Babel. And what you see is the expected behavior. To collect outputs to the stdout, you have to specify |
Hi @shg, Thanks for your reply. Regarding your first point, the issue I'm experiencing is not with the execution but with Emacs freezing. While the code you provided is running, I am not able to move the cursor or write any text. Afterwards, it returns the same value. Emacs is waiting synchronously for 10 seconds, though the actual execution is not affected. For your second question, I am talking about the output file, not the actual result. This is the file stored in the The callback function in this repo waits until the output file is no longer empty using the function |
I would like to see exactly what you execute, including code and header, could you provide one? Thank you! |
Hi @shg, You can reproduce this with just
Emacs hangs until execution is finished or until 10 seconds have elapsed. I attached a video Screencast.from.2024-05-04.20-17-12.mp4 |
Thank you for the video. That helps. So in your environment, Emacs basically always hangs, no matter how long the block's execution time is, but up to 10 sec. Is my understanding correct? The callback function should be called when a block's execution is completed. That Can you give me information on your operating system and environment? |
I now see this is an issue on my end, I'm not using the most up-to-date version. Sorry for wasting your time. Let me know if you need any help with this project though! I use it nearly every day for work. |
Oh, that's good to hear. No worries at all. I'm glad to hear that the problem is resolved! I use vanilla Emacs, and I haven't really tested this package in other environments much. So feedback from Doom users like you is very helpful. I appreciate your issue reports and suggestions. |
So it looks like this is happening again on the most up-to-date version with the same behavior. The |
@stuartthomas25 Could you please provide more specific information about your environment, what you executed, and what you experienced? Additionally, I released the latest updates for this package and julia-vterm.el on May 14, 2024, and there have been no updates since then. Did the issue start occurring immediately after you updated to these latest versions? |
Ok, I went back to see which commit started having the problem and it seems to start at 354de54, which is the first to add the |
|
The behavior is as described before. I am on Emacs 29.4 on Fedora 40, Linux 6.9.7-200, x86_64. Looking through the code it seems clear to me that |
It does that to ensure that the results are stored in the temporary file. This check is performed after the block execution has finished. So if everything is working as intended, the A possiblity may be that the callback function is being called earlier with some unknown (maybe environment specific?) reason. I am testing it with Emacs 29.4 on my Linux machine but haven't reproduced the issue yet. Are you still using Doom? Also I appreciate it if you can provide information about any other non-standard things in your environment if any. Also it helps if you can test whether the issue occurs with a bare Emacs in your environment. |
Here's some more details: My Doom config:
and Julia Version |
So I think I got to the root cause of the issue. When ob-julia-vterm pastes the src code into the REPL, it immediately opens the out-file. On my system for some reason, this causes an inotify "MODIFY" event, which then prompts the callback. The simple fix here is to open the out-file in append mode. I just filed pull request #28 that makes this change. I'm still not sure why this issue went away but it seems very dependent on Julia's behavior, specifically its interaction with the OS. |
Thank you for the investigation and PR.I was also checking the behaviors of filenotify on the file written by Julia. Give me some time to examine the possible implications of the changes. |
When I run a block of asynchronous code, Emacs hangs for 10 seconds if the total execution takes longer than 10 seconds.
I managed to track this behavior down to the line
in the function
ob-julia-vterm-evaluation-completed-callback-func
. It looks likeob-julia-vterm
is waiting for the output file to change and has a timeout of 10 seconds. I'm not sure why this is called here. I'm also not sure why the output file only displays the final result instead of stdout sinceob-julia-vterm-make-str-to-run
seems to pipe stdout to this file.I tried commenting out this line and it seems to fix the issue, but maybe I'm missing why it's there in the first place.
The text was updated successfully, but these errors were encountered: