Ant SCP/SSH Task Hangs Or Never Disconnects

October 23rd, 2007

If you're using the scp or ssh tasks with ant, you may run into a problem where part way during the upload or never disconnecting after the command completes for the ssh task. There are a couple of possible causes:

  1. The scp problem is almost certainly caused by using ant 1.7.0 or below and jsch 0.1.30 or above. You could upgrade to the latest nightly of ant1 but it's probably easier to just drop back to jsch 0.1.29 which is what ant was developed against and works nicely. Bug 41090 contains the gory details.
  2. If the command you're executing with the ssh task starts a background service or otherwise leaves a process running, that may be the cause of the problem. You can add 'shopt -s huponexit' to your /etc/profile, .bashrc or somewhere like that. I must admit, I'm somewhat vague on the exact details of what that does but the basic idea seems to be to signal any background processes that bash is exiting and then not wait for them to complete (which allows your ssh connection to close). If you're starting a server they'll probably ignore the hup signal it sends and if not, use the nohup command.

Hopefully that will be the last I'll see of that issue.

1 - which seems to mean compiling from source at the moment, since the nightly build directory the Ant website links to is empty

Solr Is Cool

August 17th, 2007

I've struggled with Lucene before and failed to configure it properly resulting in absolutely horrendous search results so a recent need to implement search functionality wasn't something I particularly wanted to take on. In fact, I was prepared to do almost anything to avoid delving back into Lucene filters and parsers and tokenizers and "stuff". This tends to be problematic given that Lucene is the dominate search library - so popular in fact that it's been ported to other languages.

So I took a look at Solr - a web services front end to Lucene. Exchanging Lucene APIs for HTTP requests seems like a good tradeoff for me and Solr comes with a pretty decent configuration for Lucene right out of the box.

As it turns out, Solr's default configuration isn't just pretty decent, it's also surprisingly well commented. Combined with some reasonable documentation it was pretty straight forward to get Solr to do what I want and provide good search results without much effort. With a bit more effort I should be able to get search highlighting working as well which takes search results to a whole new level.

Two things really made me appreciate the choice to use Solr:

  1. It has a DirectSolrConnection class that removes the need for actual HTTP requests. As a bonus, it still uses the HTTP URLs and returns the same responses so if you later need to split Solr out onto it's own server you just have to implement the HTTP stuff and not change the result of your processing.
  2. It caches searches automatically.

Caching is just so cool to see in action. Using the built in search from Jackrabbit (which also uses Lucene) it was too slow to include the output of a search with each page (think, related links etc). With Solr's caching this isn't a problem anymore.

There's still a bunch of learning to do so that I can get really optimal results - getting searches to work over multiple fields properly so that I can weight the results based on which field matched would be good and I can see Solr can do it - just not quite sure how to make it all happen. Still, the current search is way better than anything I've managed to do before. Thanks to the Solr and Lucene teams!

Most Annoying Bug Ever

March 27th, 2007

I've just spent the past three or four hours setting up Apache, Subversion, all my browsers etc etc to use SSL connections and client certificates for authentication with my Debian stable server. I'm sure the mod_ssl devs already know what's coming here and are either chuckling gleefully or ripping their hair out right now. Anyway, the joke for all those who are mod_ssl devs, is that you can't get subversion to use client certificates with a Debian stable server because Debian stable has Apache 2.0.54, complete with everybody's favorite mod_ssl bug. It's fixed in Apache 2.2, but not in 2.0.

So, back to basic authentication over SSL. Sigh, I had that working about two hours ago.

Visiting “Apache HQ”

July 5th, 2004

(I wrote this Thursday night but didn’t have net access on the train to post it)

I finally managed to catch up with a number of Apache people tonight at the Thirsty Bear (rest assured the bear is not quite as thirsty after our beer drinking efforts). Afterwards we picked up the two new IBM servers that have been sitting at Collab.Net and deposited them into the cage at the colo facility. Since I’m not a server guy at all this is one of very few times I’ve been in a server room and the first chance I’ve had to see the Apache server setup (there’s now another colo in Europe somewhere I believe).

It’s pretty small and simple but seems to do the job quite well which is what really matters. Apparently the Technorati servers are in the same colo and they look a heck of a lot more impressive with a few racks full of servers and cables going everywhere.

Either way it was great to finally meet a few Apache developers and put some faces to names. My description of myself as “the tall redhead” seemed to be effective as people walked straight in the door and introduced themselves to me. Sometimes it pays to stand out a bit I guess.

Taking over planetapache.org

April 6th, 2004

It appears that my back to back rants pretty much completely took over Planet Apache the other day. er, sorry about that… I’ll try to use my “extended entry” box a little more in future…