qbektrix / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

random crash with pyglet.clock.tick() #407

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With pyglet 1.1.3, with a custom pyglet event loop :
  File "/usr/local/lib/python2.5/pymt/mtpyglet.py", line 477, in runTouchApp
    pymt_evloop.run()
  File "/usr/local/lib/python2.5/site-packages/pyglet/app/xlib.py", line
94, in run
    sleep_time = self.idle()
  File "/usr/local/lib/python2.5/pymt/mtpyglet.py", line 358, in idle
    frame_dt = pyglet.clock.tick()
  File "/usr/local/lib/python2.5/site-packages/pyglet/clock.py", line 698,
in tick
    return _default.tick(poll)
  File "/usr/local/lib/python2.5/site-packages/pyglet/clock.py", line 317,
in tick
    item.next_ts = self._get_soft_next_ts(ts, item.interval)
  File "/usr/local/lib/python2.5/site-packages/pyglet/clock.py", line 585,
in _get_soft_next_ts
    if not taken(next_ts, interval / 4):
  File "/usr/local/lib/python2.5/site-packages/pyglet/clock.py", line 563,
in taken
    if abs(item.next_ts - ts) <= e:
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

Here is the pseudo code of event loop :

    def idle(self):
        frame_dt = pyglet.clock.tick()      <<<< Random crash here

        # dispatch pyglet events
        for window in pyglet.app.windows:
            window.dispatch_events()
            window.dispatch_event('on_draw')
            window.flip()

        return 0

I've crash if i use many clock (maybe, not sure about this.)

Original issue reported on code.google.com by txprog on 31 Mar 2009 at 8:18

GoogleCodeExporter commented 9 years ago
nevyn_: Line 327,
[07:46] nevyn_:         self._schedule_interval_items = \
[07:46] nevyn_:             [item for item in self._schedule_interval_items \
[07:46] nevyn_:             if item.next_ts is not None]

nevyn_: Ah-hah, line 324: item.next_ts = None
[07:48] nevyn_: The comment above the list comprehension is "# Remove finished 
one-shots."

I can see now how it works... in tick(), each schedule item is iterated, and if 
it's a one-shot, its next_ts is set to 
None. If, after that, an item needs rescheduling, every schedule item is 
compared, and in this case one of the 
others now have a next_ts of None, and we crash.

I'm using pyglet 1.1.3; piman on irc is using 1.1.2 and does not have this code.

Blog entry with my encounter of the bug, plus an ugly hack to make the bug go 
away from now: http://overooped.com/post/93720695/deathtroid-crash

Original comment by joach...@gmail.com on 7 Apr 2009 at 5:52

GoogleCodeExporter commented 9 years ago
Bug was introduced in 
http://code.google.com/p/pyglet/source/detail?spec=svn2446&r=2298.

Fixed in trunk in November, 
http://code.google.com/p/pyglet/source/detail?spec=svn2446&r=2327, but the fix 
didn't
make it to the maintenance release.

Original comment by joe.wreschnig@gmail.com on 7 Apr 2009 at 5:56

GoogleCodeExporter commented 9 years ago
Is a release comming ? Cause this bug break almost every app we've made, and 
1.1.2 is
unavailable for download right now :/
Users cannot use the latest version, and cannot download 1.1.2...

So, what should we do ?

Original comment by txprog on 18 Apr 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Note that this was also reported as issue 417.

Original comment by ores...@gmail.com on 27 Jun 2009 at 6:51

GoogleCodeExporter commented 9 years ago
Should we consider this issue (407) as well a issue 417 to be fixed ?

Original comment by Nicolas.Rougier@gmail.com on 16 Aug 2009 at 8:59

GoogleCodeExporter commented 9 years ago
I believe they are talking about the same bug, but (IMHO) before marking one as 
a
duplicate, it would be good to compare the patch proposed in issue 417 to the 
change
reported as fixing 407 (see comment #2) -- they needn't be identical but this 
should
confirm it was really about the same bug. And before marking the remaining bug 
as
fixed, it would be good to test it if possible, and to backport the change to 
the
1.1-maintenance branch.

Original comment by ores...@gmail.com on 16 Aug 2009 at 3:58

GoogleCodeExporter commented 9 years ago
Issue 417 has been merged into this issue.

Original comment by m.e.w.ol...@gmail.com on 16 Aug 2009 at 4:18

GoogleCodeExporter commented 9 years ago
This was included in the recent release, wasn't it? So this issue could be 
closed.

Original comment by MostAwes...@gmail.com on 7 Jan 2010 at 6:06

GoogleCodeExporter commented 9 years ago
I'm closing this bug since it is rather old and we need a clean list to follow 
new issues. It may be gone with the new AVBin work. If you think this is still 
a problem, can you retest the problem with a recent version and add the issue 
again? 

Original comment by winstonw...@gmail.com on 22 Jun 2012 at 10:31