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

draw_text() errors out with invalid pointer. #643

Closed
Mungari opened this issue Apr 17, 2020 · 16 comments
Closed

draw_text() errors out with invalid pointer. #643

Mungari opened this issue Apr 17, 2020 · 16 comments

Comments

@Mungari
Copy link

Mungari commented Apr 17, 2020

Bug Report

Following the tutorial. I'm doing the score section, I copy-pasted the code and it errors out with an invalid pointers and dumps the core.

I thought I had problems with a variable, but even with normal text it sometimes errors out.

Platform: Fedora 31
Arcade version: arcade==2.3.15
Python version: 3.7

Stack trace as per journalctl:

Process 7112 (python) of user 1000 dumped core.
                                                      
Stack trace of thread 7112:
#0  0x00007ff074f08625 raise (libc.so.6)
#1  0x00007ff074ef18d9 abort (libc.so.6)
#2  0x00007ff074f4c4af __libc_message (libc.so.6)
#3  0x00007ff074f53a9c malloc_printerr (libc.so.6)
#4  0x00007ff074f53d4c munmap_chunk (libc.so.6)
#5  0x00007ff062c8ec73 _ZN19hb_ot_map_builder_tD2Ev (libharfbuzz.so.0)
 #6  0x00007ff062cba78d _ZN18hb_ot_shape_plan_t5init0EP9hb_face_tPK19hb_shape_plan_key_t (libharfbuzz.so.0)
#7  0x00007ff062cc7f3d hb_shape_plan_create2 (libharfbuzz.so.0)
#8  0x00007ff062cc87f3 hb_shape_plan_create_cached2 (libharfbuzz.so.0)
#9  0x00007ff062cc89e3 hb_shape_full (libharfbuzz.so.0)
 #10 0x00007ff062dc5067 raqm_layout (libraqm.so.0)
 #11 0x00007ff06330c6e6 n/a (/home/birbautoma/.local/share/virtualenvs/arcade_test-dGCImsUz/lib64/python3.7/site-packages/PIL/_imagingf>

Actual behavior:

Expected behavior:

Print the score to the screen

Steps to reproduce/example code:

score_text = f"Score: {self.score}"
        arcade.draw_text(score_text, 10 + self.view_left, 10 + self.view_bottom,
                         arcade.csscolor.WHITE, 18)
@pvcraven
Copy link
Member

Does this happen the first time you attempt to draw text? Or after the game runs for a while?

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

It happens every time I try and run the game. Sometimes right after I make a step, sometimes right after it loads.

If I try and use normal text like "Hello" sometimes it works, sometimes it doesn't.

@pvcraven
Copy link
Member

I added a lot of print debug statements. Can you try running with this?

arcade-2.4a3-py3-none-any.whl.zip

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

A
B
C
D
E
F (216, 36)
G
H
I
J
K
L
A
B
C
D
E

@pvcraven
Copy link
Member

That narrows it down. It fails on just the second attempt?

I've added more debug messages to this upload, if you've got time to try it.

arcade-2.4a3-py3-none-any.whl.zip

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

Doesn't work, still. Sometimes it runs, I can collect a few coins and then it dies. Sometimes it doesn't start at all, some other times it crashes only after I move

@pvcraven
Copy link
Member

Did the second wheel print out additional debug messages?

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

When it crashes right after I launch the game:

A
B
C
D
E
[1] 14959 segmentation fault (core dumped) pipenv run python Arcade_Tutorial.py

or:

A
B
C
D
E
corrupted size vs. prev_size

or:

A
B
C
D
E
munmap_chunk(): invalid pointer
[1] 15078 abort (core dumped) pipenv run python Arcade_Tutorial.py

Crashes right after I move:

A
B
C
D
E
F (216, 36)
G
H
I
J
K
L
A
B
C
D
E
munmap_chunk(): invalid pointer
[1] 15135 abort (core dumped) pipenv run python Arcade_Tutorial.py

Hope this is useful :)

@einarf
Copy link
Member

einarf commented Apr 17, 2020

python-pillow/Pillow#4225 looks relevant

EDIT: Try python-pillow/Pillow#4225 (comment)

@pvcraven
Copy link
Member

Dumps with the new wheel I linked should look different than what you printed. It will still crash, but should give more debug info.

@pvcraven
Copy link
Member

And yes, that seems to be the same bug perhaps.

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

