emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-ref / Edit notes problem
@ 2021-03-19 13:58 Christian Barthel
  2021-03-19 21:11 ` Christian Barthel
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Barthel @ 2021-03-19 13:58 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am using Emacs 27.1 on OpenBSD 6.8 and org-ref
(20210315.1730).  When I am trying to Edit notes on an existing
org-ref entry ([f9] Edit Notes), emacs stops working and hangs. 

By some observation, I saw that emacs is consuming a lot of
memory and the garbage collector seems to run quite frequently
(see the trace above).  This happens after pressing [f9].

Output top(1)
--8<---------------cut here---------------start------------->8---
$ top
  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
45199 bch       43   -5  273M  307M onproc/1  -         0:13 36.33% emacs-27.1

...

PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
45199 bch       47   -5  409M  444M onproc/1  -         0:25 49.27% emacs-27.1
--8<---------------cut here---------------end--------------->8---

The profile-report was generated by pressing [f9] and pressing
C-g a few seconds afterwards.   (emacs will become unresponsive
when waiting longer)

Profile:
--8<---------------cut here---------------start------------->8---
- command-execute                                                  52  51%
 - call-interactively                                              52  51%
  - funcall-interactively                                          52  51%
   - org-ref-helm-insert-cite-link                                 51  50%
    - helm-bibtex                                                  48  47%
     - bibtex-completion-candidates                                30  29%
      - bibtex-completion-parse-bibliography                       18  17%
       - parsebib-read-entry                                       11  10%
        - parsebib--find-bibtex-field                               9   8%
         - parsebib--parse-value                                    9   8%
          - parsebib--expand-strings                                7   6%
           - mapcar                                                 7   6%
            - #<compiled 0xe4803b2339>                              7   6%
               replace-regexp-in-string                             6   5%
          parsebib--looking-at-goto-end                             1   0%
        - parsebib--match-paren-forward                             1   0%
         - parsebib--match-brace-forward                            1   0%
            forward-sexp                                            1   0%
       - bibtex-completion-prepare-entry                            7   6%
        - mapcar                                                    3   2%
         - #<compiled 0xe48c386fc9>                                 3   2%
          - bibtex-completion-find-note-multiple-files              2   1%
             f-directory?                                           2   1%
          - bibtex-completion-find-note-one-file                    1   0%
             f-file?                                                1   0%
        - bibtex-completion-find-pdf                                2   1%
         - bibtex-completion-find-pdf-in-library                    2   1%
          - -first                                                  1   0%
             f-file?                                                1   0%
          - f-join                                                  1   0%
           - -map                                                   1   0%
            - mapcar                                                1   0%
             - #<compiled 0xe49feddbc5>                             1   0%
                f-expand                                            1   0%
          member-ignore-case                                        1   0%
        - bibtex-completion-remove-duplicated-fields                1   0%
         - cl-remove-duplicates                                     1   0%
          - cl--delete-duplicates                                   1   0%
             cl--position                                           1   0%
      - secure-hash                                                 8   7%
       - select-safe-coding-system                                  8   7%
          find-coding-systems-region                                8   7%
      - message                                                     1   0%
       - redisplay_internal (C function)                            1   0%
        - funcall                                                   1   0%
         - #<compiled 0xe4acccdd6f>                                 1   0%
          - gui-backend-selection-exists-p                          1   0%
           - apply                                                  1   0%
              #<compiled 0xe4acc95353>                              1   0%
      - bibtex-completion-resolve-crossrefs                         1   0%
       - bibtex-completion-make-entry-hash                          1   0%
        - bibtex-completion-get-value                               1   0%
           replace-regexp-in-string                                 1   0%
     - helm                                                        18  17%
      - apply                                                      18  17%
       - helm                                                      18  17%
        - apply                                                    18  17%
         - helm-internal                                           18  17%
          - helm-read-from-minibuffer                              17  16%
           - helm-update                                           12  11%
            - helm--collect-matches                                12  11%
             - helm-compute-matches                                 8   7%
              - helm-process-filtered-candidate-transformer         8   7%
               - helm-apply-functions-from-source                   8   7%
                - apply                                             8   7%
                 - helm-bibtex-candidates-formatter                 8   7%
                  - bibtex-completion-format-entry                  8   7%
                   - s-format                                       8   7%
                    - replace-regexp-in-string                      7   6%
                     - #<compiled 0xe4976d474d>                     5   4%
                      - #<compiled 0xe48c3873e9>                    5   4%
                       - bibtex-completion-shorten-authors          2   1%
                        - s-split                                   2   1%
                           split-string                             2   1%
                       - bibtex-completion-clean-string             1   0%
                          replace-regexp-in-string                  1   0%
             - require                                              2   1%
              - byte-code                                           2   1%
               - require                                            1   0%
                - byte-code                                         1   0%
                 - require                                          1   0%
                    byte-code                                       1   0%
             read-from-minibuffer                                   3   2%
          - helm-execute-selection-action                           1   0%
           - helm-execute-selection-action-1                        1   0%
            - helm-bibtex-edit-notes                                1   0%
             - bibtex-completion-edit-notes                         1   0%
              - bibtex-completion-edit-notes-default                1   0%
               - bibtex-completion-get-entry                        1   0%
                  bibtex-completion-get-entry1                      1   0%
    - org-ref-find-bibliography                                     3   2%
     - reftex-locate-bibliography-files                             3   2%
        reftex-using-biblatex-p                                     1   0%
   - execute-extended-command                                       1   0%
    - sit-for                                                       1   0%
       redisplay                                                    1   0%
- ...                                                              49  48%
   Automatic GC                                                    44  43%
 - after-find-file                                                  4   3%
  - run-hooks                                                       4   3%
   - vc-refresh-state                                               4   3%
    - vc-backend                                                    4   3%
     - vc-registered                                                4   3%
      - mapc                                                        4   3%
       - #<compiled 0xe48ec19ff1>                                   4   3%
        - vc-call-backend                                           4   3%
         - apply                                                    4   3%
          - vc-git-registered                                       4   3%
           - vc-git--out-ok                                         4   3%
            - apply                                                 4   3%
             - vc-git--call                                         4   3%
              - apply                                               4   3%
               - process-file                                       4   3%
                  apply                                             4   3%
 - minibuffer-complete                                              1   0%
  - completion-in-region                                            1   0%
   - completion--in-region                                          1   0%
    - #<compiled 0xe49fad1be5>                                      1   0%
     - apply                                                        1   0%
      - #<compiled 0xe4acc98035>                                    1   0%
       - completion--in-region-1                                    1   0%
        - completion--do-completion                                 1   0%
         - completion-try-completion                                1   0%
          - completion--nth-completion                              1   0%
           - completion--some                                       1   0%
            - #<compiled 0xe4a8d497dd>                              1   0%
             - completion-basic-try-completion                      1   0%
              - try-completion                                      1   0%
               - #<compiled 0xe4accb70af>                           1   0%
                  complete-with-action                              1   0%
--8<---------------cut here---------------end--------------->8---

I tried to reduce my init.el as much as possible: I started with
-Q and executed this and were able to reproduce it with this:

--8<---------------cut here---------------start------------->8---
(require 'package)
(package-initialize)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(when (not (package-installed-p 'use-package))
  (package-refresh-contents)
  (package-install 'use-package))

(require 'org)
(setq org-agenda-files
   orgfile list... )


(require 'org-ref)
(setq reftex-default-bibliography
      '("bib"))
(setq
 bibtex-completion-bibliography
 "bib"
 bibtex-completion-library-path
 "literature"
 bibtex-completion-notes-path
 "notes"
 )
(setq
 org-ref-bibliography-notes "notes.org"
 org-ref-default-bibliography
 '("bib")
 org-ref-pdf-directory
 "bib")
--8<---------------cut here---------------end--------------->8---
   
Other observation: when I am starting emacs with "-nw" (no GUI),
"Edit Notes" seems to work as expected and opens a new file as
expected. 

I have re-installed all packages with MELPA.

Has anyone seen a similar problem?

How can I further debug and analyze this to present a better
error report?

Thanks a lot,
  Christian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-ref / Edit notes problem
  2021-03-19 13:58 org-ref / Edit notes problem Christian Barthel
@ 2021-03-19 21:11 ` Christian Barthel
  2021-03-20 12:51   ` yank freeze (org-ref / Edit notes problem) Maxim Nikulin
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Barthel @ 2021-03-19 21:11 UTC (permalink / raw)
  To: emacs-orgmode

Christian Barthel writes:

> I am using Emacs 27.1 on OpenBSD 6.8 and org-ref
> (20210315.1730).  When I am trying to Edit notes on an existing
> org-ref entry ([f9] Edit Notes), emacs stops working and hangs. 
>
> By some observation, I saw that emacs is consuming a lot of
[..]
> Other observation: when I am starting emacs with "-nw" (no GUI),
> "Edit Notes" seems to work as expected and opens a new file as
> expected. 

OK, I guess I found a solution:  I have had a similar issue with
org-capture were emacs freezed as well.  However, org-capture did
work in xterm and I thought about some weird usage of the X11
clipboard manager.  After doing some more research, I found [1].
According to Daimrod's Blog, the workaround is:

  (setq x-selection-timeout 10)

This seems to work for org-ref as well as org-capture.

[1] https://www.omecha.info/blog/org-capture-freezes-emacs.html
-- 
Christian Barthel <bch@online.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: yank freeze (org-ref / Edit notes problem)
  2021-03-19 21:11 ` Christian Barthel
