Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when running manimgl #1387

Closed
eulertour opened this issue Feb 14, 2021 · 19 comments
Closed

Segfault when running manimgl #1387

eulertour opened this issue Feb 14, 2021 · 19 comments
Labels

Comments

@eulertour
Copy link
Collaborator

Describe the bug

Running manimgl with or without arguments results in a segfault

Code:
n/a

Wrong display or Error traceback:
printscreen

Additional context

The crash began after #1383 was merged.

@eulertour eulertour added the bug label Feb 14, 2021
@naveen521kk
Copy link
Contributor

naveen521kk commented Feb 14, 2021

@eulertour Can you run with the debugger and post the backtrace?

gdb -batch -ex "run" -ex "bt" manimgl

or better

gdb -ex "bt" -ex "run" --args python -c "import manimpango"

@naveen521kk
Copy link
Contributor

Also, if the problem is with manimpango, can you check whether it works with ManimCE?

@TonyCrane
Copy link
Collaborator

I went back to the version you mentioned, and then created a new conda environment, installed manimgl and ran it without any errors.

git checkout ad332c586341a665b2e69d4dbea8b023c66d575d
conda create -n manim_1387 python=3.8
source activate manim_1387
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple/
manimgl

And I feel that there is nothing in #1383 that will cause a segfault

@eulertour
Copy link
Collaborator Author

@naveen521kk The first command
printscreen

the second command
printscreen

it works with ManimCE.

@TonyCrane If you weren't aware, ManimPango is a custom-written C extension for using Pango.
https://github.com/ManimCommunity/ManimPango/blob/main/manimpango/cmanimpango.pxd

@naveen521kk
Copy link
Contributor

does this command show Seg Fault?

python -c "import manimpango"

@eulertour
Copy link
Collaborator Author

No

@naveen521kk
Copy link
Contributor

naveen521kk commented Feb 14, 2021

for the results about using gdb, you don't have debugging symbols installed see https://wiki.python.org/moin/DebuggingWithGdb

without the stack trace, it should be difficult for me to help...

possibly try with system python in /usr/bin/python because gdb is build to work with that.

@eulertour
Copy link
Collaborator Author

You don't have to help, I almost never use Text anyway.

I'm suggesting to make the change optional because the functionality isn't necessary to use manim and the code is unstable.

@naveen521kk
Copy link
Contributor

rather try running python using the verbose mode,

python -v -m manimlib

@naveen521kk
Copy link
Contributor

naveen521kk commented Feb 14, 2021

I'm suggesting to make the change optional because the functionality isn't necessary to use manim and the code is unstable.

Try removing text_mobject.py and run it also fix imports? It kinda feel like this isn't because of ManimPango, exactly the same code is run on Community Edition also, if that works then it isn't ManimPango.

@eulertour
Copy link
Collaborator Author

I made a pastebin here: https://pastebin.com/dzV8dJpW.
manim runs normally if I comment out the imports of manimlib.mobject.svg.text_mobject and manimlib.animation.numbers (which imports text_mobject).

@naveen521kk
Copy link
Contributor

The paste says, https://pastebin.com/dzV8dJpW, the import manimlib.mobject.svg.text_mobject was successful which means there is nothing to do with ManimPango. line 1264

so after the import 'pyglet.gl' # <_frozen_importlib_external.SourceFileLoader object at 0x7fd22d9faf70> it shows Seg Fault? Try checking out to 96d9a66 and see if there is a Seg Fault there?

I think this should be the cause of Seg Faults 368a6c3

@naveen521kk
Copy link
Contributor

@eulertour try setting env var PYTHONFAULTHANDLER to 1. Send what it says. see https://docs.python.org/3/library/faulthandler.html

@eulertour
Copy link
Collaborator Author

Running on both 96d9a66 and 368a6c3 runs normally. Dumping the traceback gives https://pastebin.com/HqsELR16.

I don't know if the problem is caused by ManimPango either. From what I've looked at it seems to be some interaction between ManimPango and moderngl that causes the problem. But being able to use manim is more important than being able to use pango, so to prevent breaking the entire library it makes more sense just to make it optional.

@naveen521kk
Copy link
Contributor

Just a last try, remove this line in __init__.py and run it?

from manimlib.mobject.interactive import *

@eulertour
Copy link
Collaborator Author

It still segfaults when that line is commented, and I verified that the import wasn't occurring anywhere else.

@naveen521kk
Copy link
Contributor

Try compiling manimpango yourselves, maybe that fixes it?

python -m pip install manimpango --no-binary :all: --force

@eulertour
Copy link
Collaborator Author

Compiling locally fixes the problem on ad332c5 and master.

@naveen521kk
Copy link
Contributor

Ah, I understand what happens, there are two different Pango version one used by manimpango and the other one from your system. Since, it's linux and gnome, any window which is opened uses pango for text rendering and this conflicting version, causing a segmentation fault. That's a reason I always recommend Linux users to install without using wheels, https://github.com/manimcommunity/manimpango#note, and I created those wheels only for the case of RTD build on Community Edition. It's also a notable reason why there don't exist wheels for pycairo outside of Windows.

For other OS like Mac and windows, this doesn't happen because the system uses its own rendering system and not Pango.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants