Community site: login faq

Hi everybody!

I am using a python module named spynner on the backend of my website. Spynner requires an X server, so I'm using Xvfb. I activate Xvfb from the command line as follows:

Xvfb :90 -fp /usr/share/X11/fonts/misc -fbdir /home/determinant/webapps/bulotel/temp -screen 0 1600x1200x24 &

Each time a user connects to my site, I instantiate a spynner object. Before I do that, I set the DISPLAY env variable from within python as follows:

os.environ["DISPLAY"] = ":90"

I can connect to my site for the first time, but the other time I try to connect, I get a 502 bad gateway error, and on the command line I get:

FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.

Anyone have any idea of a possible reason for this? Any help will be appreciated.

asked 02 Aug '11, 10:09

accept rate: 0%

A 502 error typically is the front-end nginx proxy server not being able to hear your app server on its assigned port. An error such as this typically means the app server is not running for one reason or another.

This means if you are using an Apache or another web-server it is what is failing, and so its log will also have info needed to debug this.

X servers can take a lot of RAM and/or CPU, and thus you should check in the control panel for any memory warnings. How much RAM and CPU resource is your X server running? You can check with these commands in SSH, where 'user' is your username

# total in MBs
ps -u user -o rss,command | grep -v peruser | awk '{sum+=$1} END {print sum/1024}' 
# All procs sorted by bytes,pid, command
ps -u user -o rss,pid,command
# real-time and CPU 
htop -u user

Lastly the error you are receiving is something specific to xvfb,

FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.

However it also may be just a warning. What log file is reporting this error?

permanent link

answered 02 Aug '11, 17:13

accept rate: 23%

Hey, thanks for your answer. I have checked it an Xvfb consumes a memory of about 4-5 Mbs. I have seven instances of apache running, I dont know why and one of them consumes 28 Mbs of memory.

And about the error message, I see it directly on the console.

(04 Aug '11, 12:07) ozgur

Did the Apache logs have any useful info?

Was the total RAM in MBs for all processes lower than your plan limit?

Apache uses 'child' processes and this is typically why you would have more than 1 thread showing Apache. You can configure the amount of child processes in the apache config file. Which python framework and web-server setup are you using exactly?

(04 Aug '11, 17:08) johns

Apache logs state that the process exited due to a segfault. And my memory goes above limits while the process that uses Xvfb is working.

However, the weird thing about the problem is that, the process works with no problem at first. Next time I run it, it doesn't work. But the next time it works again, and next time doesn't work. It all goes like this. Is it still about the memory limits you think?

And if that's the case, I still have to use Xvfb. How can I get it to work, you have any idea?

(04 Aug '11, 17:30) ozgur

p.s. Even though the memory usage goes below the limit after the process is finished, next time it still doesn't work. Memory usage stays high only while the process is running

(04 Aug '11, 17:32) ozgur

It is possibly about the memory, if say a critical process thread is killed and thus Apache gets stuck in a loop. If you check within the control panel for open tickets do you have any currently open memory tickets? If so close them and than try again, the monitor will only warn you once, when the first ticket is closed it can warn you again.

It may also not be the memory but another error causing Apache to crash. Would it be possible for you to paste the exact error being reported in the apache logs?

As it stands we do not have enough information to troubleshoot.

We know Apache for some reason is crashing after the first round of processing, which means something is failing in that process.

If the Apache logs do not show more info than you will have to look in the programming of the app itself,

Would it be possible to test the steps of the process in shell manually? Such as generating the data the app generates and manually feeding it to Xvfb to see if it causes unexpected output? Anything to break the steps apart and verify they are working one by one.

(04 Aug '11, 17:47) johns

Data in the logs is unclear, some addressing segmentation faults, and some addressing issues about threads, such as QObject is not created in the main thread and I also get keyerrors, like

Exception KeyError: KeyError(-1209014592,) in <module 'threading'="" from="" '="" usr="" local="" lib="" python2.6="" threading.pyc'=""> ignored

I am also writing the output of ps -u user -o rss,pid,command:

RSS PID COMMAND 1616 3280 sshd: determinant@pts/3 1516 3287 -bash 1832 5655 ......./httpd.conf -k start 3452 5656 ....../httpd.conf -k start 3436 5657 ....../httpd.conf -k -k start 3436 5658 ....../httpd.conf -k start 3436 5659 ....../httpd.conf -k start 3436 5660 ....../httpd.conf -k start 90104 7779 ....../httpd.conf -k start 5796 8194 emacs error_bulotel.log 908 17379 ps -u determinant -o rss,pid,command 1624 26590 sshd: determinant@pts/0 1536 26603 -bash

One of the processes of apache consumes 90 Mbs of memory after the process, and it stays like that after the process is ended. What could be the reason for this?

(04 Aug '11, 18:54) ozgur

Troubleshooting beyond this point is difficult and would require debugging the code extensively. You might want to ask the developers of the python module themselves for more info as any debugging would require an intimate knowledge of the code failing. With some google searching I found this github page, https://github.com/rndbit/spynner

(04 Aug '11, 19:18) johns

P.S. How much memory apache uses is directly related to what the code is doing, based on the observations of this entire ticket it does not sound odd that its memory is acting that way, I assume whatever is crashing your app is also causing the memory to spike.

(04 Aug '11, 19:20) johns

Ok, thanks for your help. I'll try find the reason going through my code.

(04 Aug '11, 19:23) ozgur
showing 5 of 9 show 4 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 02 Aug '11, 10:09

question was seen: 5,636 times

last updated: 04 Aug '11, 19:23