Subject: bug#21646: 25.0.50; python-nav-end-of-statement sometimes gets stuck

From: immerrr again <[email-masked]>
Date: Thu, 8 Oct 2015 15:03:14 +0300

I have recently re-populated configuring my .emacs.d removing all the
cruft that had accumulated over several years and after that reset I
started encountering weird issues with python-mode.  Sometimes (quite
rare, couple times a day, when I try to open a file the window freezes
and stops responding even to ESC ESC ESC).

When I gdb into the process, I see the code looping indefinitely in
python-nav-end-of-statement hopping around a triple-quote string on a
statement that looked like this (with "|" being point):

my_var = ""|"
   .. some
   .. string
   .. here
"""
my_other_var = """
   .. some
   .. string
   .. here
"""

Here's the full backtrace:

"python-nav-end-of-statement" (0x906566b8)
"python-info-end-of-statement-p" (0x90656830)
"python-info-end-of-block-p" (0x906569c8)
"python-nav--forward-sexp" (0x90656b88)
"python-nav-forward-sexp" (0x90656d48)
"python-nav-backward-sexp" (0x90656f00)
"python-info-docstring-p" (0x90657088)
"python-font-lock-syntactic-face-function" (0x90657200)
"font-lock-fontify-syntactically-region" (0x90657400)
"font-lock-default-fontify-region" (0x906575f0)
"font-lock-fontify-region" (0x906577e8)
0x3bb9920 PVEC_COMPILED
"run-hook-wrapped" (0x90657af0)
"jit-lock--run-functions" (0x90657cf0)
"jit-lock-fontify-now" (0x90657f08)
"jit-lock-function" (0x90658108)
"window-end" (0x90659718)
"linum-update-window" (0x90659918)
"mapc" (0x90659a60)
"linum-update" (0x90659c60)
0x3012080 PVEC_COMPILED
"walk-windows" (0x9065a030)
"linum-after-config" (0x9065a220)
"set-window-buffer" (0x9065a3e0)
"switch-to-buffer" (0x9065a5e8)
"find-file" (0x9065a770)
"find-file-at-point" (0x9065a9a8)
"helm-find-file-or-marked" (0x9065ab50)
"helm-execute-selection-action-1" (0x9065ace0)
"helm-execute-selection-action" (0x9065aec0)
"helm-internal" (0x9065b068)
"apply" (0x9065b210)
"helm" (0x9065b3b8)
"apply" (0x9065b560)
"helm" (0x9065b730)
"helm-find-files-1" (0x9065b948)
"helm-find-files" (0x9065bbc0)
"funcall-interactively" (0x9065bbb8)
"call-interactively" (0x9065be10)
"command-execute" (0x9065bfa8)

In python-nav-end-of-statement it seems to be stuck in
(python-syntax-context 'string) branch, as sometimes I would see
re-search-forward in the backtrace, too.  Unfortunately, this issue does
not manifest itself reliably and I don't have much time to spare
debugging this issue further.

Any ideas on what to do next?

In GNU Emacs 25.0.50.4 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 of 2015-10-06
Repository revision: 3248a9b6b2dff2e3c8fa41afc159efa3d594aff0
Windowing system distributor 'The X.Org Foundation', version 11.0.11103000
System Description:    Ubuntu 12.04.5 LTS

Configured using:
 'configure --prefix=/home/immerrr/.local'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  diff-auto-refine-mode: t
  jedi-mode: t
  guide-key-mode: t
  whitespace-mode: t
  flycheck-mode: t
  global-company-mode: t
  company-mode: t
  pyvenv-mode: t
  auto-compile-on-save-mode: t
  recentf-mode: t
  shell-dirtrack-mode: t
  async-bytecomp-package-mode: t
  projectile-global-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  save-place-mode: t
  show-paren-mode: t
  override-global-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:

Checker definition probably flawed.
Mark set [2 times]
Buffer apiexamples.py modified; kill anyway? (y or n) y
<C-mouse-1> is undefined
Mark set
Mark saved where search started [2 times]
Ag finished
user-error: No window up from selected window
Mark saved where search started

Load-path shadows:
/home/immerrr/.emacs.d/elpa/helm-20150921.1209/helm-multi-match hides
/home/immerrr/.emacs.d/elpa/helm-core-20150921.1209/helm-multi-match

Features:
(shadow sort mail-extr align tabify two-column iso-transl face-remap
emacsbug message rfc822 mml mml-sec mailabbrev gmm-utils mailheader
sendmail descr-text cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs ag vc-svn find-dired pulse gud vc
vc-dispatcher vc-git diff-mode ido seq misearch multi-isearch
company-elisp jka-compr eieio-opt speedbar sb-image ezimage dframe
network-stream nsm starttls warnings company-jedi jedi-core epc ctable
concurrent guide-key s ucs-normalize popwin disp-table whitespace
flycheck find-func subr-x python image-file winner traad
request-deferred request url-http tls url-auth url-gw mail-utils popup
python-environment deferred company-files company-oddmuse
company-keywords company-etags etags xref project company-gtags
company-dabbrev-code company-dabbrev company-capf company-cmake
company-xcode company-clang company-semantic company-eclim
company-template company-css company-nxml company-bbdb company pyvenv
paredit auto-compile packed tramp-cache tramp-sh recentf tree-widget
wid-edit helm-projectile helm-files rx image-dired tramp tramp-compat
tramp-loaddefs trampver shell pcomplete format-spec dired-x dired-aux
ffap helm-tags helm-bookmark helm-adaptive helm-info bookmark pp
helm-external helm-net browse-url xml url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source gnus-util password-cache url-vars mailcap
helm-buffers helm-grep helm-regexp helm-plugin helm-elscreen helm-utils
helm-locate helm-help helm-types helm-config helm-easymenu
async-bytecomp async helm-aliases helm helm-source eieio-compat eieio
eieio-core cl-macs helm-multi-match helm-lib dired projectile grep
compile comint ansi-color ibuf-ext ibuffer thingatpt yasnippet cl gv
saveplace hydra ring lv paren solarized-dark-theme solarized-theme
solarized dash byte-opt edmacro kmacro mmr-bootstrap quelpa-use-package
cl-seq quelpa package-build mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr json
lisp-mnt use-package bytecomp byte-compile cl-extra help-mode cconv
bind-key easy-mmode cl-loaddefs pcase cl-lib diminish linum-ex
bar-cursor advice mmr-minimal mmr-ediff windmove finder-inf info package
easymenu epg-config time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 527033 59339)
 (symbols 48 55696 0)
 (miscs 40 2434 1240)
 (strings 32 108846 8675)
 (string-bytes 1 3332812)
 (vectors 16 74239)
 (vector-slots 8 1837822 121059)
 (floats 8 963 1171)
 (intervals 56 10860 382)
 (buffers 976 36)
 (heap 1024 59761 5376))