emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: ParetoOptimal <pareto.optimal@mailfence.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] ob-shell async session does not work with multiple blocks running [9.7.16 (9.7.16-ba9734 @ /nix/store/6la93ywyb1h055phgyqba7h7qay60p0m-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.7.16/)]
Date: Tue, 12 Nov 2024 22:27:38 -0600	[thread overview]
Message-ID: <87zfm369mt.fsf@mailfence.com> (raw)


Problem: Running two shell source blocks with the same session doesn't
properly extract out results from the sentinel value relating to each
respective source block.

This could be a known issue which might make this an enhancement request
rather than a bug report.

Expected: Running two source blocks at once to properly deal with only
their values from the "foo-comint-indirect" buffer.

Given:

#+begin_src sh :session foo :async
sleep 5
echo "almost done"
sleep 3
echo "done"
#+end_src

#+begin_src sh :session foo :async
sleep 1
echo "almost done"
sleep 6
echo "done"
#+end_src

Then running these right after another using:

M-<			;; beginning-of-buffer
C-c C-v C-n		;; org-babel-next-src-block
C-c C-c			;; org-ctrl-c-ctrl-c
C-c C-v C-n		;; org-babel-next-src-block
C-c C-c			;; org-ctrl-c-ctrl-c

You never get the results for the last source block, but there are 3
stages:

1. After evaluating each block, but before either is done:

#+begin_src sh :session foo :async
sleep 5
echo "almost done"
sleep 3
echo "done"
#+end_src

#+RESULTS:
: 4466c6fe-e7b5-4c14-9cae-d8f066ec6ebf

#+begin_src sh :session foo :async
sleep 1
echo "almost done"
sleep 6
echo "done"
#+end_src

#+RESULTS:
: 17c8a088-82c4-4695-90f6-fe3cba9fcfd7

2. After the first is finished running (notice the clobbered results
pulled in from the other block, this is the bug)

#+begin_src sh :session foo :async
sleep 5
echo "almost done"
sleep 3
echo "done"
#+end_src

#+RESULTS:
: echo 'ob_comint_async_shell_start_17c8a088-82c4-4695-90f6-fe3cba9fcfd7'
: sleep 1
: echo "almost done"
: sleep 6
: echo "done"
: echo 'ob_comint_async_shell_end_17c8a088-82c4-4695-90f6-fe3cba9fcfd7'
: almost done
: done

#+begin_src sh :session foo :async
sleep 1
echo "almost done"
sleep 6
echo "done"
#+end_src

#+RESULTS:
: 17c8a088-82c4-4695-90f6-fe3cba9fcfd7

3. Something is done to fixup the results from the first source block,
but the second source block never gets updated with it's results

#+begin_src sh :session foo :async
sleep 5
echo "almost done"
sleep 3
echo "done"
#+end_src

#+RESULTS:
: almost done
: done

#+begin_src sh :session foo :async
sleep 1
echo "almost done"
sleep 6
echo "done"
#+end_src

#+RESULTS:
: 17c8a088-82c4-4695-90f6-fe3cba9fcfd7

Here is what the foo-comint-indirect buffer looks like:

org_babel_sh_prompt> echo 'ob_comint_async_shell_start_4466c6fe-e7b5-4c14-9cae-d8f066ec6ebf'
sleep 5
echo "almost done"
sleep 3
echo "done"
echo 'ob_comint_async_shell_end_4466c6fe-e7b5-4c14-9cae-d8f066ec6ebf'
ob_comint_async_shell_start_4466c6fe-e7b5-4c14-9cae-d8f066ec6ebf
org_babel_sh_prompt> echo 'ob_comint_async_shell_start_17c8a088-82c4-4695-90f6-fe3cba9fcfd7'
sleep 1
echo "almost done"
sleep 6
echo "done"
echo 'ob_comint_async_shell_end_17c8a088-82c4-4695-90f6-fe3cba9fcfd7'
org_babel_sh_prompt> almost done
org_babel_sh_prompt> org_babel_sh_prompt> done
org_babel_sh_prompt> ob_comint_async_shell_end_4466c6fe-e7b5-4c14-9cae-d8f066ec6ebf
org_babel_sh_prompt> ob_comint_async_shell_start_17c8a088-82c4-4695-90f6-fe3cba9fcfd7
org_babel_sh_prompt> org_babel_sh_prompt> almost done
org_babel_sh_prompt> org_babel_sh_prompt> done
org_babel_sh_prompt> ob_comint_async_shell_end_17c8a088-82c4-4695-90f6-fe3cba9fcfd7
org_babel_sh_prompt>

Thanks for the great feature. Just allowing for long running shell
blocks to not block doing things in emacs was a great addition.


Emacs  : GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.2, Xaw3d scroll bars)
Package: Org mode version 9.7.16 (9.7.16-ba9734 @ /nix/store/6la93ywyb1h055phgyqba7h7qay60p0m-emacs-packages-deps/share/emacs/site-lisp/elpa/org-9.7.16/)


                 reply	other threads:[~2024-11-13  4:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfm369mt.fsf@mailfence.com \
    --to=pareto.optimal@mailfence.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).