Tried following that. This is the result of trying to install Pillow 6.2.0:

ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-osz59v0r/Pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-0sunjnhw/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/PIL
copying src/PIL/features.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_version.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_util.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_tkinter_finder.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/_binary.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/main.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/init.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XpmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XbmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/XVThumbImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WmfImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WebPImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/WalImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TiffTags.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TiffImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TgaImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/TarIO.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SunImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SpiderImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/SgiImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PyAccess.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PsdImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PpmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PngImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PixarImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PdfParser.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PdfImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcfFontFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PcdImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PalmImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PaletteFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/PSDraw.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MspImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MpoImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MpegImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/MicImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/McIdasImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/JpegPresets.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/JpegImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Jpeg2KImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IptcImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImtImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageWin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageTransform.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageTk.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageStat.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageShow.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageSequence.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageQt.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImagePath.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImagePalette.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageOps.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMorph.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMode.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageMath.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageGrab.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFont.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFilter.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageEnhance.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageDraw2.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageDraw.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageColor.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageCms.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImageChops.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Image.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ImImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IcoImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/IcnsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/Hdf5StubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GribStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GimpPaletteFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GimpGradientFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GifImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GdImageFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/GbrImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FtexImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FpxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FontFile.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FliImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/FitsStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ExifTags.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/EpsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/DdsImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/DcxImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/CurImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/ContainerIO.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BufrStubImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BmpImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BlpImagePlugin.py -> build/lib.linux-x86_64-3.7/PIL
copying src/PIL/BdfFontFile.py -> build/lib.linux-x86_64-3.7/PIL
running egg_info
writing src/Pillow.egg-info/PKG-INFO
writing dependency_links to src/Pillow.egg-info/dependency_links.txt
writing top-level names to src/Pillow.egg-info/top_level.txt
reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.c'
warning: no files found matching '
.h'
warning: no files found matching '.sh'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.codecov.yml'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.readthedocs.yml'
warning: no previously-included files found matching 'azure-pipelines.yml'
warning: no previously-included files matching '.git
' found anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '
.so' found anywhere in distribution
no previously-included directories found matching '.azure-pipelines'
no previously-included directories found matching '.travis'
writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
running build_ext
building 'PIL._imagingft' extension
building 'PIL._imagingtk' extension
building 'PIL._imagingmath' extension
creating build/temp.linux-x86_64-3.7
building 'PIL._imaging' extension
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/freetype2 -I/tmp/pip-install-osz59v0r/Pillow/src/libImaging -I/tmp/pip-install-osz59v0r/Pillow -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingmath.c -o build/temp.linux-x86_64-3.7/src/_imagingmath.o
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/freetype2 -I/tmp/pip-install-osz59v0r/Pillow/src/libImaging -I/tmp/pip-install-osz59v0r/Pillow -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingft.c -o build/temp.linux-x86_64-3.7/src/_imagingft.o
creating build/temp.linux-x86_64-3.7/src/Tk
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc/Tk -I/usr/include/freetype2 -I/tmp/pip-install-osz59v0r/Pillow/src/libImaging -I/tmp/pip-install-osz59v0r/Pillow -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingtk.c -o build/temp.linux-x86_64-3.7/src/_imagingtk.o
creating build/temp.linux-x86_64-3.7/src/libImaging
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DPILLOW_VERSION="6.2.0" -I/usr/include/freetype2 -I/tmp/pip-install-osz59v0r/Pillow/src/libImaging -I/tmp/pip-install-osz59v0r/Pillow -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imaging.c -o build/temp.linux-x86_64-3.7/src/_imaging.o
src/_imagingft.c:22:10: fatal error: Python.h: No such file or directory
22 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
src/_imagingmath.c:16:10: fatal error: Python.h: No such file or directory
16 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
src/_imagingtk.c:16:10: fatal error: Python.h: No such file or directory
16 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
building 'PIL._imagingmorph' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/freetype2 -I/tmp/pip-install-osz59v0r/Pillow/src/libImaging -I/tmp/pip-install-osz59v0r/Pillow -I/usr/include -I/usr/local/include -I/usr/include/python3.7m -c src/_imagingmorph.c -o build/temp.linux-x86_64-3.7/src/_imagingmorph.o
src/_imaging.c:75:10: fatal error: Python.h: No such file or directory
75 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
src/_imagingmorph.c:14:10: fatal error: Python.h: No such file or directory
14 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-osz59v0r/Pillow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-0sunjnhw/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-osz59v0r/Pillow/

@einarf
Copy link
Member

einarf commented Apr 17, 2020

Missing the python dev/devel package I guess. Not sure what that is called on fedora.

@Mungari
Copy link
Author

Mungari commented Apr 17, 2020

It works now! Thanks :D very helpful!

@Mungari Mungari closed this as completed Apr 17, 2020
@einarf
Copy link
Member

einarf commented Apr 17, 2020

Great! The jam is saved I guess? 😄

@sangkips
Copy link

Install sudo dnf install python-devel will solve the issue

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

No branches or pull requests

4 participants