Closed GalacticEmperor1 closed 1 year ago
(gdb) info registers rax 0xd 13 rbx 0x0 0 rcx 0x7ffff21b5cf0 140737255267568 rdx 0x32 50 rsi 0x7ffff21b5c30 140737255267376 rdi 0x7ffff7ba6ab0 140737349577392 rbp 0x0 0x0 rsp 0x7fffffff8000 0x7fffffff8000 r8 0xe6373b5d0f4739a2 -1857951050392716894 r9 0x8 8 r10 0x7 7 r11 0x12ec0f11f0974608 1363481356911724040 r12 0x5555558d2200 93824995893760 r13 0x7ffff6f65df0 140737336729072 r14 0x0 0 r15 0x0 0 rip 0x7ffff6025480 0x7ffff6025480 <pg_event_post+544> eflags 0x210206 [ PF IF RF ID ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0
# Comments
# # # **[robertpfeiffer](https://github.com/robertpfeiffer)* commented at 2020-10-11 08:45:02*
I'll look into this. I'll try the same thing I did for KEYDOWN events, but I might also create a warning when a QUIT or VIDEORESIZE is posted. I don't think SDL2 handles QUIT directly (and VIDEORESIZE is no longer a thing, so no harm there)
<hr>
# # # **[mgedmin](https://github.com/mgedmin)* commented at 2020-10-11 09:01:21*
This code was part of the test suite, for testing how my game's main loop handles QUIT events. I wouldn't want SDL2 to handle it for me and, e.g., terminate the test runner.
I suppose I could monkey-patch pygame.event.get(), if this kind of thing is problematic with the real event subsystem.
<hr>
# # # **[robertpfeiffer](https://github.com/robertpfeiffer)* commented at 2020-10-21 07:43:26*
Just so we are clear: Posting some events with SDL2 will cause these events to be handled by SDL2 itself. Posting QUIT events should be fine according to https://wiki.libsdl.org/SDL_EventType# SDL_QUIT https://wiki.libsdl.org/SDL_QuitRequested
<hr>
# # # **[ankith26](https://github.com/ankith26)* commented at 2020-10-22 13:27:27*
I’m not able to reproduce this issue on my raspberry pi (both with py3.7 and py3.9).
Could you try upgrading to latest pygame dev release and try
<hr>
# # # **[mgedmin](https://github.com/mgedmin)* commented at 2020-10-22 15:58:06*
I can reproduce the segfault with current git master (a0f7cdc8ca3ac6fc9986747a9dcc14d3c828be14) on Python 3.8, on Ubuntu 20.04, on x86-64, using SDL2.
(BTW `pip install -e ~/src/pygame` did not actually work for me -- No module named 'pygame.locals' -- but `pip install ~/src/pygame` worked fine, err, other than the segfault.)
<hr>
# # # **[illume](https://github.com/illume)* commented at 2020-10-22 18:43:26*
I got this related pygame.event.post crash:
```python
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized
Current thread 0x0000000119b44dc0 (most recent call first):
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./input.py", line 139 in postactive
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./gameplay.py", line 416 in playerstart_end
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./gameplay.py", line 83 in changestate
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./gameplay.py", line 407 in playerstart_tick
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./gameplay.py", line 150 in run
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./main.py", line 101 in gamemain
File "/Users/rene/dev/pygame/solarwolf/solarwolf/./main.py", line 18 in main
File "solarwolf/cli.py", line 60 in main
File "solarwolf/cli.py", line 204 in <module>
Abort trap: 6
In the game solarwolf on Mac with 2.0.0.dev19
def postactive():
keystate = pygame.key.get_pressed()
for key in range (len(keystate)):
if keystate[key]:
# I don't know how to get unicode
pygame.event.post(pygame.event.Event(KEYDOWN, {'key': key, 'mod': pygame.key.get_mods()}))
I have put # 2235 to hopefully fix things.
Now need to do more investigation the QUIT issue though.
@mgedmin my new PR # 2244 probably fixes your issue, so you can give it a try, the PR was intended to fix issues with KEYDOWN/KEYUP, but can hopefully fix your issue to. While you are at it, could you please paste the results of running the unittests of event module like,
python3 -m pygame.tests.event_test
Yes, # 2244 fixes my segfault.
python3 -m pygame.tests.event_test
hangs for me with no output after printing
pygame 2.0.0.dev23 (SDL 2.0.12, python 3.8.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
I have waited 5 minutes before hitting ^C (futilely) and ^\ (which made it dump core and quit at last).
It's great the segfault is fixed. Thanks @ankith26
Going to leave this issue open to look at the unit test hangs.
Glad the segfault is sorted, but I half expected the unittests to somehow fail, that’s why I asked the results
Can you try this bit of code, to see if it segfaults for you
import pygame
event = pygame.event.Event(pygame.VIDEOEXPOSE)
pygame.event.post(event)
Oh and by the way, the reason I’m asking you to test all this is that I am not able to reproduce your issue, so I need your help in debugging this
No segfault, just an error:
$ python -c 'import pygame
event = pygame.event.Event(pygame.VIDEOEXPOSE)
pygame.event.post(event)
'
pygame 2.0.0.dev23 (SDL 2.0.12, python 3.8.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "<string>", line 3, in <module>
pygame.error: video system not initialized
$ python -c 'import pygame
pygame.init()
event = pygame.event.Event(pygame.VIDEOEXPOSE)
pygame.event.post(event)
'
pygame 2.0.0.dev23 (SDL 2.0.12, python 3.8.6)
Hello from the pygame community. https://www.pygame.org/contribute.html
doesn't crash, but freezes, ignores ^C, dies on ^.
TBF python -c 'import pygame; pygame.init()'
does the same.
The hang is probably a local issue, feel free to ignore. gdb shows it's waiting inside libxcb.so.1, inside libGLX_mesa.so.0, inside libSDL2-2.0.so.0. Some other X11 apps (firefox) do the same. Other apps (e.g. those using pygame 1.9.6, which is linked against libSDL1.2.so.0) work fine. I suspect the socat I have running (socat abstract-listen:/tmp/.X11-unix/X0,reuseaddr,fork unix:/tmp/.X11-unix/X0
) to forward the X11 abstract socket to the real socket has something to do with this situation.
I'll do the try again in a few days once Ubuntu people push through the mutter SRU that resurrects the X11 abstract socket and allows snap-ified applications like Chromium to work again without the socat hack.
Thanks for the investigation and reports @mgedmin.
I'll take the critical label (reserved for pygame 2 blocking issues) off this one now, because it sounds like it's something quite specific to your setup. There's an event.post PR happening at https://github.com/pygame/pygame/pull/2250
The PR by @ankith26 fixes this https://github.com/pygame/pygame/pull/2398 , so closing this. Thanks all!
Issue №2146 opened by mgedmin at 2020-10-06 09:33:01
Description
[Pyspacewar's test suite](https://github.com/mgedmin/pyspacewar/blob/ae767d673d1736dce85f0ed2928ab204acebea17/src/pyspacewar/tests/test_ui.py# L2476) segfaults in
pg_event_post
, in a doctest that does this:It's the only thing that fails; the rest of the test suite is fine.
The test suite works fine with the last pygame release; the segfault only happens with pygame 2.0.0.dev12.
Steps to reproduce
Stack trace