Press "Enter" to skip to content

nuxx.net Posts

php-cgi hung as sbwait with lighttpd on FreeBSD

Gallery Remote hung at "Upload completed: server processing...", which is the most obvious symptom of the lighttpd / php-cgi problems I've been having.

When uploading a quantity of photos to my gallery I like to use a tool like Gallery Remote to make it go easier. However, since moving to banstyle (and a newer version of FreeBSD and lighttpd and PHP) I’ve had Gallery Remote regularly hang at that “Upload completed: server processing…” message. It seems to happen after a few (typically two to five) images have been uploaded.

This problem has been bothering me for a while, but I was able to work around it by scping the files to the server then adding them locally, which doesn’t have this problem. Now that I have a bunch of photos from the UK trip to upload, I want to be able to use Gallery Remote again. This morning I set to getting working, but I seem to have failed.

In short, what happens is that after an upload hangs I see one of the php-cgi processes stuck in a status of sbwait, as can be seen in this screenshot:

81073 c0nsumer        1   4    0   116M 20988K sbwait 3   0:01  0.00% php-cgi

Digging around I found this thread where someone else indicates that they are having the same problem, and only on SMP boxes. (Note: banstyle.nuxx.net is four-way SMP using SCHED_ULE.) I also came across this report to the lighttpd folks regarding this issue. The consensus seems to be that when using a config such as mine, with PHP as a FastCGI and lighttpd, this occasionally happens. I’ve seen no reports of the issue occurring under Apache.

Since I’m able to reproduce the problem I did so, attached gdb to the seemingly hung php-cgi process, and grabbed a backtrace:

(gdb) bt
#0  0x00000008010a476a in read () from /lib/libc.so.7
#1  0x000000000057d5fc in fcgi_read ()
#2  0x000000000057e306 in sapi_cgi_read_post ()
#3  0x00000000004c84a4 in fill_buffer ()
#4  0x00000000004c88b5 in multipart_buffer_read ()
#5  0x00000000004c9c08 in rfc1867_post_handler ()
#6  0x00000000004c6ee5 in sapi_handle_post ()
#7  0x00000000004cc30c in php_default_treat_data ()
#8  0x00000000004cc7eb in php_hash_environment ()
#9  0x00000000004bff47 in php_request_startup ()
#10 0x000000000057f8c6 in main ()

(gdb) f 0
#0  0x00000008010a476a in read () from /lib/libc.so.7
(gdb) info frame
Stack level 0, frame at 0x7fffffff9c50:
 rip = 0x8010a476a in read; saved rip 0x57d5fc
 called by frame at 0x7fffffff9db0
 Arglist at 0x7fffffff9c40, args: 
 Locals at 0x7fffffff9c40, Previous frame's sp is 0x7fffffff9c50
 Saved registers:
  rip at 0x7fffffff9c48

Based on the input from some folks online, it’s looking like that is php-cgi doing what it’s supposed to and just waiting for more data, which means that the problem is likely somewhere in lighttpd. I’m not really sure where to go from here, besides wait for the lighttpd folks to (hopefully) fix the problem. With any luck I’ll be able to update this post later on with a solution. For now I’m going to contemplate the difficulty of going (back, in many ways) to Apache.

For reference, I’m running lighttpd 1.4.20 and PHP 5.2.6, both installed from ports, configured as described in my article about running lighttpd with PHP as FastCGI with each user having their own PHP processes.

UPDATE: So, it seems that there is a fix for this which was suggested in the aforementioned bug report. Setting the option server.network-backend = "writev" along with the already set (in my case) server.event-handler = "freebsd-kqueue" in lighttpd fixes it. I’m not sure if both options are needed to resolve the issue, but it seems that the default setting for server.network-backend of write is confirmed as broken under FreeBSD 7.0-RELEASE with lighttpd <= 1.4.20.

1 Comment

Sunny Snow

Quick photo of the first snow storm I've seen in the fall of 2008, which was happening as I returned from a trip to the UK with Danielle.

