New issue 425: parse_file crashes with segfault in Fava (MacOS)

https://bitbucket.org/blais/beancount/issues/425/parse_file-crashes-with-segfault-in-fava



Andrii Mostovyi:



After editing ledger file in Fava editor, on file save fava crashes 
occasionally \(say, once-twice per day of heavy use\). After restart it works 
correctly.



This problem is happening for a year\+ under different versions of fava and 
beancount \(current fava version is 1.14\).



‌



It crashes in `build_grammar_error_from_exception`\[1\] , but I am having a 
hard time figuring out where exactly.



Maybe it’s worth asserting `PyErr_Occurred` as the first line in the method? 
Also, I would appreciate any tips on debugging this further.



\[1\][https://bitbucket.org/blais/beancount/src/f6d6f008453514bbbcd4ad795ffd941e6365b7b3/beancount/parser/grammar.y?at=default#lines-40](https://bitbucket.org/blais/beancount/src/f6d6f008453514bbbcd4ad795ffd941e6365b7b3/beancount/parser/grammar.y?at=default#lines-40)



‌



Crash report \(removed non-relevant parts\):



‌



```

Process:               Python [1223]

Path:                  
/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Identifier:            Python

Version:               3.7.7 (3.7.7)

Code Type:             X86-64 (Native)

Parent Process:        ??? [1]

Responsible:           Python [1223]



Date/Time:             2020-04-11 10:34:12.772 +0200

OS Version:            Mac OS X 10.14.6 (18G2022)

Report Version:        12



Time Awake Since Boot: 43000 seconds

Time Since Wake:       1200 seconds



System Integrity Protection: enabled



Crashed Thread:        5



Exception Type:        EXC_BAD_ACCESS (SIGSEGV)

Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000

Exception Note:        EXC_CORPSE_NOTIFY



Termination Signal:    Segmentation fault: 11

Termination Reason:    Namespace SIGNAL, Code 0xb

Terminating Process:   exc handler [1223]



Thread 5 Crashed:

0   _parser.cpython-37m-darwin.so       0x000000010fa85fdb 
build_grammar_error_from_exception + 187

1   _parser.cpython-37m-darwin.so       0x000000010fa87d0f yyparse + 7263

2   _parser.cpython-37m-darwin.so       0x000000010fa88d83 parse_file + 243

3   org.python.python                   0x000000010e05d74e PyCFunction_Call + 
208

4   org.python.python                   0x000000010e0ebe64 
_PyEval_EvalFrameDefault + 7738

5   org.python.python                   0x000000010e0f331d 
_PyEval_EvalCodeWithName + 1698

6   org.python.python                   0x000000010e05d474 
_PyFunction_FastCallKeywords + 212

7   org.python.python                   0x000000010e0f2b29 call_function + 737

8   org.python.python                   0x000000010e0ebbdc 
_PyEval_EvalFrameDefault + 7090

9   org.python.python                   0x000000010e0f331d 
_PyEval_EvalCodeWithName + 1698

10  org.python.python                   0x000000010e05d474 
_PyFunction_FastCallKeywords + 212

11  org.python.python                   0x000000010e0f2b29 call_function + 737

12  org.python.python                   0x000000010e0ebb34 
_PyEval_EvalFrameDefault + 6922

13  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

14  org.python.python                   0x000000010e0f2b29 call_function + 737

15  org.python.python                   0x000000010e0eba99 
_PyEval_EvalFrameDefault + 6767

16  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

17  org.python.python                   0x000000010e0f2b29 call_function + 737

18  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

19  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

20  org.python.python                   0x000000010e0f2b29 call_function + 737

21  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

22  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

23  org.python.python                   0x000000010e0f2b29 call_function + 737

24  org.python.python                   0x000000010e0ebb34 
_PyEval_EvalFrameDefault + 6922

25  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

26  org.python.python                   0x000000010e0f2b29 call_function + 737

27  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

28  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

29  org.python.python                   0x000000010e0f2b29 call_function + 737

30  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

31  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

32  org.python.python                   0x000000010e0f2b29 call_function + 737

33  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

34  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

35  org.python.python                   0x000000010e05e1f3 
_PyObject_Call_Prepend + 131

36  org.python.python                   0x000000010e09ac86 slot_tp_call + 71

37  org.python.python                   0x000000010e05d322 
_PyObject_FastCallKeywords + 358

38  org.python.python                   0x000000010e0f2b22 call_function + 730

39  org.python.python                   0x000000010e0eba99 
_PyEval_EvalFrameDefault + 6767

40  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

41  org.python.python                   0x000000010e0f2b29 call_function + 737

42  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

43  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

44  org.python.python                   0x000000010e0f2b29 call_function + 737

45  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

46  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

47  org.python.python                   0x000000010e0f2b29 call_function + 737

48  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

49  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

50  org.python.python                   0x000000010e0f2b29 call_function + 737

51  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

52  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

53  org.python.python                   0x000000010e0f2b29 call_function + 737

54  org.python.python                   0x000000010e0eba80 
_PyEval_EvalFrameDefault + 6742

55  org.python.python                   0x000000010e05d880 
function_code_fastcall + 106

56  org.python.python                   0x000000010e05e1f3 
_PyObject_Call_Prepend + 131

57  org.python.python                   0x000000010e05d5b9 PyObject_Call + 136

58  org.python.python                   0x000000010e159501 t_bootstrap + 71

59  org.python.python                   0x000000010e1208be pythread_wrapper + 25

60  libsystem_pthread.dylib             0x00007fff5fe6b2eb _pthread_body + 126

61  libsystem_pthread.dylib             0x00007fff5fe6e249 _pthread_start + 66

62  libsystem_pthread.dylib             0x00007fff5fe6a40d thread_start + 13





---

All other threads are waiting



e.g.



0   libsystem_kernel.dylib              0x00007fff5fdaf866 __psynch_cvwait + 10

1   libsystem_pthread.dylib             0x00007fff5fe6e56e _pthread_cond_wait + 
722

2   org.python.python                   0x000000010e120c13 
PyThread_acquire_lock_timed + 393

3   org.python.python                   0x000000010e158de4 acquire_timed + 104

4   org.python.python                   0x000000010e158ba7 
lock_PyThread_acquire_lock + 44

...

```



‌




-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20200411091619.635.77568%40app-137.ash1.bb-inf.net.

Reply via email to