[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] event getting corrupted



Brian Fisher skrev:
I'm a little confused - you said you get a "segmentation error", and you mentioned running a debugger, but you are showing a python error. So do you get a real segmentation fault? Like bad memory access that drops out of python and all that? If so, you haven't captured that error in the right kind of debugger for seg faults (gdb) yet.

If I am not using the debugger I get a segmentation error. If I use the debugger that is integrated with Pydev in Eclipse I do get a
trace, assuming that its the same error, but it seems safe to assume.

Assuming you are getting a seg fault, then that sucks. If it were me in that case, I'd probably see if I can set up some system to force the error to happen. Like say make the game run through the conditions that you see the error in now, and make it run over night - or maybe set up some kind of automation to record and playback some play, and again, run it all night.

It would have to playback a user solving a solitaire game which is were I have been able to repeat the error infrequently. Got any suggestions
for how to do that in windows ?
The reason getting a stable reproducing case is so important, is then you can binary search this. Like disable all blitting, or turn off the music, etc.

Yes, I have been trying to find a stable way to repeat it but no luck so far.
As far as the python stack trace goes, if you are getting a seg fault, then the weirdness of the python stack makes it seem likely that memory corruption happened between the event.pos and event.button lines, as you pointed out. Is this python stack reproducible? Have you seen it multiple times? If so, then it seems like it could be code that executes synchronously between those 2 lines, in which case tossing a ton of asserts or "temp = event.button" lines in the mouse_button_up would help you narrow down the lines that trigger things next time this in-python exception triggers? If on the other hand you haven't seen it before/can't reporoduce it, it may just be a red herring, and the corruption could be happening asynchronously in some other thread - maybe it could be the music?

The error has occurred infrequently for a month or two, not sure when I saw it the first time. But since I couldn't repeat it I figured it was a chance error. I am not using any own threads at all, but there is a sound being played when I release the mouse button so that could be a factor.
So what OS and versions of stuff you using when you get the error? Have you been able to try the code on other platforms? Any other libraries besides pygame used with this program? Any idea when exactly it started occurring in relation to your code? Any code of yours that seems like something that could be causing the problem (like your own c compiled extensions)? I don't suppose you are blitting a surface to itself anywhere and using Linux?

I am using the latests stable pygame, and python 2.5 on a Windows Vista Dual Core machine. The only other c extension that I use is Psyco, but that should be disabled when running the debugger. I am not blitting surfaces to it self . I am however blitting to subsurfaces which I remember could cause a problem in some previous version of Pygame. So I set some print statements to see if the crash happend
while blitting but no luck there.