BenV's notes

Archive for July, 2010

Opera + Squid -> slow?!

by on Jul.28, 2010, under Software

This tiny issue showed up a while ago, and I’m not quite sure when exactly it started. It sure was very annoying.

The problem:
Start opera, then load a ton of stuff at the same time. (your 25 tabs that have to be restored for instance). What happened was that after loading a few pages
partially, the rest would completely stall.

After some cursing I found out that it only happened when I used my squid proxy. (you know, to filter out ads because they slow the stuff down).
First I figured it must be squid. Then I realized that it would be weird, since nothing really changed. Maybe the blocklist? Nope, all looked fine.

Apparently Opera only uses a limited amount of connections to the proxy, so when a few of those requests are slow (you know, because google analytics takes 6 years to get through) the requests stack up and completely halt the process. Brilliant.

Finally I found the solution in some obscure configuration panel. Look for Enable HTTP 1.1 for proxy and make sure it’s enabled. Thanks for messing that up for me opera!
Oh well, now it’s fast again. phew.

1 Comment :, , more...

CMSMadeSimple

by on Jul.14, 2010, under Software

One of our customers has a website with some custom-made CMS made in php.
The customer asked us to fix some things, but since I hate touching pleuris-hoeren-product code, especially when the original coder is prutser and has never heard of templates (which is really weird, considering this is a CMS… maybe it’s just lazyness… then again, the echo "blabla\"escaping\"quotes\"is\"so\"much\"fun\n\n\n50 more lines here"; style really doesn’t show much intelligence…)

Anyway, I figured I might as well move the entire thing to an open CMS project that I’ve heard some good things about and already implements everything and more that the customer could ever want. That’s CmsMadeSimple.

Converting the old website to the new one was trivially easy. Copy/paste the stylesheet (first mistake), edit the basic template with a menu section, create the pages (copy/paste, copy/paste).
After fixing the html errors that were in the source the page looked like a pixel-perfect copy of the original.
Except for the places where the HTML errors were fixed that is. (the center class now actually worked for instance)

However, when adding the print links I ran into an interesting issue.
Adding print links is also a trivial thing, simply put {print} somewhere in the template, and possibly add some options to show an image instead of a text link etc.
However, the links were kinda broken, they gave empty pages. So I figured “duh, the print template still needs to be fixed”. However, as soon as I added the {content} tag to the template, I got a nice internal server error. WTF.

Checking the logs I could only find nice reports of this:

php-cgi[2530]: segfault at bf04b3f0 ip 08348d32 sp bf04b3f4 error 6 in php-cgi[8048000+6e9000]
php-cgi[2564]: segfault at bf639750 ip 08348d32 sp bf639754 error 6 in php-cgi[8048000+6e9000]
php-cgi[2804]: segfault at bf200230 ip 08348d32 sp bf200234 error 6 in php-cgi[8048000+6e9000]
php-cgi[2896]: segfault at bf00cbb0 ip 08348d32 sp bf00cbb4 error 6 in php-cgi[8048000+6e9000]

Well… .I expect nothing less from php. Pleuris-hoere-product. But how the heck… just because I added content to the print page? What’s so special about that?

After digging around (enabling logs etc) and enabling fopen for php (which I had disabled for security), I noticed this:

[Wed Jul 14 12:22:29 2010] [error] [client 123.611.204.37] PHP Warning: file_get_contents(http://some-site/oncmsmadesimple/) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required\r, referer: http://some-site/oncmsmadesimple/
[Wed Jul 14 12:22:29 2010] [error] [client 123.611.204.37] in /www/vhosts/some-site/cmsmadesimple/modules/Printing/Printing.module.php on line 96, referer: http://some-site/oncmsmadesimple/

AHA!. Apparently the printing module fetches the content (or at least, tries to) from the webserver, fails, and then segfaults php. Excellent code guys!
The reason for the failing is obvious from the logs here, I require authentication for the website since this is a test location that shouldn’t be public. Quick fix, allow the server to skip the login (vhost config):


AuthType Basic
AuthName "Testsite CmsMadeSimple"
AuthUserFile /lala/passwordfile
Require valid-user
Allow from 127.0.0.1
Allow from 192.168.1.1
Satisfy Any

Problem solved. (Hint Printing Module: render your own shit, don’t cheat with fopen/curl)

Oh yeah: CmsMadeSimple rocks for these simple websites where your customer wants to “change some texts and add a picture”. If they can handle word, you can make them handle this (but show them how!).
Give them permissions to add pages and nothing else, write a decent template for them, done.

Leave a Comment :, , , more...

Missing /dev/sd* in slackware 13

by on Jul.11, 2010, under Software

I’ve bashed my head into this problem at least three times now, so after finally running to google …. it made me search more than I liked.

The problem descriptions:
* Your system boots fine (maybe because it’s running on software raid), but your /dev/sd* files are gone.
* Your system doesn’t boot anymore, complaining about not finding your boot device when booting your custom kernel, but the stock kernel does work.
* Mounting partitions doesn’t work anymore, saying stuff like mount: special device /dev/sda does not exist

Reason:
* Your custom kernel has CONFIG_SYSFS_DEPRECATED enabled. To find out:

benv@uil$ zcat /proc/config.gz | grep CONFIG_SYSFS_DEPRECATED
CONFIG_SYSFS_DEPRECATED=y

Since udev version 151 (or something close to that) this will sparsely populate /dev. Yay.

If you don’t believe it, check out /usr/share/doc/udev-*/README:

- Udev will not work with the CONFIG_SYSFS_DEPRECATED* option.

Another problem solved.

Leave a Comment :, , more...

Archives

  • 2018 (1)
  • 2016 (1)
  • 2015 (7)
  • 2014 (4)
  • 2013 (11)
  • 2012 (27)
  • 2011 (26)
  • 2010 (25)
  • 2009 (68)