Opened 5 years ago

Closed 5 years ago

#3222 closed defect (can't reproduce)

During ChimeraX quit: Could not make graphics context current

Reported by: Tristan Croll Owned by: Tom Goddard
Priority: normal Milestone:
Component: Graphics Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core
ChimeraX Version: 1.0 (2020-05-09)
Description
Got this traceback on closing ChimeraX. I had an ISOLDE session running with 6yyt, and I believe some atoms were selected at the time of close.

Exception ignored in: <function Drawing.__del__ at 0x7f2f1203b830>
Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/drawing.py", line 1113, in __del__
    self.delete()
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/core/models.py", line 94, in delete
    Drawing.delete(self)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/drawing.py", line 1122, in delete
    c.make_current()	# Make OpenGL context current for deleting OpenGL resources.
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/opengl.py", line 135, in make_current
    raise OpenGLError("Could not make graphics context current")
chimerax.graphics.opengl.OpenGLError: Could not make graphics context current
Exception ignored in: <function Buffer.__del__ at 0x7f2f12002320>
Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/opengl.py", line 2496, in __del__
    % self.shader_variable_name)
chimerax.graphics.opengl.OpenGLError: OpenGL buffer "tex_coord" was not deleted before graphics.Buffer destroyed
Exception ignored in: <function Buffer.__del__ at 0x7f2f12002320>
Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/opengl.py", line 2496, in __del__
    % self.shader_variable_name)
chimerax.graphics.opengl.OpenGLError: OpenGL buffer "vcolor" was not deleted before graphics.Buffer destroyed
Exception ignored in: <function Buffer.__del__ at 0x7f2f12002320>
Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/opengl.py", line 2496, in __del__
    % self.shader_variable_name)
chimerax.graphics.opengl.OpenGLError: OpenGL buffer "normal" was not deleted before graphics.Buffer destroyed
Exception ignored in: <function Buffer.__del__ at 0x7f2f12002320>
Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/graphics/opengl.py", line 2496, in __del__
    % self.shader_variable_name)
chimerax.graphics.opengl.OpenGLError: OpenGL buffer "position" was not deleted before graphics.Buffer destroyed


Log:
Startup Messages  
---  
warning | 'clip' is a prefix of an existing command 'clipper'  
  
UCSF ChimeraX version: 1.0rc202005090702 (2020-05-09)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  




OpenGL version: 3.3.0 NVIDIA 440.33.01
OpenGL renderer: TITAN Xp/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
Manufacturer: Dell Inc.
Model: Precision T5600
OS: CentOS Linux 7 Core
Architecture: 64bit ELF
CPU: 32 Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz
Cache Size: 20480 KB
Memory:
	              total        used        free      shared  buff/cache   available
	Mem:            62G        4.1G         48G        266M         10G         57G
	Swap:          4.9G          0B        4.9G

Graphics:
	03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP102 [TITAN Xp] [10de:1b02] (rev a1)	
	Subsystem: NVIDIA Corporation Device [10de:11df]	
	Kernel driver in use: nvidia

Change History (4)

comment:1 by Eric Pettersen, 5 years ago

Component: UnassignedGraphics
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionDuring ChimeraX quit: Could not make graphics context current

comment:2 by Tom Goddard, 5 years ago

Do you recall how you closed ChimeraX? Menu File / Quit? Clicking on the main window frame close icon? Ctrl-C in shell? Apparently the graphics vanished before the models were cleaned up.

comment:3 by Tom Goddard, 5 years ago

This bug is most likely that some Drawing object is not having its delete() method called. One way this can happen is that a Model subclass defines a delete() method and then forgets to delete child models (usually by calling Model.delete()). The result of not calling delete() on a Drawing is that its OpenGL buffers and bindings are not released. In this error a Drawing is being cleaned up by Python by calling its del() method, the Drawing sees that delete() was never called on it so it tries to call delete(), but this was at exit and the OpenGL context is already gone, leading to the reported errors.

This is a pretty horrible design in the way ChimeraX handles OpenGL clean up. OpenGL is an absolute disaster of an API with everything done through global state. So to free an OpenGL buffer we cross our fingers and pray the global state is for our OpenGL context (the code should ensure this but it is extremely error prone). The buffer has no idea what OpenGL context created it. I should have remedied this in the Python OpenGL wrappers I made so if you need to delete a buffer it knows its OpenGL context and can check if it has already been closed. I will make that change in the future, but not right before 1.0. Although it would prevent the error in this report, the result would instead be a memory leak of graphics memory, so really Drawing.delete() needs to be called.

Now the trouble is which Drawing is not getting delete() called? The error gives no clue. If you can reproduce this bug we can simply catch the error in the Drawing.del() and print the name of the Drawing. I'll add that to the code now for future debugability.

comment:4 by Tom Goddard, 5 years ago

Resolution: can't reproduce
Status: assignedclosed

I added code so that if an OpenGL error occurs when deleting a Drawing it will report the name of the Drawing. This will allow figuring out which Drawing was not properly deleted at shutdown.

Please report again if you see the error again.

Note: See TracTickets for help on using tickets.