arifgursel / pyglet

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

Corrupted double-linked list #386

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Following the 'Hello World' App from the programming guide
(http://www.pyglet.org/doc/programming_guide/hello_world.html), when I try
to run it it produces the error shown below

Paste in the traceback or error message:
In the latest attempt:
*** glibc detected *** /usr/bin/python: corrupted double-linked list:
0x0945f8e0 ***

It seems to change frequently.  I've also had a similar one that said
"double free or corruption(!prev)" instead of "corrupted double-linked list".

pyglet 1.1 with Python 2.5: Paste in the output of `python -m pyglet.info`
Other: Paste in the output of tools/gl_info.py (included in source distro):
Python
------------------------------------------------------------------------------
sys.version: 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) 
[GCC 4.3.2]
sys.platform: linux2
os.getcwd(): /home/dom

pyglet
------------------------------------------------------------------------------
pyglet.version: 1.1.2
pyglet.__file__: /var/lib/python-support/python2.5/pyglet/__init__.py
pyglet.options['debug_trace_depth'] = 1
pyglet.options['audio'] = ('directsound', 'openal', 'alsa', 'silent')
pyglet.options['xsync'] = True
pyglet.options['debug_trace_flush'] = True
pyglet.options['debug_win32'] = False
pyglet.options['debug_gl_trace'] = False
pyglet.options['debug_x11'] = False
pyglet.options['shadow_window'] = True
pyglet.options['debug_font'] = False
pyglet.options['debug_media'] = False
pyglet.options['debug_trace'] = False
pyglet.options['debug_lib'] = False
pyglet.options['graphics_vbo'] = True
pyglet.options['vsync'] = None
pyglet.options['debug_trace_args'] = False
pyglet.options['debug_gl'] = True
pyglet.options['debug_graphics_batch'] = False
pyglet.options['font'] = ('gdiplus', 'win32')
pyglet.options['debug_texture'] = False
pyglet.options['debug_gl_trace_args'] = False

pyglet.window
------------------------------------------------------------------------------
platform: <pyglet.window.xlib.XlibPlatform object at 0xb76bec4c>
display: <pyglet.window.xlib.XlibDisplayDevice object at 0x9240a4c>
screens[0]: XlibScreen(screen=0, x=0, y=0, width=1280, height=768, xinerama=1)
config['double_buffer'] = 1
config['stereo'] = 0
config['buffer_size'] = 32
config['aux_buffers'] = 0
config['sample_buffers'] = 0
config['samples'] = 0
config['red_size'] = 8
config['green_size'] = 8
config['blue_size'] = 8
config['alpha_size'] = 8
config['depth_size'] = 24
config['stencil_size'] = 8
config['accum_red_size'] = 0
config['accum_green_size'] = 0
config['accum_blue_size'] = 0
config['accum_alpha_size'] = 0
context: XlibGLContext()