@ 2021-03-20 12:51   ` Maxim Nikulin
  0 siblings, 0 replies; 3+ messages in thread
From: Maxim Nikulin @ 2021-03-20 12:51 UTC (permalink / raw)
  To: emacs-orgmode

On 20/03/2021 04:11, Christian Barthel wrote:
> 
> OK, I guess I found a solution:  I have had a similar issue with
> org-capture were emacs freezed as well.  However, org-capture did
> work in xterm and I thought about some weird usage of the X11
> clipboard manager.  After doing some more research, I found [1].
> According to Daimrod's Blog, the workaround is:
> 
>    (setq x-selection-timeout 10)

Accordingly to emacs bug tracker your problem was fixed 5 years ago:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16737
Yank causes hang

I saw hangs trying to paste from X clipboard but I decided that 
conditions were quite exotic. I experimented with running browser as 
untrusted X client. Firefox was unhappy, emacs (running as usual) 
started to eat CPU on attempt to yank text copied from browser. Since I 
was unsure what selection operations are not allowed to untrusted X 
clients, I decided to just give up. However I believe that emacs could 
behave better in such cases.

If you have steps to reproduce, you could file a new bug.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-20 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 13:58 org-ref / Edit notes problem Christian Barthel
2021-03-19 21:11 ` Christian Barthel
2021-03-20 12:51   ` yank freeze (org-ref / Edit notes problem) Maxim Nikulin

Code repositories for project(s) associated with this 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).