[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread Maxwell Ballenger


Maxwell Ballenger  added the comment:

Thank you Victor, sounds great!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


STINNER Victor  added the comment:

Maxwell: That was a nice idea and it's now added to Python 3.10 (will be part 
of the next Python 3.10 beta release)! I got an exception to land this feature 
in Python 3.10 even if we are past the feature freeze (see PR 26823 discussion).

As explained in PR 26823, Py_FatalError() also gets this 
_Py_DumpTracebackThreads() enhancement ;-) See an example at:
https://github.com/python/cpython/pull/26823#issuecomment-864950372

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9b0bbb9143d15507aae0ff3afeb05969178b306c by Victor Stinner in 
branch '3.10':
bpo-44466: Faulthandler now detects the GC (GH-26823) (GH-26826)
https://github.com/python/cpython/commit/9b0bbb9143d15507aae0ff3afeb05969178b306c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +25407
pull_request: https://github.com/python/cpython/pull/26826

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d19163912bfc790283724f05328bd31e4e65003d by Victor Stinner in 
branch 'main':
bpo-44466: Faulthandler now detects the GC (GH-26823)
https://github.com/python/cpython/commit/d19163912bfc790283724f05328bd31e4e65003d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


STINNER Victor  added the comment:

Maxwell: Oh, that's a good idea! I wrote PR 26823 to implement the feature. 
It's just 3 new lines in traceback.c :-)

if (tstate == current_tstate && tstate->interp->gc.collecting) {
PUTS(fd, "  Garbage-collecting\n");
}

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-21 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +25404
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26823

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-20 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

faulthandler has no access to the C-stack so it cannot see the 
gc_collect_main() as gdb does.

--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44466] faulthandler should indicate if the fault happened in garbage collection

2021-06-20 Thread Maxwell Ballenger


New submission from Maxwell Ballenger :

I have been working on debugging a segfault. When faulthandler catches the 
fault, it makes a printout like this:

Current thread 0x7f4fa62b2700 (most recent call first):
  File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 919, in 
call_at
  File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 502, in 
add_timeout
  ...

However, when I run the same app with gdb, catch the segfault with gdb and and 
run py-bt, it makes a printout like this

(gdb) py-bt
Traceback (most recent call first):
  Garbage-collecting
  File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 919, in 
call_at
functools.partial(stack_context.wrap(callback), *args, **kwargs),
  File "/usr/lib/python3.6/site-packages/tornado/ioloop.py", line 502, in 
add_timeout
return self.call_at(deadline, callback, *args, **kwargs)
  ...

The important distinction here for me is the "Garbage-collecting" line. When 
debugging this issue with faulthandler, I thought that the segfault was 
happening somewhere in the execution stack of this ioloop.py function. It 
wasn't until I ran under gdb that I realized it was actually happening in 
garbage collection and more or less has nothing to do with ioloop.py. It seems 
like faulthandler should be able to tell that the segfault was actually 
generated in garbage collection and this would make faulthandler much more 
helpful for cases like this.

Thank you for reading!

--
components: Library (Lib)
messages: 396196
nosy: maxballenger
priority: normal
severity: normal
status: open
title: faulthandler should indicate if the fault happened in garbage collection
type: enhancement
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com