pyglet.gl.gl_info
------------------------------------------------------------------------------
gl_info.get_version(): 2.1 Mesa 7.2
gl_info.get_vendor(): Mesa Project
gl_info.get_renderer(): Software Rasterizer
gl_info.get_extensions():
   GL_APPLE_packed_pixels
   GL_APPLE_vertex_array_object
   GL_ARB_depth_texture
   GL_ARB_draw_buffers
   GL_ARB_fragment_program
   GL_ARB_fragment_program_shadow
   GL_ARB_fragment_shader
   GL_ARB_half_float_pixel
   GL_ARB_imaging
   GL_ARB_multisample
   GL_ARB_multitexture
   GL_ARB_occlusion_query
   GL_ARB_pixel_buffer_object
   GL_ARB_point_parameters
   GL_ARB_point_sprite
   GL_ARB_shader_objects
   GL_ARB_shading_language_100
   GL_ARB_shadow
   GL_ARB_shadow_ambient
   GL_ARB_texture_border_clamp
   GL_ARB_texture_compression
   GL_ARB_texture_cube_map
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_crossbar
   GL_ARB_texture_env_dot3
   GL_ARB_texture_mirrored_repeat
   GL_ARB_texture_non_power_of_two
   GL_ARB_texture_rectangle
   GL_ARB_transpose_matrix
   GL_ARB_vertex_buffer_object
   GL_ARB_vertex_program
   GL_ARB_vertex_shader
   GL_ARB_window_pos
   GL_ATI_blend_equation_separate
   GL_ATI_fragment_shader
   GL_ATI_separate_stencil
   GL_ATI_texture_env_combine3
   GL_ATI_texture_mirror_once
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_equation_separate
   GL_EXT_blend_func_separate
   GL_EXT_blend_logic_op
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_clip_volume_hint
   GL_EXT_compiled_vertex_array
   GL_EXT_convolution
   GL_EXT_copy_texture
   GL_EXT_depth_bounds_test
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_framebuffer_blit
   GL_EXT_framebuffer_object
   GL_EXT_gpu_program_parameters
   GL_EXT_histogram
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_depth_stencil
   GL_EXT_packed_pixels
   GL_EXT_paletted_texture
   GL_EXT_pixel_buffer_object
   GL_EXT_point_parameters
   GL_EXT_polygon_offset
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_shared_texture_palette
   GL_EXT_stencil_wrap
   GL_EXT_subtexture
   GL_EXT_texture
   GL_EXT_texture3D
   GL_EXT_texture_edge_clamp
   GL_EXT_texture_env_add
   GL_EXT_texture_env_combine
   GL_EXT_texture_env_dot3
   GL_EXT_texture_lod_bias
   GL_EXT_texture_mirror_clamp
   GL_EXT_texture_object
   GL_EXT_texture_rectangle
   GL_EXT_texture_sRGB
   GL_EXT_vertex_array
   GL_IBM_multimode_draw_arrays
   GL_IBM_rasterpos_clip
   GL_IBM_texture_mirrored_repeat
   GL_INGR_blend_func_separate
   GL_MESA_pack_invert
   GL_MESA_program_debug
   GL_MESA_resize_buffers
   GL_MESA_texture_array
   GL_MESA_window_pos
   GL_MESA_ycbcr_texture
   GL_NV_blend_square
   GL_NV_fragment_program
   GL_NV_light_max_exponent
   GL_NV_point_sprite
   GL_NV_texgen_reflection
   GL_NV_texture_rectangle
   GL_NV_vertex_program
   GL_NV_vertex_program1_1
   GL_OES_read_format
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_border_clamp
   GL_SGIS_texture_edge_clamp
   GL_SGIS_texture_lod
   GL_SGIX_depth_texture
   GL_SGIX_shadow
   GL_SGIX_shadow_ambient
   GL_SGI_color_matrix
   GL_SGI_color_table
   GL_SGI_texture_color_table
   GL_SUN_multi_draw_arrays

pyglet.gl.glu_info
------------------------------------------------------------------------------
glu_info.get_version(): 1.3
glu_info.get_extensions():
   GLU_EXT_nurbs_tessellator
   GLU_EXT_object_space_tess

pyglet.gl.glx_info
------------------------------------------------------------------------------
context.is_direct(): 1
glx_info.get_server_vendor(): SGI
glx_info.get_server_version(): 1.2
glx_info.get_server_extensions():
   GLX_ARB_multisample
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_EXT_import_context
   GLX_EXT_texture_from_pixmap
   GLX_OML_swap_method
   GLX_SGI_make_current_read
   GLX_SGIS_multisample
   GLX_SGIX_hyperpipe
   GLX_SGIX_swap_barrier
   GLX_SGIX_fbconfig
   GLX_MESA_copy_sub_buffer
