MemoryError at /render/
Installing graphite for the first time on a clean system. After satisfying all requirements, and getting it to run ( whisper db's are being updated with data according to the logs, and the front end displays), I cant create images.
Initially, i was getting a internal 500 error, template not found on the logs, after creating this template, I'm getting this.
MemoryError at /render/
Request Method: GET
Request URL: http://
Exception Type: MemoryError
Exception Value:
Exception Location: /usr/local/
And no images show.
Am I missing anything? i even tried upgrading to the new dev version on source control, and nothing, still the same error.
Please help :)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Graphite Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- keeps
- Solved:
- Last query:
- Last reply:
Revision history for this message
![]() |
#1 |
* /usr/lib/
70. # Apply view middleware
71. for middleware_method in self._view_
72. response = middleware_
73. if response:
74. return response
75.
76. try:
77. response = callback(request, *callback_args, **callback_kwargs) ...
78. except Exception, e:
79. # If the view raised an exception, run it through exception
80. # middleware, and if the exception middleware returns a
81. # response, use that. Otherwise, reraise the exception.
82. for middleware_method in self._exception
83. response = middleware_
▶ Local vars
Variable Value
callback
<function renderView at 0x5555573e05f0>
callback_args
()
callback_
{}
debug
<module 'django.
e
<
exceptions
<module 'django.
mail_admins
<function mail_admins at 0x2aaaaac016e0>
middlewar
<bound method AuthenticationM
request
<
resolver
<
response
None
self
<
settings
<
urlconf
'web.urls'
urlresolvers
<module 'django.
* /usr/local/
100. log.rendering(
101. return response
102.
103. # We've got the data, now to render it
104. if settings.
105. image = delegateRenderi
106. else:
107. image = doImageRender(
108.
109. response = buildResponse(
110.
111. if useCache:
112. cache.set(
113.
▶ Local vars
Variable Value
cachedData
None
cachedRes
None
data
[]
dataKey
'
endTime
datetime.
graphOptions
{'width': 586, 'height': 305}
request
<
requestKey
'
requestOp
{'endTime': datetime.
start
121572877
startTime
datetime.
targets
[]
timeInterval
(
useCache
True
* /usr/local/
245. imageData = resp.read()
246. return buildResponse(
247.
248.
249. def doImageRender(
250. pngData = StringIO()
251. t = time()
252. img = graphClass(
253. img.output(pngData)
254. log.rendering(
255. imageData = pngData.getvalue()
256. pngData.close()
257. return imageData
258.
▶ Local vars
Variable Value
graphClass
<class web.render.
graphData
[]
graphOptions
{'width': 586, 'height': 305}
pngData
<
t
121572877
* /usr/local/
114. if self.data:
115. self.drawGraph(
116. else:
117. x = self.width / 2
118. y = self.height / 2
119. self.setColor(
120. self.setFont(
121. self.drawText("No Data", x, y, align='center') ...
122.
123. def setupCairo(
124. #os.chdir( os.path.
125. self.surface = cairo.ImageSurf
126. self.ctx = cairo.Context(
127.
▶ Local vars
Variable Value
colorList
['blue', 'green', 'red', 'purple', 'brown', 'yellow', 'aqua', 'grey', 'magenta', 'pink', 'gold', 'rose']
data
[]
opts
<
params
{'width': 586, 'height': 305}
self
<
x
293
y
152
* /usr/local/
174. else:
175. self.ctx.
176. self.ctx.stroke()
177.
178. def drawText(
179. if font: self.setFont(
180. if color: self.setColor(
181. extents = self.getExtents
182. angle = math.radians(
183. origMatrix = self.ctx.
184.
185. horizontal = {
186. 'left' : 0,
187. 'center' : extents['width'] / 2,
▶ Local vars
Variable Value
align
'center'
border
False
color
{}
font
{}
rotate
0
self
<
text
'No Data'
valign
'top'
x
293
y
152
* /usr/local/
146. p.update(params)
147. self.ctx.
148. self.ctx.
149.
150. def getExtents(
151. if fontOptions:
152. self.setFont(
153. F = self.ctx.
154. extents = { 'maxHeight' : F[2], 'maxAscent' : F[0], 'maxDescent' : F[1] }
155. if text:
156. T = self.ctx.
157. extents['width'] = T[4]
158. extents['height'] = T[3]
159. return extents
▶ Local vars
Variable Value
fontOptions
{}
self
<
text
'No Data'
Traceback (most recent call last):
File "/usr/lib/
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/
107. image = doImageRender(
File "/usr/local/
252. img = graphClass(
File "/usr/local/
121. self.drawText("No Data", x, y, align='center')
File "/usr/local/
181. extents = self.getExtents
File "/usr/local/
153. F = self.ctx.
MemoryError at /render/
Revision history for this message
![]() |
#2 |
Woops, sorry the above... here's the traceback from django
Traceback (most recent call last):
File "/usr/lib/
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/
107. image = doImageRender(
File "/usr/local/
252. img = graphClass(
File "/usr/local/
121. self.drawText("No Data", x, y, align='center')
File "/usr/local/
181. extents = self.getExtents
File "/usr/local/
153. F = self.ctx.
MemoryError at /render/
Revision history for this message
![]() |
#3 |
Here are all the versions of the dependencies I'm running
sqlite-
python-
python-2.4.5-19
python-
sqlite-3.3.6-2
pycairo-1.2.0-1.1
pycairo-
python-
memcached-
mod_python-
pyparsing-1.5.0-1
python-
Revision history for this message
![]() |
#4 |
Today is my night of copy paste errors...
Traceback (most recent call last):
File "/usr/lib/
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/
107. image = doImageRender(
File "/usr/local/
252. img = graphClass(
File "/usr/local/
115. self.drawGraph(
File "/usr/local/
328. self.drawLegend
File "/usr/local/
221. extents = self.getExtents
File "/usr/local/
153. F = self.ctx.
MemoryError at /render/
Revision history for this message
![]() |
#5 |
I have had this problem before myself a long time ago but unfortunately I cannot remember the exact cause or solution. I do know that it is related to cairo's ability to load fonts, so it may be an issue with libcairo, libfreetype, or libfontconfig. Have you built any of these libraries from source or are they all from distro packages? To see if fontconfig is configured properly, run the "fc-list" command and it should output a bunch of font names immediately. If it hangs for a few seconds before outputting font names then your font cache is not setup, try running "fc-cache" as root then retry the "fc-list", if the problem persists look at the cache settings in your /etc/fonts/
I am pretty sure that is how I resolved the issue for myself.
One thing you might want to try just out of curiousity is to enable the "Graph Only" option in the graph composer's Options menu under Display, this should prevent any font-related cairo calls from being made and so it will probably work.
Revision history for this message
![]() |
#6 |
Yeap, that was it. Turned off fonts and got it working. ( i actually even after it not working built custom rpm's of the latest pycairo and cairo to see if that was the issue) what fonts does it expect?
(i'm installing it in centos 5.x, and being a server, i try to keep the packages to a bare minimum )
Revision history for this message
![]() |
#7 |
It uses cairo's default font (or whatever font you explicitly specify) which on my system looks like Arial. You generally shouldn't have to worry about having the right fonts installed, but rather that fontconfig is working properly. Does the "fc-list" command immediately print a bunch of font names, or does it take a second? I think that the issue for me was that my font cache was not setup properly, and this prevents Cairo from being able to load fonts. You can check your font cache configuration by looking for the <cachedir> entries in your fonts.conf, those directories should be full of files.
Revision history for this message
![]() |
#8 |
[14:16:49] xxxxx root:[~
# fc-list
[14:16:59] xxxxx root:[~
# fc-cache
[14:17:08] xxxxx root:[~
# fc-list
[14:17:12] xxxxx root:[~
# grep cachedir /etc/fonts/
<cachedir>
<cachedir>
[14:17:31] xxxxx root:[~
# ls /var/cache/
3830d5c3ddfd5cd
[14:17:44] xxxxx root:[~
#
# rpm -qa | grep font
fontconfig-
fontconfig-
#
no fonts..
then
Installed: bitmap-fonts.noarch 0:0.3-5.1.1
Complete!
[14:22:36] xxxx root:[~
# fc-list
MiscFixed:
Console:
LucidaTypewrite
MiscFixed:
LucidaTypewrite
MiscFixed:
MiscFixed:
Fixed:style=Regular
[14:22:38] xxxx root:[~
#
Now fonts... everything works
thanks so much for all the help!