I wasn’t expecting snow upon returning to the US, but here it is. It was snowing so hard that the camera kept focusing on the snow, and I was cold enough that I didn’t want to do anything about it. The hot water heater is coming up to temperature, the wall says it’s 63°F in my office (up from 52°F when I got home), and I’m just feeling a bit cold. I think it’s about time to sort out some Thai food, maybe some beer, then relax and get to sleep. Having to wake up early to catch The Tube to Heathrow for an 8:50 AM flight, which ends up meaning that I’ve been up since 11PM EST. This should make for an interesting evening.

Also, I think I have to declare LJ and blog bankruptcy and just mark everything for the last nine days read.

Leave a Comment

401(k) Go Down

Scan of a performance chart from a report on a segment of my 401(k). It decreased quite a bit.

It’s a good thing I don’t want to retire any time soon.

This is a scan from one of my 401(k) statements, one which I received today. This isn’t all of my retirement savings, but it’s a good chunk of it. It’s a bit disheartening to see that, across all six funds this is in, everything has basically collapsed.

Leave a Comment

Lemon Drop Chile Peppers

Lemon drop chile peppers, cut into slices, to be used in the preparation of a hot sauce.

Here’s a portion of the 2/3 cup of Lemon Drop Chile Peppers which I cut up tonight for use in my multi-year hot sauce project. These were grown on my front porch, planted along with the flowers grown here in 2008.

I’ve done a bunch of stuff since cutting them up and washed my hands a few times, but I’m still too scared to use the bathroom and touch particularly sensitive bits. These are very, very hot; just below habanero according to descriptions I’ve read online. When I tried to eat one slice this size in the past, the first initial bite sent my mouth into alternating numbness and horrible pain.

Leave a Comment

Bandit Downhill / Freeride at Stony Creek

This appears to be some older bandit freeride stuff at Stony Creek.

I hadn’t realized it existed, but while poking around some unsigned single track at Stony Creek today I came across what seems like some older bandit downhill and freeride stuff at Stony Creek.

I made my way down some of the downhill stuff, although the ~16″ drops were a bit of a surprise. I didn’t attempt the bridge shown above, but instead just turned around and walked my bike back up the hill.

After riding around some I started heading back to the parking lot, but just after passing some folks and crossing over a small jump-like area on the double track between signs 2 and 1 I saw what I initially thought was a wallet and a bunch of ID laying on the ground. Heading back I found that it was just a Genuine Innovations Patch Kit Large opened and spread across the ground. I picked it up, posted about it on the MMBA forum asking if anyone lost it, and I’ll just hang on to it unless someone claims it.

Leave a Comment

Fox, CNN, MSNBC, et all Call It For Obama

You can always count on Americans to do the right thing—after they’ve tried everything else.
     Winston Churchill

Well, it looks like a wrap. Even Fox is calling it for Obama. Let’s just hope that Obama (and his appointed administration) do some good for this country. We need it.

Leave a Comment

Voting: Done

Voting this morning only took about half an hour, despite the polling place being almost completely full of people. I arrived at about 7:04 AM and departed the parking lot at just about 7:40 AM. The roads seem to be quite crowded this morning with areas around schools and churches (polling places) fairly crowded. Work itself is quite empty.

Now, to see how it all plays out… After this meeting and finishing up some other tasks, of course.

Also, my phone’s camera doesn’t have anything remotely like a macro mode. As demonstrated last night it also doesn’t do well in low light. Oh well. A crappy picture is better than none.

Leave a Comment

Coldplay at The Palace of Auburn Hills

Coldplay at The Palace of Auburn Hills (#2)

I ended up some tickets to see Coldplay at The Palace of Auburn Hills. Upon collecting them we found that they were in a rather nice location, and while this isn’t the sort of music I tend to listen to it was quite an interesting show. It was also the whitest show I’ve ever been to, but I guess that’s to be expected.

We were about five rows up from the front corner of the stage, just high enough up that we could easily see everything happening on stage without being too high up. As can be seen above we or in the links below we were close enough a basic cell phone photo without digital zoom just barely fit the main part of the stage. There were some really nifty effects as well, including spherical screens with internal projectors, video feedback displayed on a large screen behind the band, and die-cut fluorescent plastic butterflies dropped while the venue was lit with blacklights.

Here’s the five cell phone photos I grabbed during the show: 1 · 2 · 3 · 4 · 5

Leave a Comment