glx_info.get_client_vendor(): SGI
glx_info.get_client_version(): 1.4
glx_info.get_client_extensions():
   GLX_ARB_get_proc_address
   GLX_ARB_multisample
   GLX_EXT_import_context
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_MESA_allocate_memory
   GLX_MESA_copy_sub_buffer
   GLX_MESA_swap_control
   GLX_MESA_swap_frame_usage
   GLX_OML_swap_method
   GLX_OML_sync_control
   GLX_SGI_make_current_read
   GLX_SGI_swap_control
   GLX_SGI_video_sync
   GLX_SGIS_multisample
   GLX_SGIX_fbconfig
   GLX_SGIX_pbuffer
   GLX_SGIX_visual_select_group
   GLX_EXT_texture_from_pixmap
glx_info.get_extensions():
   GLX_ARB_get_proc_address
   GLX_ARB_multisample
   GLX_EXT_import_context
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_OML_swap_method
   GLX_SGIS_multisample
   GLX_SGIX_fbconfig

pyglet.media
------------------------------------------------------------------------------
driver: pyglet.media.drivers.openal

pyglet.media.avbin
------------------------------------------------------------------------------
AVbin not available.

pyglet.media.drivers.openal
------------------------------------------------------------------------------
Library: <CDLL 'libopenal.so.1', handle 8e7f0f0 at 8f9a58c>
Version: (1, 1)
Extensions:
   ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX
AL lib: ALc.c:1253: exit() 1 device(s) and 1 context(s) NOT deleted

Any additional info (platform/language/hardware) that may be relevant?
Running Ubuntu 8.10, python 2.5, and pyglet 1.1.2

Original issue reported on code.google.com by dominicb...@googlemail.com on 26 Jan 2009 at 10:36

GoogleCodeExporter commented 9 years ago
I was seeing this on ubuntu.  I have since upgraded to Ubuntu jaunty and the 
issue is
gone (replaced with the one described at
http://groups.google.com/group/pyglet-users/msg/738df41a0d0431a0).

Original comment by joel.s...@gmail.com on 29 Jan 2009 at 1:20

GoogleCodeExporter commented 9 years ago
I'm seeing the same problem in Fedora 10 (Python 2.5.2, glibc-2.9-3.i686). First
noticed the problem with a program I wrote and which was working previously (in
Fedora 9 at least). Then found out the Hello World sample triggers it, too. I 
reduced
it to:

{{{
  $ python -c 'import pyglet;window =
pyglet.window.Window();label=pyglet.text.Label("Hello")'
  *** glibc detected *** python: corrupted double-linked list: 0x0a27afc8 ***
}}}

Maybe pyglet is returning objects with incorrect references and some change in 
glibc
or Python is making it visible now?

Original comment by risto.ka...@gmail.com on 4 Apr 2009 at 11:00

GoogleCodeExporter commented 9 years ago
Maybe so.  I don't really understand what the error is saying, other than it is
something to do with the underlying c code, which is well outside my field of
experience, so I'm not really qualified to say anything other than that sounds
feasible.  I was only just starting to play around with it, and didn't get very 
far.
 Not a great first impression.

Original comment by dominicb...@googlemail.com on 4 Apr 2009 at 11:50

GoogleCodeExporter commented 9 years ago
I started looking closer into pyglet implementation and remembered that I had
forgotten it's pure Python, the interfacing to GL is done with ctypes. So it's
probably not a reference count error, rather it's a problem in the pyglet code 
that
manipulates ctypes objects.

Running the hello_world.py with a tracer surprisingly ends up dumping a stack 
trace
in addition to the corruption message. I guess the tracer alters the memory 
layout or
something else that triggers the corruption in a different place:

$ python -m trace -l hello_world.py 
Mesa 7.3-devel implementation error: referencing deleted buffer object
Please report at bugzilla.freedesktop.org
Traceback (most recent call last):
  File "/usr/lib/python2.5/runpy.py", line 95, in run_module
    filename, loader, alter_sys)
  File "/usr/lib/python2.5/runpy.py", line 52, in _run_module_code
    mod_name, mod_fname, mod_loader)
  File "/usr/lib/python2.5/runpy.py", line 32, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.5/trace.py", line 794, in <module>
    main()
  File "/usr/lib/python2.5/trace.py", line 782, in main
    t.run('execfile(%r)' % (progname,))
  File "/usr/lib/python2.5/trace.py", line 489, in run
    exec cmd in dict, dict
  File "<string>", line 1, in <module>
  File "hello_world.py", line 56, in <module>
    pyglet.app.run()
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 264, in run

  File "build/bdist.linux-i686/egg/pyglet/app/xlib.py", line 94, in run
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 193, in idle

  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 1217, in dispatch_event

  File "build/bdist.linux-i686/egg/pyglet/event.py", line 340, in dispatch_event
  File "/home/black/Download/hello_world.py", line 54, in on_draw
    label.draw()
  File "build/bdist.linux-i686/egg/pyglet/text/layout.py", line 837, in draw
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 538, in draw

  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 470, in <lambda>

  File "build/bdist.linux-i686/egg/pyglet/graphics/vertexdomain.py", line 270, in draw
  File "build/bdist.linux-i686/egg/pyglet/graphics/vertexbuffer.py", line 398, in bind
  File "build/bdist.linux-i686/egg/pyglet/gl/lib.py", line 105, in errcheck
