libfuse / python-fuse

Python 2.x/3.x bindings for libfuse 2.x
GNU Lesser General Public License v2.1
279 stars 73 forks source link

Debugging a crash #55

Open glensc opened 9 months ago

glensc commented 9 months ago

Started using this library:

but it crashes in non-debug mode, and in debug mode no errors. catching exception does not help.

how to get logs out of the problem?

In that example, crash can be avoided by not using any plex server related in section_types method

this still crashes even faulti part is catch'ed:

    @cached_property
    def section_types(self):
        try:
            self.server
        except Exception as e:
            ...
        return {}

tl;dr: crashes on macos in normal mode. does not crash under -f, does not crash under -d, and under -d no known exception is thrown.

SimonHeimberg commented 1 month ago

You already tried -f, which often helped me. :thinking:

Suggesting some ideas:

stdout to file

import sys
sys.stderr = open("~/fuse_debug.txt", "w")
#sys.stdout = sys.stderr # maybe also normal output

Then see if any error gets written into ~/.fuse_debug.txt

redirect traceback

Or a similar idea, write your own function replacing sys.get_traceback() to do custom printing, see https://docs.python.org/3/library/sys.html#sys.excepthook or http://stackoverflow.com/questions/6234405/ddg#16993115

debugger

Possibly the debugger can help. But I fail to get anything more useful than implementing one of the above things without changing the code. Anyway, redirect stdout: python3 -m pdb ./xxx/theCodeToDebug.py

(pdb) !import sys
(pdb) !sys.stderr = open("~/fuse_debug.txt", "w")
c

The debugger is left when main() is called, and I know no possibility to avoid this.