elpy
                                
                                 elpy copied to clipboard
                                
                                    elpy copied to clipboard
                            
                            
                            
                        Emacs hangs after a while
Hi there, i´m new to elpy and my emacs hangs after a while.
beginning to type "import argp" works with a tooltip and completion and then no more ...
after writing some lines more emacs hangs completly
strace the emacs process:
[pid 27335] recvmsg(8, 0x7ffd1bfa2490, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 27335] poll([{fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=5, events=POLLIN}], 4, 0) = 0 (Timeout)
[pid 27335] write(15, "{\"id\":36,\"method\":\"get_calltip\","..., 1683) = -1 EAGAIN (Resource temporarily unavailable)
[pid 27335] pselect6(17, [5 7 8 11 13 16], [], NULL, {0, 19999226}, {NULL, 8}) = 0 (Timeout)
[pid 27335] recvmsg(8, 0x7ffd1bfa2490, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 27335] poll([{fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=5, events=POLLIN}], 4, 0) = 0 (Timeout)
[pid 27335] write(15, "{\"id\":36,\"method\":\"get_calltip\","..., 1683) = -1 EAGAIN (Resource temporarily unavailable)
[pid 27335] pselect6(17, [5 7 8 11 13 16], [], NULL, {0, 19999313}, {NULL, 8}) = 1 (in [8], left {0, 1735472})
[pid 27335] --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
[pid 27335] rt_sigreturn()              = 1
[pid 27335] recvmsg(8, {msg_name(0)=NULL, msg_iov(1)=[{"U\2\31\210\3277\313\7\3\4\4\0\0\0\0\0\0\0\0\4\4\4\4\4\0\0\3\37%\2\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
[pid 27335] recvmsg(8, 0x7ffd1bfa2490, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 27335] poll([{fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=5, events=POLLIN}], 4, 0) = 0 (Timeout)
[pid 27335] recvmsg(8, 0x7ffd1bfa2490, 0) = -1 EAGAIN (Resource temporarily unavailable)
with C+ggg emacs comes back and hangs again C+gggg M+x elpy-rpc-restart and i can write some lines
First i thought with the oh-my-emacs config collection is sometthig wrong, but some behavior with a plain setup
My versions:
Elpy Configuration
Virtualenv........: None
RPC Python........: 2.7.9 (/usr/bin/python)
Interactive Python: ipython (/usr/bin/ipython)
Emacs.............: 24.4.1
Elpy..............: 1.10.0
Jedi..............: 0.9.0
Rope..............: 0.10.3
Importmagic.......: 0.1.3
Autopep8..........: 0.1.3
Syntax checker....: flake8 (/usr/local/bin/flake8)
i checked the related issues but with no success ...
any ideas?
Cheers
Dominik
I found it.
with:
/usr/local/bin/flake8 --version
2.5.0 (pep8: 1.5.7, pyflakes: 1.0.0, mccabe: 0.3.1) CPython 2.7.9 on Linux
installed elpy stops working
uninstall flake8 and all problems gone .. but flake should be nice ....
forget it, it wasn´t flake8, on my other maschine the syntaxchecker was the case, but not here :(
Thanks for the report! This sounds very weird – can you do M-x toggle-debug-on-quit and use C-g again to get out of the locking? This should produce a backtrace, could you post that here? Thank you!
Here is the debug output
Debugger entered--Lisp error: (quit)
  process-send-string(#<process  *elpy-rpc [project:~/git/apwlinux/aclient/ python:/usr/bin/python]*> "{\"id\":49,\"method\":\"get_calltip\",\"params\":[\"\\/home\\/dominik\\/git\\/apwlinux\\/aclient\\/apwinisync.py\",\"#!\\/usr\\/bin\\/env python\\n\\n# APWLinux ini abgleich fuer [lin]und [for]\\n\\nimport ConfigParser\\nimport argparse\\nimport sys\\nimport dbfread\\n\\nparser = argparse.ArgumentParser(prog=\\\"apwinisync\\\")\\nparser.add_argument(\\\"--aclprefix\\\", help=\\\"APW aclient Benutzerprefix: aclient\\\",\\n                    default=\\\"aclient\\\")\\nparser.add_argument(\\\"--aclnr\\\", help=\\\"Anzahl der APW aclients\\\", default=11)\\nparser.add_argument(\\\"--aclexclude\\\", help=\\\"Excludierte Benutzer\\\")\\nparser.add_argument(\\\"--apwpath\\\", help=\\\"Pfad zur apwinstallation\\\", default=\\\"\\/home\\/praxis\\/a\\/\\\")\\n\\nargs = parser.parse_args()\\n\\naclprefix = args.aclprefix\\naclnr = args.aclnr\\n\\naclients = [aclprefix+str(a).rjust(2, \\\"0\\\") for a in range(1, int(aclnr))]\\n\\nif args.aclexclude:\\n    aclexclude = [aclprefix+str(a).rjust(2, \\\"0\\\") for a in args.aclexclude.split(\\\",\\\")]\\n    for a in aclexclude:\\n        aclients.remove(a)\\n\\n\\nsrcini = ConfigParser.SafeConfigParser()\\ndstini = ConfigParser.SafeConfigParser()\\n\\nsrcini.read(\\\"apw.ini\\\")\\ndstini.read(\\\"apw.ini.new\\\")\\nif not dstini.has_section(\\\"for\\\"):\\n    dstini.add_section(\\\"for\\\")\\n\\nif not dstini.has_section(\\\"lin\\\"):\\n    dstini.add_section(\\\"lin\\\")\\n\\nfor srcfor in srcini.items(\\\"for\\\"):\\n    cfor = str(srcfor[0])\\n    cprt = str(srcfor[1])\\n    dstini.set(\\\"for\\\", cfor, cprt)\\n\\nfor srcfor in srcini.items(\\\"lin\\\"):\\n    clin = str(srcfor[0])\\n    cprt = str(srcfor[1])\\n    dstini.set(\\\"lin\\\", clin, cprt)\\n\\nprint(\\\"Section [for]\\\")\\nfor a in dstini.items(\\\"for\\\"):\\n    print(a)\\n\\nprint(\\\"Section [lin]\\\")\\nfor a in dstini.items(\\\"lin\\\"):\\n    print(a)\\n\\nwith open(\\\"apw.ini.new\\\", \\\"a\\\") as apw:\\n    dstini.write(apw)\\n\\nfrom datetime import time\\n\\ntime.sleept\",1585]}\n")
  elpy-rpc--call("get_calltip" ("/home/dominik/git/apwlinux/aclient/apwinisync.py" #("#!/usr/bin/env python\n\n# APWLinux ini abgleich fuer [lin]und [for]\n\nimport ConfigParser\nimport argparse\nimport sys\nimport dbfread\n\nparser = argparse.ArgumentParser(prog=\"apwinisync\")\nparser.add_argument(\"--aclprefix\", help=\"APW aclient Benutzerprefix: aclient\",\n                    default=\"aclient\")\nparser.add_argument(\"--aclnr\", help=\"Anzahl der APW aclients\", default=11)\nparser.add_argument(\"--aclexclude\", help=\"Excludierte Benutzer\")\nparser.add_argument(\"--apwpath\", help=\"Pfad zur apwinstallation\", default=\"/home/praxis/a/\")\n\nargs = parser.parse_args()\n\naclprefix = args.aclprefix\naclnr = args.aclnr\n\naclients = [aclprefix+str(a).rjust(2, \"0\") for a in range(1, int(aclnr))]\n\nif args.aclexclude:\n    aclexclude = [aclprefix+str(a).rjust(2, \"0\") for a in args.aclexclude.split(\",\")]\n    for a in aclexclude:\n        aclients.remove(a)\n\n\nsrcini = ConfigParser.SafeConfigParser()\ndstini = ConfigParser.SafeConfigParser()\n\nsrcini.read(\"apw.ini\")\ndstini.read(\"apw.ini.new\")\nif not dstini.has_section(\"for\"):\n    dstini.add_section(\"for\")\n\nif not dstini.has_section(\"lin\"):\n    dstini.add_section(\"lin\")\n\nfor srcfor in srcini.items(\"for\"):\n    cfor = str(srcfor[0])\n    cprt = str(srcfor[1])\n    dstini.set(\"for\", cfor, cprt)\n\nfor srcfor in srcini.items(\"lin\"):\n    clin = str(srcfor[0])\n    cprt = str(srcfor[1])\n    dstini.set(\"lin\", clin, cprt)\n\nprint(\"Section [for]\")\nfor a in dstini.items(\"for\"):\n    print(a)\n\nprint(\"Section [lin]\")\nfor a in dstini.items(\"lin\"):\n    print(a)\n\nwith open(\"apw.ini.new\", \"a\") as apw:\n    dstini.write(apw)\n\nfrom datetime import time\n\ntime.sleept" 0 1 (fontified t face font-lock-comment-delimiter-face) 1 22 (fontified t face font-lock-comment-face) 22 23 (fontified t) 23 25 (fontified t face font-lock-comment-delimiter-face) 25 67 (fontified t face font-lock-comment-face) 67 68 (fontified t) 68 74 (fontified t face font-lock-keyword-face) 74 88 (fontified t) 88 94 (fontified t face font-lock-keyword-face) 94 104 (fontified t) 104 110 (fontified t face font-lock-keyword-face) 110 115 (fontified t) 115 121 (fontified t face font-lock-keyword-face) 121 131 (fontified t) 131 137 (fontified t face font-lock-variable-name-face) 137 169 (fontified t) 169 170 (syntax-table (15) fontified t face font-lock-string-face) 170 180 (fontified t face font-lock-string-face) 180 181 (syntax-table (15) fontified t face font-lock-string-face) 181 203 (fontified t) 203 204 (syntax-table (15) fontified t face font-lock-string-face) 204 215 (fontified t face font-lock-string-face) 215 216 (syntax-table (15) fontified t face font-lock-string-face) 216 218 (fontified t) 218 222 (fontified t face font-lock-builtin-face) 222 223 (fontified t) 223 224 (syntax-table (15) fontified t face font-lock-string-face) 224 259 (fontified t face font-lock-string-face) 259 260 (syntax-table (15) fontified t face font-lock-string-face) 260 290 (fontified t) 290 291 (syntax-table (15) fontified t face font-lock-string-face) 291 298 (fontified t face font-lock-string-face) 298 299 (syntax-table (15) fontified t face font-lock-string-face) 299 321 (fontified t) 321 322 (syntax-table (15) fontified t face font-lock-string-face) 322 329 (fontified t face font-lock-string-face) 329 330 (syntax-table (15) fontified t face font-lock-string-face) 330 332 (fontified t) 332 336 (fontified t face font-lock-builtin-face) 336 337 (fontified t) 337 338 (syntax-table (15) fontified t face font-lock-string-face) 338 361 (fontified t face font-lock-string-face) 361 362 (syntax-table (15) fontified t face font-lock-string-face) 362 396 (fontified t) 396 397 (syntax-table (15) fontified t face font-lock-string-face) 397 409 (fontified t face font-lock-string-face) 409 410 (syntax-table (15) fontified t face font-lock-string-face) 410 412 (fontified t) 412 416 (fontified t face font-lock-builtin-face) 416 417 (fontified t) 417 418 (syntax-table (15) fontified t face font-lock-string-face) 418 438 (fontified t face font-lock-string-face) 438 439 (syntax-table (15) fontified t face font-lock-string-face) 439 461 (fontified t) 461 462 (syntax-table (15) fontified t face font-lock-string-face) 462 471 (fontified t face font-lock-string-face) 471 472 (syntax-table (15) fontified t face font-lock-string-face) 472 474 (fontified t) 474 478 (fontified t face font-lock-builtin-face) 478 479 (fontified t) 479 480 (syntax-table (15) fontified t face font-lock-string-face) 480 504 (fontified t face font-lock-string-face) 504 505 (syntax-table (15) fontified t face font-lock-string-face) 505 515 (fontified t) 515 516 (syntax-table (15) fontified t face font-lock-string-face) 516 531 (fontified t face font-lock-string-face) 531 532 (syntax-table (15) fontified t face font-lock-string-face) 532 534 (fontified t) 534 535 (fontified t) 535 539 (fontified t face font-lock-variable-name-face) 539 563 (fontified t) 563 572 (fontified t face font-lock-variable-name-face) 572 590 (fontified t) 590 595 (fontified t face font-lock-variable-name-face) 595 610 (fontified t) 610 618 (fontified t face font-lock-variable-name-face) 618 632 (fontified t) 632 635 (fontified t face font-lock-builtin-face) 635 648 (fontified t) 648 649 (syntax-table (15) fontified t face font-lock-string-face) 649 650 (fontified t face font-lock-string-face) 650 651 (syntax-table (15) fontified t face font-lock-string-face) 651 653 (fontified t) 653 656 (fontified t face font-lock-keyword-face) 656 659 (fontified t) 659 661 (fontified t face font-lock-keyword-face) 661 662 (fontified t) 662 667 (fontified t face font-lock-builtin-face) 667 671 (fontified t) 671 674 (fontified t face font-lock-builtin-face) 674 685 (fontified t) 685 687 (fontified t face font-lock-keyword-face) 687 709 (fontified t) 709 719 (fontified t face font-lock-variable-name-face) 719 733 (fontified t) 733 736 (fontified t face font-lock-builtin-face) 736 749 (fontified t) 749 750 (fontified t syntax-table (15) face font-lock-string-face) 750 751 (fontified t face font-lock-string-face) 751 752 (fontified t syntax-table (15) face font-lock-string-face) 752 754 (fontified t) 754 757 (fontified t face font-lock-keyword-face) 757 760 (fontified t) 760 762 (fontified t face font-lock-keyword-face) 762 785 (fontified t) 785 786 (fontified t syntax-table (15) face font-lock-string-face) 786 787 (fontified t face font-lock-string-face) 787 788 (fontified t syntax-table (15) face font-lock-string-face) 788 795 (fontified t) 795 798 (fontified t face font-lock-keyword-face) 798 801 (fontified t) 801 803 (fontified t face font-lock-keyword-face) 803 845 (fontified t) 845 851 (fontified t face font-lock-variable-name-face) 851 886 (fontified t) 886 892 (fontified t face font-lock-variable-name-face) 892 940 (fontified t) 940 941 (fontified t syntax-table (15) face font-lock-string-face) 941 948 (fontified t face font-lock-string-face) 948 949 (fontified t syntax-table (15) face font-lock-string-face) 949 963 (fontified t) 963 964 (fontified t syntax-table (15) face font-lock-string-face) 964 975 (fontified t face font-lock-string-face) 975 976 (fontified t syntax-table (15) face font-lock-string-face) 976 978 (fontified t) 978 980 (fontified t face font-lock-keyword-face) 980 981 (fontified t) 981 984 (fontified t face font-lock-keyword-face) 984 1004 (fontified t) 1004 1005 (fontified t syntax-table (15) face font-lock-string-face) 1005 1008 (fontified t face font-lock-string-face) 1008 1009 (fontified t syntax-table (15) face font-lock-string-face) 1009 1035 (fontified t) 1035 1036 (fontified t syntax-table (15) face font-lock-string-face) 1036 1039 (fontified t face font-lock-string-face) 1039 1040 (fontified t syntax-table (15) face font-lock-string-face) 1040 1042 (fontified t) 1042 1043 (fontified t) 1043 1045 (fontified t face font-lock-keyword-face) 1045 1046 (fontified t) 1046 1049 (fontified t face font-lock-keyword-face) 1049 1069 (fontified t) 1069 1070 (fontified t syntax-table (15) face font-lock-string-face) 1070 1073 (fontified t face font-lock-string-face) 1073 1074 (fontified t syntax-table (15) face font-lock-string-face) 1074 1100 (fontified t) 1100 1101 (fontified t syntax-table (15) face font-lock-string-face) 1101 1104 (fontified t face font-lock-string-face) 1104 1105 (fontified t syntax-table (15) face font-lock-string-face) 1105 1108 (fontified t) 1108 1111 (fontified t face font-lock-keyword-face) 1111 1119 (fontified t) 1119 1121 (fontified t face font-lock-keyword-face) 1121 1135 (fontified t) 1135 1136 (fontified t syntax-table (15) face font-lock-string-face) 1136 1139 (fontified t face font-lock-string-face) 1139 1140 (fontified t syntax-table (15) face font-lock-string-face) 1140 1147 (fontified t) 1147 1151 (fontified t face font-lock-variable-name-face) 1151 1154 (fontified t) 1154 1157 (fontified t face font-lock-builtin-face) 1157 1173 (fontified t) 1173 1177 (fontified t face font-lock-variable-name-face) 1177 1180 (fontified t) 1180 1183 (fontified t face font-lock-builtin-face) 1183 1206 (fontified t) 1206 1209 (fontified t face font-lock-builtin-face) 1209 1210 (fontified t) 1210 1211 (fontified t syntax-table (15) face font-lock-string-face) 1211 1214 (fontified t face font-lock-string-face) 1214 1215 (fontified t syntax-table (15) face font-lock-string-face) 1215 1230 (fontified t) 1230 1233 (fontified t face font-lock-keyword-face) 1233 1241 (fontified t) 1241 1243 (fontified t face font-lock-keyword-face) 1243 1257 (fontified t) 1257 1258 (fontified t syntax-table (15) face font-lock-string-face) 1258 1261 (fontified t face font-lock-string-face) 1261 1262 (fontified t syntax-table (15) face font-lock-string-face) 1262 1269 (fontified t) 1269 1273 (fontified t face font-lock-variable-name-face) 1273 1276 (fontified t) 1276 1279 (fontified t face font-lock-builtin-face) 1279 1295 (fontified t) 1295 1299 (fontified t face font-lock-variable-name-face) 1299 1302 (fontified t) 1302 1305 (fontified t face font-lock-builtin-face) 1305 1328 (fontified t) 1328 1331 (fontified t face font-lock-builtin-face) 1331 1332 (fontified t) 1332 1333 (fontified t syntax-table (15) face font-lock-string-face) 1333 1336 (fontified t face font-lock-string-face) 1336 1337 (fontified t syntax-table (15) face font-lock-string-face) 1337 1352 (fontified t) 1352 1357 (fontified t face font-lock-keyword-face) 1357 1358 (fontified t) 1358 1359 (fontified t syntax-table (15) face font-lock-string-face) 1359 1372 (fontified t face font-lock-string-face) 1372 1373 (fontified t syntax-table (15) face font-lock-string-face) 1373 1375 (fontified t) 1375 1378 (fontified t face font-lock-keyword-face) 1378 1381 (fontified t) 1381 1383 (fontified t face font-lock-keyword-face) 1383 1397 (fontified t) 1397 1398 (fontified t syntax-table (15) face font-lock-string-face) 1398 1401 (fontified t face font-lock-string-face) 1401 1402 (fontified t syntax-table (15) face font-lock-string-face) 1402 1409 (fontified t) 1409 1414 (fontified t face font-lock-keyword-face) 1414 1419 (fontified t) 1419 1424 (fontified t face font-lock-keyword-face) 1424 1425 (fontified t) 1425 1426 (fontified t syntax-table (15) face font-lock-string-face) 1426 1439 (fontified t face font-lock-string-face) 1439 1440 (fontified t syntax-table (15) face font-lock-string-face) 1440 1442 (fontified t) 1442 1445 (fontified t face font-lock-keyword-face) 1445 1448 (fontified t) 1448 1450 (fontified t face font-lock-keyword-face) 1450 1464 (fontified t) 1464 1465 (fontified t syntax-table (15) face font-lock-string-face) 1465 1468 (fontified t face font-lock-string-face) 1468 1469 (fontified t syntax-table (15) face font-lock-string-face) 1469 1476 (fontified t) 1476 1481 (fontified t face font-lock-keyword-face) 1481 1486 (fontified t) 1486 1490 (fontified t face font-lock-keyword-face) 1490 1491 (fontified t) 1491 1495 (fontified t face font-lock-builtin-face) 1495 1496 (fontified t) 1496 1497 (fontified t syntax-table (15) face font-lock-string-face) 1497 1508 (fontified t face font-lock-string-face) 1508 1509 (fontified t syntax-table (15) face font-lock-string-face) 1509 1511 (fontified t) 1511 1512 (fontified t syntax-table (15) face font-lock-string-face) 1512 1513 (fontified t face font-lock-string-face) 1513 1514 (fontified t syntax-table (15) face font-lock-string-face) 1514 1516 (fontified t) 1516 1518 (fontified t face font-lock-keyword-face) 1518 1546 (fontified t) 1546 1547 (fontified t) 1547 1551 (fontified t face font-lock-keyword-face) 1551 1561 (fontified t) 1561 1567 (fontified t face font-lock-keyword-face) 1567 1573 (fontified t) 1573 1574 (fontified t) 1574 1585 (fontified t)) 1585) #[257 "" [elpy-eldoc-show-current-function eldoc-message python-info-current-defun format "In: %s()" name index params propertize face eldoc-highlight-function-argument "%s(%s)" mapconcat identity ", "] 12 "\n\n(fn CALLTIP)"] elpy-rpc--default-error-callback)
  elpy-rpc("get_calltip" ("/home/dominik/git/apwlinux/aclient/apwinisync.py" #("#!/usr/bin/env python\n\n# APWLinux ini abgleich fuer [lin]und [for]\n\nimport ConfigParser\nimport argparse\nimport sys\nimport dbfread\n\nparser = argparse.ArgumentParser(prog=\"apwinisync\")\nparser.add_argument(\"--aclprefix\", help=\"APW aclient Benutzerprefix: aclient\",\n                    default=\"aclient\")\nparser.add_argument(\"--aclnr\", help=\"Anzahl der APW aclients\", default=11)\nparser.add_argument(\"--aclexclude\", help=\"Excludierte Benutzer\")\nparser.add_argument(\"--apwpath\", help=\"Pfad zur apwinstallation\", default=\"/home/praxis/a/\")\n\nargs = parser.parse_args()\n\naclprefix = args.aclprefix\naclnr = args.aclnr\n\naclients = [aclprefix+str(a).rjust(2, \"0\") for a in range(1, int(aclnr))]\n\nif args.aclexclude:\n    aclexclude = [aclprefix+str(a).rjust(2, \"0\") for a in args.aclexclude.split(\",\")]\n    for a in aclexclude:\n        aclients.remove(a)\n\n\nsrcini = ConfigParser.SafeConfigParser()\ndstini = ConfigParser.SafeConfigParser()\n\nsrcini.read(\"apw.ini\")\ndstini.read(\"apw.ini.new\")\nif not dstini.has_section(\"for\"):\n    dstini.add_section(\"for\")\n\nif not dstini.has_section(\"lin\"):\n    dstini.add_section(\"lin\")\n\nfor srcfor in srcini.items(\"for\"):\n    cfor = str(srcfor[0])\n    cprt = str(srcfor[1])\n    dstini.set(\"for\", cfor, cprt)\n\nfor srcfor in srcini.items(\"lin\"):\n    clin = str(srcfor[0])\n    cprt = str(srcfor[1])\n    dstini.set(\"lin\", clin, cprt)\n\nprint(\"Section [for]\")\nfor a in dstini.items(\"for\"):\n    print(a)\n\nprint(\"Section [lin]\")\nfor a in dstini.items(\"lin\"):\n    print(a)\n\nwith open(\"apw.ini.new\", \"a\") as apw:\n    dstini.write(apw)\n\nfrom datetime import time\n\ntime.sleept" 0 1 (fontified t face font-lock-comment-delimiter-face) 1 22 (fontified t face font-lock-comment-face) 22 23 (fontified t) 23 25 (fontified t face font-lock-comment-delimiter-face) 25 67 (fontified t face font-lock-comment-face) 67 68 (fontified t) 68 74 (fontified t face font-lock-keyword-face) 74 88 (fontified t) 88 94 (fontified t face font-lock-keyword-face) 94 104 (fontified t) 104 110 (fontified t face font-lock-keyword-face) 110 115 (fontified t) 115 121 (fontified t face font-lock-keyword-face) 121 131 (fontified t) 131 137 (fontified t face font-lock-variable-name-face) 137 169 (fontified t) 169 170 (syntax-table (15) fontified t face font-lock-string-face) 170 180 (fontified t face font-lock-string-face) 180 181 (syntax-table (15) fontified t face font-lock-string-face) 181 203 (fontified t) 203 204 (syntax-table (15) fontified t face font-lock-string-face) 204 215 (fontified t face font-lock-string-face) 215 216 (syntax-table (15) fontified t face font-lock-string-face) 216 218 (fontified t) 218 222 (fontified t face font-lock-builtin-face) 222 223 (fontified t) 223 224 (syntax-table (15) fontified t face font-lock-string-face) 224 259 (fontified t face font-lock-string-face) 259 260 (syntax-table (15) fontified t face font-lock-string-face) 260 290 (fontified t) 290 291 (syntax-table (15) fontified t face font-lock-string-face) 291 298 (fontified t face font-lock-string-face) 298 299 (syntax-table (15) fontified t face font-lock-string-face) 299 321 (fontified t) 321 322 (syntax-table (15) fontified t face font-lock-string-face) 322 329 (fontified t face font-lock-string-face) 329 330 (syntax-table (15) fontified t face font-lock-string-face) 330 332 (fontified t) 332 336 (fontified t face font-lock-builtin-face) 336 337 (fontified t) 337 338 (syntax-table (15) fontified t face font-lock-string-face) 338 361 (fontified t face font-lock-string-face) 361 362 (syntax-table (15) fontified t face font-lock-string-face) 362 396 (fontified t) 396 397 (syntax-table (15) fontified t face font-lock-string-face) 397 409 (fontified t face font-lock-string-face) 409 410 (syntax-table (15) fontified t face font-lock-string-face) 410 412 (fontified t) 412 416 (fontified t face font-lock-builtin-face) 416 417 (fontified t) 417 418 (syntax-table (15) fontified t face font-lock-string-face) 418 438 (fontified t face font-lock-string-face) 438 439 (syntax-table (15) fontified t face font-lock-string-face) 439 461 (fontified t) 461 462 (syntax-table (15) fontified t face font-lock-string-face) 462 471 (fontified t face font-lock-string-face) 471 472 (syntax-table (15) fontified t face font-lock-string-face) 472 474 (fontified t) 474 478 (fontified t face font-lock-builtin-face) 478 479 (fontified t) 479 480 (syntax-table (15) fontified t face font-lock-string-face) 480 504 (fontified t face font-lock-string-face) 504 505 (syntax-table (15) fontified t face font-lock-string-face) 505 515 (fontified t) 515 516 (syntax-table (15) fontified t face font-lock-string-face) 516 531 (fontified t face font-lock-string-face) 531 532 (syntax-table (15) fontified t face font-lock-string-face) 532 534 (fontified t) 534 535 (fontified t) 535 539 (fontified t face font-lock-variable-name-face) 539 563 (fontified t) 563 572 (fontified t face font-lock-variable-name-face) 572 590 (fontified t) 590 595 (fontified t face font-lock-variable-name-face) 595 610 (fontified t) 610 618 (fontified t face font-lock-variable-name-face) 618 632 (fontified t) 632 635 (fontified t face font-lock-builtin-face) 635 648 (fontified t) 648 649 (syntax-table (15) fontified t face font-lock-string-face) 649 650 (fontified t face font-lock-string-face) 650 651 (syntax-table (15) fontified t face font-lock-string-face) 651 653 (fontified t) 653 656 (fontified t face font-lock-keyword-face) 656 659 (fontified t) 659 661 (fontified t face font-lock-keyword-face) 661 662 (fontified t) 662 667 (fontified t face font-lock-builtin-face) 667 671 (fontified t) 671 674 (fontified t face font-lock-builtin-face) 674 685 (fontified t) 685 687 (fontified t face font-lock-keyword-face) 687 709 (fontified t) 709 719 (fontified t face font-lock-variable-name-face) 719 733 (fontified t) 733 736 (fontified t face font-lock-builtin-face) 736 749 (fontified t) 749 750 (fontified t syntax-table (15) face font-lock-string-face) 750 751 (fontified t face font-lock-string-face) 751 752 (fontified t syntax-table (15) face font-lock-string-face) 752 754 (fontified t) 754 757 (fontified t face font-lock-keyword-face) 757 760 (fontified t) 760 762 (fontified t face font-lock-keyword-face) 762 785 (fontified t) 785 786 (fontified t syntax-table (15) face font-lock-string-face) 786 787 (fontified t face font-lock-string-face) 787 788 (fontified t syntax-table (15) face font-lock-string-face) 788 795 (fontified t) 795 798 (fontified t face font-lock-keyword-face) 798 801 (fontified t) 801 803 (fontified t face font-lock-keyword-face) 803 845 (fontified t) 845 851 (fontified t face font-lock-variable-name-face) 851 886 (fontified t) 886 892 (fontified t face font-lock-variable-name-face) 892 940 (fontified t) 940 941 (fontified t syntax-table (15) face font-lock-string-face) 941 948 (fontified t face font-lock-string-face) 948 949 (fontified t syntax-table (15) face font-lock-string-face) 949 963 (fontified t) 963 964 (fontified t syntax-table (15) face font-lock-string-face) 964 975 (fontified t face font-lock-string-face) 975 976 (fontified t syntax-table (15) face font-lock-string-face) 976 978 (fontified t) 978 980 (fontified t face font-lock-keyword-face) 980 981 (fontified t) 981 984 (fontified t face font-lock-keyword-face) 984 1004 (fontified t) 1004 1005 (fontified t syntax-table (15) face font-lock-string-face) 1005 1008 (fontified t face font-lock-string-face) 1008 1009 (fontified t syntax-table (15) face font-lock-string-face) 1009 1035 (fontified t) 1035 1036 (fontified t syntax-table (15) face font-lock-string-face) 1036 1039 (fontified t face font-lock-string-face) 1039 1040 (fontified t syntax-table (15) face font-lock-string-face) 1040 1042 (fontified t) 1042 1043 (fontified t) 1043 1045 (fontified t face font-lock-keyword-face) 1045 1046 (fontified t) 1046 1049 (fontified t face font-lock-keyword-face) 1049 1069 (fontified t) 1069 1070 (fontified t syntax-table (15) face font-lock-string-face) 1070 1073 (fontified t face font-lock-string-face) 1073 1074 (fontified t syntax-table (15) face font-lock-string-face) 1074 1100 (fontified t) 1100 1101 (fontified t syntax-table (15) face font-lock-string-face) 1101 1104 (fontified t face font-lock-string-face) 1104 1105 (fontified t syntax-table (15) face font-lock-string-face) 1105 1108 (fontified t) 1108 1111 (fontified t face font-lock-keyword-face) 1111 1119 (fontified t) 1119 1121 (fontified t face font-lock-keyword-face) 1121 1135 (fontified t) 1135 1136 (fontified t syntax-table (15) face font-lock-string-face) 1136 1139 (fontified t face font-lock-string-face) 1139 1140 (fontified t syntax-table (15) face font-lock-string-face) 1140 1147 (fontified t) 1147 1151 (fontified t face font-lock-variable-name-face) 1151 1154 (fontified t) 1154 1157 (fontified t face font-lock-builtin-face) 1157 1173 (fontified t) 1173 1177 (fontified t face font-lock-variable-name-face) 1177 1180 (fontified t) 1180 1183 (fontified t face font-lock-builtin-face) 1183 1206 (fontified t) 1206 1209 (fontified t face font-lock-builtin-face) 1209 1210 (fontified t) 1210 1211 (fontified t syntax-table (15) face font-lock-string-face) 1211 1214 (fontified t face font-lock-string-face) 1214 1215 (fontified t syntax-table (15) face font-lock-string-face) 1215 1230 (fontified t) 1230 1233 (fontified t face font-lock-keyword-face) 1233 1241 (fontified t) 1241 1243 (fontified t face font-lock-keyword-face) 1243 1257 (fontified t) 1257 1258 (fontified t syntax-table (15) face font-lock-string-face) 1258 1261 (fontified t face font-lock-string-face) 1261 1262 (fontified t syntax-table (15) face font-lock-string-face) 1262 1269 (fontified t) 1269 1273 (fontified t face font-lock-variable-name-face) 1273 1276 (fontified t) 1276 1279 (fontified t face font-lock-builtin-face) 1279 1295 (fontified t) 1295 1299 (fontified t face font-lock-variable-name-face) 1299 1302 (fontified t) 1302 1305 (fontified t face font-lock-builtin-face) 1305 1328 (fontified t) 1328 1331 (fontified t face font-lock-builtin-face) 1331 1332 (fontified t) 1332 1333 (fontified t syntax-table (15) face font-lock-string-face) 1333 1336 (fontified t face font-lock-string-face) 1336 1337 (fontified t syntax-table (15) face font-lock-string-face) 1337 1352 (fontified t) 1352 1357 (fontified t face font-lock-keyword-face) 1357 1358 (fontified t) 1358 1359 (fontified t syntax-table (15) face font-lock-string-face) 1359 1372 (fontified t face font-lock-string-face) 1372 1373 (fontified t syntax-table (15) face font-lock-string-face) 1373 1375 (fontified t) 1375 1378 (fontified t face font-lock-keyword-face) 1378 1381 (fontified t) 1381 1383 (fontified t face font-lock-keyword-face) 1383 1397 (fontified t) 1397 1398 (fontified t syntax-table (15) face font-lock-string-face) 1398 1401 (fontified t face font-lock-string-face) 1401 1402 (fontified t syntax-table (15) face font-lock-string-face) 1402 1409 (fontified t) 1409 1414 (fontified t face font-lock-keyword-face) 1414 1419 (fontified t) 1419 1424 (fontified t face font-lock-keyword-face) 1424 1425 (fontified t) 1425 1426 (fontified t syntax-table (15) face font-lock-string-face) 1426 1439 (fontified t face font-lock-string-face) 1439 1440 (fontified t syntax-table (15) face font-lock-string-face) 1440 1442 (fontified t) 1442 1445 (fontified t face font-lock-keyword-face) 1445 1448 (fontified t) 1448 1450 (fontified t face font-lock-keyword-face) 1450 1464 (fontified t) 1464 1465 (fontified t syntax-table (15) face font-lock-string-face) 1465 1468 (fontified t face font-lock-string-face) 1468 1469 (fontified t syntax-table (15) face font-lock-string-face) 1469 1476 (fontified t) 1476 1481 (fontified t face font-lock-keyword-face) 1481 1486 (fontified t) 1486 1490 (fontified t face font-lock-keyword-face) 1490 1491 (fontified t) 1491 1495 (fontified t face font-lock-builtin-face) 1495 1496 (fontified t) 1496 1497 (fontified t syntax-table (15) face font-lock-string-face) 1497 1508 (fontified t face font-lock-string-face) 1508 1509 (fontified t syntax-table (15) face font-lock-string-face) 1509 1511 (fontified t) 1511 1512 (fontified t syntax-table (15) face font-lock-string-face) 1512 1513 (fontified t face font-lock-string-face) 1513 1514 (fontified t syntax-table (15) face font-lock-string-face) 1514 1516 (fontified t) 1516 1518 (fontified t face font-lock-keyword-face) 1518 1546 (fontified t) 1546 1547 (fontified t) 1547 1551 (fontified t face font-lock-keyword-face) 1551 1561 (fontified t) 1561 1567 (fontified t face font-lock-keyword-face) 1567 1573 (fontified t) 1573 1574 (fontified t) 1574 1585 (fontified t)) 1585) #[257 "" [elpy-eldoc-show-current-function eldoc-message python-info-current-defun format "In: %s()" name index params propertize face eldoc-highlight-function-argument "%s(%s)" mapconcat identity ", "] 12 "\n\n(fn CALLTIP)"] nil)
  elpy-rpc-get-calltip(#[257 "" [elpy-eldoc-show-current-function eldoc-message python-info-current-defun format "In: %s()" name index params propertize face eldoc-highlight-function-argument "%s(%s)" mapconcat identity ", "] 12 "\n\n(fn CALLTIP)"])
  elpy-eldoc-documentation()
  #[0 "" [eldoc-last-message eldoc-documentation-function eldoc-display-message-p eldoc-message nil eldoc-current-symbol eldoc-fnsym-in-current-sexp apply eldoc-get-fnsym-args-string eldoc-get-var-docstring] 5 "\n\n(fn)"]()
  funcall(#[0 "" [eldoc-last-message eldoc-documentation-function eldoc-display-message-p eldoc-message nil eldoc-current-symbol eldoc-fnsym-in-current-sexp apply eldoc-get-fnsym-args-string eldoc-get-var-docstring] 5 "\n\n(fn)"])
  eldoc-print-current-symbol-info()
  #[0 "" [eldoc-mode eldoc-print-current-symbol-info] 1 "\n\n(fn)"]()
  apply(#[0 "" [eldoc-mode eldoc-print-current-symbol-info] 1 "\n\n(fn)"] nil)
  byte-code("r" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 500000 t #[0 "" [eldoc-mode eldoc-print-current-symbol-info] 1 "\n\n(fn)"] nil idle 0])
I removed the controlsequences ...
Thank you! Emacs is apparently hanging trying to send data to the Elpy process. Which would indicate that Elpy is not actually reading data, but hanging in some loop.
When this happens, can you check with top (and P) whether the Elpy process is consuming 100% CPU? Either way, could you do an strace like you did for Emacs on that process?
I'm suspecting Rope as the primary culprit, but I could be wrong. If you want, try uninstalling Rope and see if that fixes the problem? :-)
Sorry for this somewhat aimless debugging here. This is a weird problem.
Hi,
rope is removed now
strace
strace -f -p 22358
Process 22358 attached with 2 threads
[pid 22361] futex(0x7fb3f00d1568, FUTEX_WAIT, 145, NULL <unfinished ...>
[pid 22358] futex(0x229b630, FUTEX_WAIT_PRIVATE, 0, NULL^CProcess 22358 detached
 <detached ...>
Process 22361 detached
But none 100% usage
Same problem without Rope? Did you M-x elpy-rpc-restart?
That confuses me a lot now. The Elpy process you show does not actually do anything, so it should keep reading from stdin. And as such, Emacs should not block.
I'm afraid I'm at a loss there :-(
yes same problem without rope, i started emacs completly new
first i thought i has to do with the oh-my-emacs config package, but the same affect with a new plain setup and your installation howto ....
when i start with an empty test.py, completion works for 2 lines, after some lines more nothing ... happens ... some lines more and it hangs.
if i open a file with about 50 lines it happens faster that emacs hangs
I'm afraid I'm completely at a loss here. Sorry. :-(
I see the same thing @dsaard describe.
Same problem here, using emacs 25.1.50.2 on Ubuntu 14.04, latest version of elpy. Output after toggle-debug-on-quit looks similar. If I can provide any other helpful input, please let me know.
Thank you – could you post the exact traceback, please?
Also, what file system is this on?
ext4 file system mounted with relatime. Traceback was sent via email.
@webhamster sent me the backlog in private mail, the lock happens in the same place: process-send-string. That's incredibly confusing. That can only mean that Elpy's input is blocked and it does not accept further input, so it's consuming slower than it receives data. But that should mean the Elpy process is using up all CPU. Apparently, it isn't.
@webhamster, can you confirm that? The Elpy process is not consuming CPU time?
Yes, can confirm, no significant CPU load caused by either emacs or elpy process.
Yay. Shotgun debugging! To verify if this is really the problem, please evaluate this form. The *Messages* buffer then will contain messages listing the duration of each such call. Does the duration increase over time, and is comparatively large when Emacs has locked up?
(defun elpy-rpc--call (method-name params success error)
  "Call METHOD-NAME with PARAMS in the current RPC backend.                     
When a result is available, SUCCESS will be called with that                    
value as its sole argument. If an error occurs, ERROR will be                   
called with the error list.                                                     
Returns a PROMISE object."
  (let ((start (float-time))
        (promise (elpy-promise success error)))
    (with-current-buffer (elpy-rpc--get-rpc-buffer)
      (setq elpy-rpc--call-id (1+ elpy-rpc--call-id)
            elpy-rpc--last-call (float-time))
      (elpy-rpc--register-callback elpy-rpc--call-id promise)
      (process-send-string
       (get-buffer-process (current-buffer))
       (concat (json-encode `((id . ,elpy-rpc--call-id)
                              (method . ,method-name)
                              (params . ,params)))
               "\n")))
    (message "elpy-rpc--call duration %s" (- (float-time) start))
    promise))
Will run the debug script as soon as the next lockup happens (restarted elpy just now).
NB: strace should show new output when I scroll through a file (it should show that the get_calltip request and others are received, right)?
Because mine does not. This is the only strace output directly relating to elpy since elpy was started. Since then, nothing happened. [pid 23354] lstat("/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py", {st_mode=S_IFREG|0644, st_size=551, ...}) = 0 [pid 23354] futex(0x7facf0903a04, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...> [pid 23351] <... read resumed> "{"id":3,"method":"get_calltip",""..., 4096) = 160 [pid 23351] futex(0x1814640, FUTEX_WAIT_PRIVATE, 0, NULL
Huh. That's really strange.
What's the value of default-process-coding-system in Emacs and os.linesep in Python?
Emacs: (utf-8-unix . utf-8-unix) Python: '\n'
Ok, that's not the problem, then. I remain confused! :-)
Well, I tried the debug script above, but it does not create any output when elpy has crashed and I have to abort with C-g.
It should cause output when Elpy tries to send more stuff to the backend. As in, if you have to C-g things, evaluate that, and continue to work, it should emit things to *Messages*. Or does Emacs lock up right away again when you go to a Python buffer?
This is what it looked like: elpy-rpc--call duration 0.0004696846008300781 <-- non-crashing output elpy-rpc--call duration 0.0009064674377441406 <-- non-crashing output, at the next cursor movement the crash happened Quit [3 times] <-- I pressed C-g ... <- other unrelated output
To help with debugging, I added the following lines into read_json in elpy/rpc.py:
     with open('/tmp/elpy-debug-python-server.log', 'a') as f:
        f.write(line[:120] + "\n")
The output shows an interesting behavior: For every "project" that I open, output is created upon each cursor movement... until it suddenly stops after some messages (3, 10, 7, then 18, see below). Even though I continued to move the cursor, no new output was created until I opened a file in a different folder. I didn't try long enough, but probably elpy will soon start to crash again.
{"id":1,"method":"init","params":[{"backend":null,"project_root":"/home/daniel/uni/git/car900/dist/"}]}
{"id":2,"method":"get_calltip","params":["/home/daniel/uni/git/car900/dist/utils/music.py",{"filename":"/tmp/elpy-rpc-15
{"id":3,"method":"get_calltip","params":["/home/daniel/uni/git/car900/dist/utils/music.py",{"filename":"/tmp/elpy-rpc-15
{"id":1,"method":"init","params":[{"backend":null,"project_root":"/home/daniel/.emacs.d/elpa/elpy-20160131.118/"}]}
{"id":2,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":3,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":4,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":5,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":6,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":7,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":8,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":9,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main int
{"id":10,"method":"get_calltip","params":["/home/daniel/.emacs.d/elpa/elpy-20160131.118/elpy/main.py",""""Main in
{"id":1,"method":"init","params":[{"backend":null,"project_root":"/home/daniel/git/advancedcaching/"}]}
{"id":2,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":3,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":4,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":5,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":6,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":7,"method":"get_calltip","params":["/home/daniel/git/advancedcaching/advancedcaching/core.py",{"filename":"/tmp/el
{"id":1,"method":"init","params":[{"backend":null,"project_root":"/home/daniel/uni/git/caldav-client/"}]}
{"id":2,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":3,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":4,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":5,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":6,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":7,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":8,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":9,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-15383
{"id":10,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":11,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":12,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":13,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":14,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":15,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":16,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":17,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
{"id":18,"method":"get_calltip","params":["/home/daniel/uni/git/caldav-client/server.py",{"filename":"/tmp/elpy-rpc-1538
                                    
                                    
                                    
                                
Hm. Can you add os.getpid() to the output, to check if that's a new process every time?
Also, does the following lock up after some time?
(let* ((buf (get-buffer-create "*Elpy Test*"))
       (process-connection-type nil)
       (process-environment (elpy-rpc--environment))
       (proc (start-process "Elpy Test" buf "/bin/cat")))
  (display-buffer buf)
  (sit-for 0.1)
  (with-current-buffer buf
    (let ((n 0))
      (while t
        (process-send-string proc (format "Line %s\n" n))
        (setq n (+ n 1))
        (sit-for 0.01)))))
Different "projects" yield different pids, yes. It looks like the longer the messages are, the earlier the crash happens (smells like a buffer running full).
The script above does not crash even after 8000 messages (added about 100 characters after Line %s to make the messages longer).
I added the following code to read_json:
   line = ""
    with open('/tmp/elpy-debug-python-server.log', 'a') as f:
        f.write(str(os.getpid()))
        f.write(" ")
        while True:
            byte = self.stdin.read(1)
            f.write(byte)
            f.flush()
            line += byte
            if byte == "\n":
                break
replacing the line = ...readline() stuff.
The output of this does never break in the middle of a message (tried 4 times and with long JSON messages).
Oh, but it also never stops with just the PID written to the file, meaning that elpy does not wait for new messages, but is occupied itself.
Oh, but it also never stops with just the PID written to the file, meaning that elpy does not wait for new messages, but is occupied itself.
You're missing f.flush() to be certain of that, I think?
Yes, that came to me just right now. With flush, the output ends after the pid. So the server IS waiting.
Emacs is doing something very weird there. Does this reproduce the problem?
(with-temp-buffer
  (python-mode)
  (elpy-mode)
  (let ((n 0))
    (while t
      (message ">>> %S" (elpy-rpc "echo" (list n)))
      (setq n (+ 1 n))
      (sit-for 0.01))))
Yes. Tried four times, crashed between message 518 and 1350.