pyglet.gl.lib.GLException: invalid enumerant
*** glibc detected *** python: double free or corruption (!prev): 0x09112370 ***

Running hello_world.py with a privately built egg fails with the same glibc 
message,
and strangely enough running hello_world.py with trace module results in the 
stack
trace, but NOT the glibc corruption message!

Original comment by risto.ka...@gmail.com on 5 Apr 2009 at 11:14

GoogleCodeExporter commented 9 years ago
I noticed that I can trigger the problem with the test case RETAINED.test_v3f 
so I
ran it through pdb. I think the problem happened in the VBO code: the test has 
a 42
element array. The VBO code allocates a buffer with initial capacity of 16 
elements
and then has to expand that to 64 elements to fit the 42 elements from the test 
case.
The code allocates a new buffer, copies the contents of the old one and then 
_safe
alloc() calls glBindBuffer and glBufferData. This is where I see either a GL
exception or glibc memory corruption error.

At this point I also noticed pyglet's extensive debugging options and could 
come with
the same conclusion by just running:

  PYGLET_DEBUG_GL_TRACE=True PYGLET_DEBUG_TRACE=True PYGLET_DEBUG_TRACE_DEPTH=10
PYGLET_DEBUG_TRACE_ARGS=True python pyglet/pyglet-1.1.3/tests/test.py

I tried changing the _initial_count from 16 to 128 in order to avoid 
reallocation of
the buffer, but then I started getting "Segmentation fault". So the error is 
not in
the reallocation part but in the VBO code in general.

I hope someone can take it from here and look all the ctypes memory allocation 
and
pointer stuff a bit more closely.

At the same time as looking into the debugging options I found the 
graphics_vbo=True
default setting. Since I had seen problems in the VBO code, I tried running the 
tests
with PYGLET_GRAPHICS_VBO=False. The tests run fine!

I tried the same thing with my app and I could run it successfully too!

  PYGLET_GRAPHICS_VBO=False python my-pyglet-app.py

Having found this workaround I'm a bit less motivated to determine the Pyglet 
problem
now when I finally can work on my app...

Original comment by risto.ka...@gmail.com on 12 Apr 2009 at 11:51

GoogleCodeExporter commented 9 years ago

Original comment by m.e.w.ol...@gmail.com on 14 Aug 2009 at 12:22

GoogleCodeExporter commented 9 years ago

Original comment by benjamin...@gmail.com on 20 Aug 2009 at 1:57

GoogleCodeExporter commented 9 years ago
Is the error still there in 1.1.4 and/or mercurial trunk?

Original comment by Adam.JT...@gmail.com on 19 Sep 2011 at 4:32

GoogleCodeExporter commented 9 years ago
I don't have this problem and having not had a response from any of the 
original reporters for over a year I'm marking it invalid.

Original comment by Adam.JT...@gmail.com on 11 Dec 2012 at 10:24